summaryrefslogtreecommitdiff
path: root/vcl/source/control/button.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/source/control/button.cxx')
-rw-r--r--vcl/source/control/button.cxx25
1 files changed, 19 insertions, 6 deletions
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 1f45b5902381..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();
@@ -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();
}