diff options
author | Philipp Lohmann [pl] <Philipp.Lohmann@Oracle.COM> | 2010-07-27 17:19:20 +0200 |
---|---|---|
committer | Philipp Lohmann [pl] <Philipp.Lohmann@Oracle.COM> | 2010-07-27 17:19:20 +0200 |
commit | 5bdcd17292c63698e8c9c6d72f4941954bf9b5aa (patch) | |
tree | b600d3ef55e6f02e71fb2fba5bad6f100ff809c2 /vcl/source | |
parent | 3f0d5190f8150e29fef87f635fbd31af201027fd (diff) |
vcl114: #i113304# optionally do not draw menubutton separator for flat menu button
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/control/button.cxx | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index d4f29e224e7b..9f0bdf462eed 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -1155,7 +1155,9 @@ static void ImplDrawBtnDropDownArrow( OutputDevice* pDev, void PushButton::ImplDrawPushButtonContent( OutputDevice* pDev, ULONG nDrawFlags, const Rectangle& rRect, - bool bLayout ) + bool bLayout, + bool bMenuBtnSep + ) { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); Rectangle aInRect = rRect; @@ -1210,12 +1212,15 @@ void PushButton::ImplDrawPushButtonContent( OutputDevice* pDev, ULONG nDrawFlags if( ! bLayout ) { - DecorationView aDecoView( pDev ); long nDistance = (aInRect.GetHeight() > 10) ? 2 : 1; - long nX = aInRect.Left() - 2*nDistance;; - Point aStartPt( nX, aInRect.Top()+nDistance ); - Point aEndPt( nX, aInRect.Bottom()-nDistance ); - aDecoView.DrawSeparator( aStartPt, aEndPt ); + DecorationView aDecoView( pDev ); + if( bMenuBtnSep ) + { + long nX = aInRect.Left() - 2*nDistance;; + Point aStartPt( nX, aInRect.Top()+nDistance ); + Point aEndPt( nX, aInRect.Bottom()-nDistance ); + aDecoView.DrawSeparator( aStartPt, aEndPt ); + } aDecoView.DrawSymbol( aInRect, SYMBOL_SPIN_DOWN, aColor, nStyle ); aInRect.Left() -= 2*nDistance; ImplSetSymbolRect( aInRect ); @@ -1356,6 +1361,12 @@ void PushButton::ImplDrawPushButton( bool bLayout ) return; bool bRollOver = (IsMouseOver() && aInRect.IsInside( GetPointerPosPixel() )); + bool bDrawMenuSep = true; + if( (GetStyle() & WB_FLATBUTTON) ) + { + if( ! bRollOver && ! HasFocus() ) + bDrawMenuSep = false; + } if ( (bNativeOK=IsNativeControlSupported(CTRL_PUSHBUTTON, PART_ENTIRE_CONTROL)) == TRUE ) { PushButtonValue aControlValue; @@ -1406,7 +1417,7 @@ void PushButton::ImplDrawPushButton( bool bLayout ) // draw content using the same aInRect as non-native VCL would do ImplDrawPushButtonContent( this, (nState&CTRL_STATE_ROLLOVER) ? WINDOW_DRAW_ROLLOVER : 0, - aInRect, bLayout ); + aInRect, bLayout, bDrawMenuSep ); if ( HasFocus() ) ShowFocus( ImplGetFocusRect() ); @@ -1432,7 +1443,7 @@ void PushButton::ImplDrawPushButton( bool bLayout ) } // draw content - ImplDrawPushButtonContent( this, 0, aInRect, bLayout ); + ImplDrawPushButtonContent( this, 0, aInRect, bLayout, bDrawMenuSep ); if( ! bLayout && HasFocus() ) { @@ -1753,7 +1764,7 @@ void PushButton::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, nButtonStyle |= BUTTON_DRAW_CHECKED; aRect = aDecoView.DrawButton( aRect, nButtonStyle ); - ImplDrawPushButtonContent( pDev, nFlags, aRect, false ); + ImplDrawPushButtonContent( pDev, nFlags, aRect, false, true ); pDev->Pop(); } |