diff options
author | Philipp Lohmann [pl] <Philipp.Lohmann@Sun.COM> | 2010-04-15 20:50:30 +0200 |
---|---|---|
committer | Philipp Lohmann [pl] <Philipp.Lohmann@Sun.COM> | 2010-04-15 20:50:30 +0200 |
commit | d1ff4b4f3430d60eea947d48d9af14c90ca2d13b (patch) | |
tree | 187a423d4f555250ffedd62cfdd94f86dd02aa2a /vcl | |
parent | 2d5a8894b9250792202ed7cd4447949573d9dfbf (diff) |
nativeb: #i110915# adjust image/text alignment for flat buttons
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/vcl/button.hxx | 2 | ||||
-rw-r--r-- | vcl/source/control/button.cxx | 14 |
2 files changed, 13 insertions, 3 deletions
diff --git a/vcl/inc/vcl/button.hxx b/vcl/inc/vcl/button.hxx index 317a98026f45..8f4b94bf7b18 100644 --- a/vcl/inc/vcl/button.hxx +++ b/vcl/inc/vcl/button.hxx @@ -60,7 +60,7 @@ public: SAL_DLLPRIVATE USHORT ImplGetTextStyle( XubString& rText, WinBits nWinStyle, ULONG nDrawFlags ); SAL_DLLPRIVATE void ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos, Size& rSize, BOOL bLayout, ULONG nImageSep, ULONG nDrawFlags, - USHORT nTextStyle, Rectangle *pSymbolRect=NULL ); + USHORT nTextStyle, Rectangle *pSymbolRect=NULL, bool bAddImageSep = false ); SAL_DLLPRIVATE void ImplSetFocusRect( const Rectangle &rFocusRect ); SAL_DLLPRIVATE const Rectangle& ImplGetFocusRect() const; SAL_DLLPRIVATE void ImplSetSymbolAlign( SymbolAlign eAlign ); diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index 486cfe258449..08759f37d7a6 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -367,7 +367,8 @@ USHORT Button::ImplGetTextStyle( XubString& rText, WinBits nWinStyle, void Button::ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos, Size& rSize, BOOL bLayout, ULONG nImageSep, ULONG nDrawFlags, - USHORT nTextStyle, Rectangle *pSymbolRect ) + USHORT nTextStyle, Rectangle *pSymbolRect, + bool bAddImageSep ) { XubString aText( GetText() ); BOOL bDrawImage = HasImage() && ! ( ImplGetButtonState() & BUTTON_DRAW_NOIMAGE ); @@ -502,6 +503,13 @@ void Button::ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos, if ( aTSSize.Height() < aTextSize.Height() ) aTSSize.Height() = aTextSize.Height(); + + if( bAddImageSep && bDrawImage ) + { + long nDiff = (aImageSize.Height() - aTextSize.Height()) / 3; + if( nDiff > 0 ) + nImageSep += nDiff; + } } aMax.Width() = aTSSize.Width() > aImageSize.Width() ? aTSSize.Width() : aImageSize.Width(); @@ -1196,8 +1204,10 @@ void PushButton::ImplDrawPushButtonContent( OutputDevice* pDev, ULONG nDrawFlags ULONG nImageSep = 1 + (pDev->GetTextHeight()-10)/2; if( nImageSep < 1 ) nImageSep = 1; + // FIXME: (GetStyle() & WB_FLATBUTTON) != 0 is preliminary + // in the next major this should be replaced by "true" ImplDrawAlignedImage( pDev, aPos, aSize, bLayout, nImageSep, nDrawFlags, - nTextStyle, IsSymbol() ? &aSymbolRect : NULL ); + nTextStyle, IsSymbol() ? &aSymbolRect : NULL, (GetStyle() & WB_FLATBUTTON) != 0 ); if ( IsSymbol() && ! bLayout ) { |