[Libreoffice-commits] .: Branch 'libreoffice-3-6' - vcl/win

Petr Mladek pmladek at kemper.freedesktop.org
Tue Aug 14 01:55:32 PDT 2012


 vcl/win/source/gdi/salnativewidgets-luna.cxx |   61 +++++++++++++++------------
 1 file changed, 35 insertions(+), 26 deletions(-)

New commits:
commit 53f23d99b0f5549ede0b5e868f884c7bce2e9746
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Fri Aug 10 16:16:21 2012 +0200

    Windows toolbars: Use our own theming even for vertical or bottom toolbars.
    
    Change-Id: I4836d7f2055c4811f0e6ccdc87dc58895528b3f8
    Signed-off-by: Petr Mladek <pmladek at suse.cz>

diff --git a/vcl/win/source/gdi/salnativewidgets-luna.cxx b/vcl/win/source/gdi/salnativewidgets-luna.cxx
index b8abaee..2f4df21 100644
--- a/vcl/win/source/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/source/gdi/salnativewidgets-luna.cxx
@@ -460,31 +460,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,
@@ -927,17 +937,16 @@ sal_Bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc,
             {
                 const ToolbarValue *pValue = static_cast<const ToolbarValue*>(&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);
         }
     }
@@ -954,7 +963,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;
                 }
             }


More information about the Libreoffice-commits mailing list