summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-01-15 08:55:00 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-01-15 14:58:05 +0000
commit356f6c5d89dd4dd92b2351898e07f99b96cb34cc (patch)
tree9f9e61103b46614434fd3d8da970b91ba3e0e683 /svx
parent8a324a3ba599bee03311e5f6ba6e1c83edc1e343 (diff)
teach FrameSelector to be resizable
Change-Id: I0fd91d707b89197d57dc6eaf7dcebfdb055d73c6
Diffstat (limited to 'svx')
-rw-r--r--svx/inc/svx/frmsel.hxx3
-rw-r--r--svx/source/dialog/frmsel.cxx37
-rw-r--r--svx/source/inc/frmselimpl.hxx3
3 files changed, 43 insertions, 0 deletions
diff --git a/svx/inc/svx/frmsel.hxx b/svx/inc/svx/frmsel.hxx
index 4f0a48eea2d6..9a8ec1514bb7 100644
--- a/svx/inc/svx/frmsel.hxx
+++ b/svx/inc/svx/frmsel.hxx
@@ -84,6 +84,7 @@ class SVX_DLLPUBLIC FrameSelector : public Control
{
public:
explicit FrameSelector( Window* pParent, const ResId& rResId );
+ FrameSelector(Window* pParent);
virtual ~FrameSelector();
/** Initializes the control, enables/disables frame borders according to flags. */
@@ -186,6 +187,8 @@ protected:
virtual void GetFocus();
virtual void LoseFocus();
virtual void DataChanged( const DataChangedEvent& rDCEvt );
+ virtual void Resize();
+ virtual Size GetOptimalSize() const;
private:
std::auto_ptr< FrameSelectorImpl > mxImpl;
diff --git a/svx/source/dialog/frmsel.cxx b/svx/source/dialog/frmsel.cxx
index be955c3311c3..5772e134b33e 100644
--- a/svx/source/dialog/frmsel.cxx
+++ b/svx/source/dialog/frmsel.cxx
@@ -18,6 +18,7 @@
*/
#include <svx/frmsel.hxx>
+#include <vcl/builder.hxx>
#include <algorithm>
#include <math.h>
@@ -374,6 +375,13 @@ void FrameSelectorImpl::InitBorderGeometry()
/* Width for focus rectangles from center of frame borders. */
mnFocusOffs = FRAMESEL_GEOM_WIDTH / 2 + 1;
+ maLeft.ClearFocusArea();
+ maVer.ClearFocusArea();
+ maRight.ClearFocusArea();
+ maTop.ClearFocusArea();
+ maHor.ClearFocusArea();
+ maBottom.ClearFocusArea();
+
maLeft.AddFocusPolygon( Rectangle( mnLine1 - mnFocusOffs, mnLine1 - mnFocusOffs, mnLine1 + mnFocusOffs, mnLine3 + mnFocusOffs ) );
maVer.AddFocusPolygon( Rectangle( mnLine2 - mnFocusOffs, mnLine1 - mnFocusOffs, mnLine2 + mnFocusOffs, mnLine3 + mnFocusOffs ) );
maRight.AddFocusPolygon( Rectangle( mnLine3 - mnFocusOffs, mnLine1 - mnFocusOffs, mnLine3 + mnFocusOffs, mnLine3 + mnFocusOffs ) );
@@ -477,6 +485,11 @@ void FrameSelectorImpl::InitVirtualDevice()
InitColors();
InitArrowImageList();
+ sizeChanged();
+}
+
+void FrameSelectorImpl::sizeChanged()
+{
// initialize geometry
InitGlobalGeometry();
InitBorderGeometry();
@@ -773,6 +786,19 @@ FrameSelector::FrameSelector( Window* pParent, const ResId& rResId ) :
EnableRTL( false ); // #107808# don't mirror the mouse handling
}
+FrameSelector::FrameSelector(Window* pParent)
+ : Control(pParent, WB_BORDER|WB_TABSTOP)
+{
+ // not in c'tor init list (avoid warning about usage of *this)
+ mxImpl.reset( new FrameSelectorImpl( *this ) );
+ EnableRTL( false ); // #107808# don't mirror the mouse handling
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeSvxFrameSelector(Window *pParent, VclBuilder::stringmap &)
+{
+ return new FrameSelector(pParent);
+}
+
FrameSelector::~FrameSelector()
{
}
@@ -1181,6 +1207,17 @@ void FrameSelector::DataChanged( const DataChangedEvent& rDCEvt )
mxImpl->InitVirtualDevice();
}
+void FrameSelector::Resize()
+{
+ Control::Resize();
+ mxImpl->sizeChanged();
+}
+
+Size FrameSelector::GetOptimalSize() const
+{
+ return LogicToPixel(Size(61, 65), MAP_APPFONT);
+}
+
// ============================================================================
template< typename Cont, typename Iter, typename Pred >
diff --git a/svx/source/inc/frmselimpl.hxx b/svx/source/inc/frmselimpl.hxx
index 26ac4d56af37..1b17756b79e0 100644
--- a/svx/source/inc/frmselimpl.hxx
+++ b/svx/source/inc/frmselimpl.hxx
@@ -163,6 +163,9 @@ struct FrameSelectorImpl : public Resource
void InitClickAreas();
/** Draws the entire control into the internal virtual device. */
void InitVirtualDevice();
+ /** call this to recalculate based on parent size */
+ void sizeChanged();
+
// frame border access ----------------------------------------------------