diff options
author | Noel Power <noel.power@novell.com> | 2012-07-06 11:19:57 +0100 |
---|---|---|
committer | Noel Power <noel.power@novell.com> | 2012-07-06 13:23:36 +0100 |
commit | a1345cd93a57ec7d9352f2c71ec2664332ce5e76 (patch) | |
tree | 269f871b069be6eb18b9dcf76a81c3234e61af11 /vcl | |
parent | 9ff68a2848e82e817abc96fd862a488e016c7ec5 (diff) |
fdo#51336 - change vcl checkbox no-label behaviour
Change-Id: I352c6041cc520dc76c302190dcf3a6945f5ac85f
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/vcl/button.hxx | 15 | ||||
-rw-r--r-- | vcl/source/control/button.cxx | 18 |
2 files changed, 21 insertions, 12 deletions
diff --git a/vcl/inc/vcl/button.hxx b/vcl/inc/vcl/button.hxx index 51b6034c0659..64f7581248e2 100644 --- a/vcl/inc/vcl/button.hxx +++ b/vcl/inc/vcl/button.hxx @@ -401,7 +401,6 @@ public: class VCL_DLLPUBLIC CheckBox : public Button { -private: Rectangle maStateRect; Rectangle maMouseRect; TriState meState; @@ -420,7 +419,7 @@ private: SAL_DLLPRIVATE void ImplDrawCheckBox( bool bLayout = false ); SAL_DLLPRIVATE long ImplGetImageToTextDistance() const; SAL_DLLPRIVATE Size ImplGetCheckImageSize() const; - +private: // Copy assignment is forbidden and not implemented. SAL_DLLPRIVATE CheckBox(const CheckBox &); SAL_DLLPRIVATE CheckBox& operator= (const CheckBox &); @@ -428,15 +427,19 @@ private: protected: using Control::ImplInitSettings; using Window::ImplInit; + // allows the behaviour of horizontal placement of the checbox image to be + // overridden. + virtual void ImplHandleHoriAlign( const Point& rPos, const Size& rSize, + const Size& rImageSize, Rectangle& rStateRect ); SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); - SAL_DLLPRIVATE virtual void FillLayoutData() const; - SAL_DLLPRIVATE virtual const Font& + virtual void FillLayoutData() const; + virtual const Font& GetCanonicalFont( const StyleSettings& _rStyle ) const; - SAL_DLLPRIVATE virtual const Color& + virtual const Color& GetCanonicalTextColor( const StyleSettings& _rStyle ) const; - SAL_DLLPRIVATE virtual void ImplDrawCheckBoxState(); + virtual void ImplDrawCheckBoxState(); SAL_DLLPRIVATE const Rectangle& GetStateRect() const { return maStateRect; } SAL_DLLPRIVATE const Rectangle& GetMouseRect() const { return maMouseRect; } public: diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index 6d5a8f9d8e73..e3ed723bc988 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -3251,12 +3251,9 @@ void CheckBox::ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags, } else { - if ( nWinStyle & WB_CENTER ) - rStateRect.Left() = rPos.X()+((rSize.Width()-rImageSize.Width())/2); - else if ( nWinStyle & WB_RIGHT ) - rStateRect.Left() = rPos.X()+rSize.Width()-rImageSize.Width(); - else - rStateRect.Left() = rPos.X(); + // allow specific handling of WB_CENTER, WB_LEFT & WB_RIGHT by + // by subclasses + ImplHandleHoriAlign( rPos, rSize, rImageSize, rStateRect ); if ( nWinStyle & WB_VCENTER ) rStateRect.Top() = rPos.Y()+((rSize.Height()-rImageSize.Height())/2); else if ( nWinStyle & WB_BOTTOM ) @@ -3298,6 +3295,15 @@ void CheckBox::ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags, // ----------------------------------------------------------------------- +void CheckBox:: ImplHandleHoriAlign( const Point& rPos, const Size& /*rSize*/, + const Size& /*rImageSize*/, Rectangle& rStateRect ) +{ + // align Checkbox image left ( always ) + rStateRect.Left() = rPos.X(); +} + +// ----------------------------------------------------------------------- + void CheckBox::ImplDrawCheckBox( bool bLayout ) { Size aImageSize = ImplGetCheckImageSize(); |