From 03dbe1a97c0050365ac3820575134bace0908e2b Mon Sep 17 00:00:00 2001 From: Jan Holesovsky Date: Fri, 10 Aug 2012 16:16:21 +0200 Subject: Windows toolbars: Use our own theming even for vertical or bottom toolbars. Change-Id: I4836d7f2055c4811f0e6ccdc87dc58895528b3f8 --- vcl/win/source/gdi/salnativewidgets-luna.cxx | 61 ++++++++++++++++------------ 1 file changed, 35 insertions(+), 26 deletions(-) diff --git a/vcl/win/source/gdi/salnativewidgets-luna.cxx b/vcl/win/source/gdi/salnativewidgets-luna.cxx index 065e450f9217..8c343fef458b 100644 --- a/vcl/win/source/gdi/salnativewidgets-luna.cxx +++ b/vcl/win/source/gdi/salnativewidgets-luna.cxx @@ -457,31 +457,41 @@ void ImplConvertSpinbuttonValues( int nControlPart, const ControlState& rState, pRect->bottom = rRect.Bottom()+1; } -void impl_drawAeroToolbar( HDC hDC, RECT rc ) +/// Draw an own toolbar style on Windows Vista or later, looks better there +void impl_drawAeroToolbar( HDC hDC, RECT rc, bool bHorizontal ) { - const long GRADIENT_HEIGHT = 32; + if ( rc.top == 0 && bHorizontal ) + { + const long GRADIENT_HEIGHT = 32; - long gradient_break = rc.top; - GRADIENT_RECT g_rect[1] = { { 0, 1 } }; + long gradient_break = rc.top; + GRADIENT_RECT g_rect[1] = { { 0, 1 } }; - // very slow gradient at the top (if we have space for that) - if ( rc.bottom - rc.top > GRADIENT_HEIGHT ) - { - gradient_break = rc.bottom - GRADIENT_HEIGHT; + // very slow gradient at the top (if we have space for that) + if ( rc.bottom - rc.top > GRADIENT_HEIGHT ) + { + gradient_break = rc.bottom - GRADIENT_HEIGHT; + + TRIVERTEX vert[2] = { + { rc.left, rc.top, 0xff00, 0xff00, 0xff00, 0xff00 }, + { rc.right, gradient_break, 0xfa00, 0xfa00, 0xfa00, 0xff00 }, + }; + GradientFill( hDC, vert, 2, g_rect, 1, GRADIENT_FILL_RECT_V ); + } + // gradient at the bottom TRIVERTEX vert[2] = { - { rc.left, rc.top, 0xff00, 0xff00, 0xff00, 0xff00 }, - { rc.right, gradient_break, 0xfa00, 0xfa00, 0xfa00, 0xff00 }, + { rc.left, gradient_break, 0xfa00, 0xfa00, 0xfa00, 0xff00 }, + { rc.right, rc.bottom, 0xf000, 0xf000, 0xf000, 0xff00 } }; GradientFill( hDC, vert, 2, g_rect, 1, GRADIENT_FILL_RECT_V ); } - - // gradient at the bottom - TRIVERTEX vert[2] = { - { rc.left, gradient_break, 0xfa00, 0xfa00, 0xfa00, 0xff00 }, - { rc.right, rc.bottom, 0xf000, 0xf000, 0xf000, 0xff00 } - }; - GradientFill( hDC, vert, 2, g_rect, 1, GRADIENT_FILL_RECT_V ); + else + { + HBRUSH hbrush = CreateSolidBrush( RGB( 0xf0, 0xf0, 0xf0 ) ); + FillRect( hDC, &rc, hbrush ); + DeleteObject( hbrush ); + } } sal_Bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, @@ -909,17 +919,16 @@ sal_Bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, { const ToolbarValue *pValue = static_cast(&aValue); if( pValue->mbIsTopDockingArea ) - { rc.top = 0; // extend potential gradient to cover menu bar as well + } - // make it more compatible with Aero - if( ImplGetSVData()->maNWFData.mbDockingAreaAvoidTBFrames ) - { - impl_drawAeroToolbar( hDC, rc ); - return sal_True; - } - } + // make it more compatible with Aero + if( ImplGetSVData()->maNWFData.mbDockingAreaAvoidTBFrames ) + { + impl_drawAeroToolbar( hDC, rc, nPart == PART_DRAW_BACKGROUND_HORZ ); + return sal_True; } + return ImplDrawTheme( hTheme, hDC, iPart, iState, rc, aCaption); } } @@ -936,7 +945,7 @@ sal_Bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, // make it more compatible with Aero if( ImplGetSVData()->maNWFData.mbDockingAreaAvoidTBFrames ) { - impl_drawAeroToolbar( hDC, rc ); + impl_drawAeroToolbar( hDC, rc, true ); return sal_True; } } -- cgit v1.2.3