summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorLucas Baudin <xapantu@gmail.com>2011-01-29 21:20:45 +0100
committerCédric Bosdonnat <cedricbosdo@openoffice.org>2011-01-31 11:24:43 +0100
commit0377b99b3f50a67e7845a3d728313e5a2ef36e73 (patch)
treeae3d17f4374f107ede9faed70507cd1e24c81f1d /vcl/source
parentd326d10ba876b064cb092a3cf4909fc3c915242a (diff)
GTK: Use gtk vseparator instead of native one for the toolbar
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/window/toolbox.cxx125
1 files changed, 76 insertions, 49 deletions
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 16b1f5d7a4a9..ea24b661efa0 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -3403,6 +3403,54 @@ void ToolBox::ImplDrawNext( BOOL bIn )
// -----------------------------------------------------------------------
+void ToolBox::ImplDrawSeparator( USHORT nPos, Rectangle rRect )
+{
+ BOOL bNativeOk = FALSE;
+ ImplToolItem* pItem = &mpData->m_aItems[nPos];
+
+ if( IsNativeControlSupported( CTRL_TOOLBAR, PART_SEPARATOR ) )
+ {
+ ImplControlValue aControlValue;
+ ControlState nState = 0;
+ bNativeOk = DrawNativeControl( CTRL_TOOLBAR, PART_SEPARATOR,
+ rRect, nState, aControlValue, rtl::OUString() );
+ }
+
+ /* Draw the widget only if it can't be drawn natively. */
+ if( !bNativeOk )
+ {
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ ImplToolItem* pTempItem = &mpData->m_aItems[nPos-1];
+
+ // no separator before or after windows or at breaks
+ if ( pTempItem && !pTempItem->mbShowWindow && nPos < mpData->m_aItems.size()-1 )
+ {
+ pTempItem = &mpData->m_aItems[nPos+1];
+ if ( !pTempItem->mbShowWindow && !pTempItem->mbBreak )
+ {
+ long nCenterPos, nSlim;
+ SetLineColor( rStyleSettings.GetSeparatorColor() );
+ if ( IsHorizontal() )
+ {
+ nSlim = (pItem->maRect.Bottom() - pItem->maRect.Top ()) / 4;
+ nCenterPos = pItem->maRect.Center().X();
+ DrawLine( Point( nCenterPos, pItem->maRect.Top() + nSlim ),
+ Point( nCenterPos, pItem->maRect.Bottom() - nSlim ) );
+ }
+ else
+ {
+ nSlim = (pItem->maRect.Right() - pItem->maRect.Left ()) / 4;
+ nCenterPos = pItem->maRect.Center().Y();
+ DrawLine( Point( pItem->maRect.Left() + nSlim, nCenterPos ),
+ Point( pItem->maRect.Right() - nSlim, nCenterPos ) );
+ }
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
static void ImplDrawButton( ToolBox* pThis, const Rectangle &rRect, USHORT highlight, BOOL bChecked, BOOL bEnabled, BOOL bIsWindow )
{
// draws toolbar button background either native or using a coloured selection
@@ -3462,6 +3510,33 @@ void ToolBox::ImplDrawItem( USHORT nPos, BOOL bHighlight, BOOL bPaint, BOOL bLay
if( rStyleSettings.GetFaceColor() == Color( COL_WHITE ) )
bHighContrastWhite = TRUE;
+ // Compute buttons area.
+ Size aBtnSize = pItem->maRect.GetSize();
+ if( ImplGetSVData()->maNWFData.mbToolboxDropDownSeparate )
+ {
+ // separate button not for dropdown only where the whole button is painted
+ if ( pItem->mnBits & TIB_DROPDOWN &&
+ ((pItem->mnBits & TIB_DROPDOWNONLY) != TIB_DROPDOWNONLY) )
+ {
+ Rectangle aArrowRect = pItem->GetDropDownRect( mbHorz );
+ if( aArrowRect.Top() == pItem->maRect.Top() ) // dropdown arrow on right side
+ aBtnSize.Width() -= aArrowRect.GetWidth();
+ else // dropdown arrow on bottom side
+ aBtnSize.Height() -= aArrowRect.GetHeight();
+ }
+ }
+
+ /* Compute the button/separator rectangle here, we'll need it for
+ * both the buttons and the separators. */
+ Rectangle aButtonRect( pItem->maRect.TopLeft(), aBtnSize );
+ long nOffX = SMALLBUTTON_OFF_NORMAL_X;
+ long nOffY = SMALLBUTTON_OFF_NORMAL_Y;
+ long nImageOffX = 0;
+ long nImageOffY = 0;
+ long nTextOffX = 0;
+ long nTextOffY = 0;
+ USHORT nStyle = 0;
+
// draw separators in flat style only
if ( !bLayout &&
(mnOutStyle & TOOLBOX_STYLE_FLAT) &&
@@ -3469,31 +3544,7 @@ void ToolBox::ImplDrawItem( USHORT nPos, BOOL bHighlight, BOOL bPaint, BOOL bLay
nPos > 0
)
{
- // no separator before or after windows or at breaks
- ImplToolItem* pTempItem = &mpData->m_aItems[nPos-1];
- if ( pTempItem && !pTempItem->mbShowWindow && nPos < mpData->m_aItems.size()-1 )
- {
- pTempItem = &mpData->m_aItems[nPos+1];
- if ( !pTempItem->mbShowWindow && !pTempItem->mbBreak )
- {
- long nCenterPos, nSlim;
- SetLineColor( rStyleSettings.GetSeparatorColor() );
- if ( IsHorizontal() )
- {
- nSlim = (pItem->maRect.Bottom() - pItem->maRect.Top ()) / 4;
- nCenterPos = pItem->maRect.Center().X();
- DrawLine( Point( nCenterPos, pItem->maRect.Top() + nSlim ),
- Point( nCenterPos, pItem->maRect.Bottom() - nSlim ) );
- }
- else
- {
- nSlim = (pItem->maRect.Right() - pItem->maRect.Left ()) / 4;
- nCenterPos = pItem->maRect.Center().Y();
- DrawLine( Point( pItem->maRect.Left() + nSlim, nCenterPos ),
- Point( pItem->maRect.Right() - nSlim, nCenterPos ) );
- }
- }
- }
+ ImplDrawSeparator( nPos, aButtonRect );
}
// do nothing if item is no button or will be displayed as window
@@ -3557,30 +3608,6 @@ void ToolBox::ImplDrawItem( USHORT nPos, BOOL bHighlight, BOOL bPaint, BOOL bLay
return;
}
- // draw button
- Size aBtnSize = pItem->maRect.GetSize();
- if( ImplGetSVData()->maNWFData.mbToolboxDropDownSeparate )
- {
- // separate button not for dropdown only where the whole button is painted
- if ( pItem->mnBits & TIB_DROPDOWN &&
- ((pItem->mnBits & TIB_DROPDOWNONLY) != TIB_DROPDOWNONLY) )
- {
- Rectangle aArrowRect = pItem->GetDropDownRect( mbHorz );
- if( aArrowRect.Top() == pItem->maRect.Top() ) // dropdown arrow on right side
- aBtnSize.Width() -= aArrowRect.GetWidth();
- else // dropdown arrow on bottom side
- aBtnSize.Height() -= aArrowRect.GetHeight();
- }
- }
- Rectangle aButtonRect( pItem->maRect.TopLeft(), aBtnSize );
- long nOffX = SMALLBUTTON_OFF_NORMAL_X;
- long nOffY = SMALLBUTTON_OFF_NORMAL_Y;
- long nImageOffX=0;
- long nImageOffY=0;
- long nTextOffX=0;
- long nTextOffY=0;
- USHORT nStyle = 0;
-
if ( pItem->meState == STATE_CHECK )
{
nStyle |= BUTTON_DRAW_CHECKED;