diff options
author | Thomas Lange [tl] <tl@openoffice.org> | 2010-05-27 13:33:32 +0200 |
---|---|---|
committer | Thomas Lange [tl] <tl@openoffice.org> | 2010-05-27 13:33:32 +0200 |
commit | 961fbe7dd0e11749e622a3d710ac3d7575b4a292 (patch) | |
tree | 0449d25094476de686af9d83abf8b2b78342433b /vcl/source/control/button.cxx | |
parent | 6641398317d5f6681b2cf1715e834a1393038fe1 (diff) | |
parent | 8626c44b5da388deffa32d14bc36eef257868ba3 (diff) |
cws tl79: merge with DEV300_m79
Diffstat (limited to 'vcl/source/control/button.cxx')
-rw-r--r-- | vcl/source/control/button.cxx | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index 5b15330ed927..7979f94e0f17 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(); @@ -880,7 +888,9 @@ void PushButton::ImplInitSettings( BOOL bFont, EnableChildTransparentMode( TRUE ); SetParentClipMode( PARENTCLIPMODE_NOCLIP ); SetPaintTransparent( TRUE ); - mpWindowImpl->mbUseNativeFocus = ImplGetSVData()->maNWFData.mbNoFocusRects; + mpWindowImpl->mbUseNativeFocus = (GetStyle() & WB_FLATBUTTON) + ? false + : ImplGetSVData()->maNWFData.mbNoFocusRects; } else { @@ -1194,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 ) { @@ -1363,7 +1375,7 @@ void PushButton::ImplDrawPushButton( bool bLayout ) Size aInRectSize( LogicToPixel( Size( aInRect.GetWidth(), aInRect.GetHeight() ) ) ); aPBVal.mbSingleLine = (aInRectSize.Height() < 2 * aFontSize.Height() ); - if( ((nState & CTRL_STATE_ROLLOVER) || HasFocus()) || ! (GetStyle() & WB_FLATBUTTON) ) + if( ((nState & CTRL_STATE_ROLLOVER)) || ! (GetStyle() & WB_FLATBUTTON) ) { bNativeOK = DrawNativeControl( CTRL_PUSHBUTTON, PART_ENTIRE_CONTROL, aCtrlRegion, nState, aControlValue, rtl::OUString()/*PushButton::GetText()*/ ); @@ -1388,7 +1400,7 @@ void PushButton::ImplDrawPushButton( bool bLayout ) if( (GetStyle() & WB_FLATBUTTON) ) { Rectangle aTempRect( aInRect ); - if( ! bLayout && (bRollOver || HasFocus()) ) + if( ! bLayout && bRollOver ) ImplDrawPushButtonFrame( this, aTempRect, nButtonStyle ); aInRect.Left() += 2; aInRect.Top() += 2; @@ -1879,7 +1891,8 @@ long PushButton::PreNotify( NotifyEvent& rNEvt ) pBorder->Update(); } } - else if( IsNativeControlSupported(CTRL_PUSHBUTTON, PART_ENTIRE_CONTROL) ) + else if( (GetStyle() & WB_FLATBUTTON) || + IsNativeControlSupported(CTRL_PUSHBUTTON, PART_ENTIRE_CONTROL) ) { Invalidate(); } |