[Libreoffice-commits] core.git: 2 commits - vcl/inc vcl/unx

Ivan Timofeev timofeev.i.s at gmail.com
Tue Jul 2 10:04:50 PDT 2013


 vcl/inc/unx/gtk/gtkgdi.hxx                    |    3 +-
 vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx |   38 +++++++++++++++++++-------
 2 files changed, 31 insertions(+), 10 deletions(-)

New commits:
commit db377e02c309c20419aef1360409be09fe50fc42
Author: Ivan Timofeev <timofeev.i.s at gmail.com>
Date:   Tue Jul 2 12:23:38 2013 +0400

    gtk3: Clearlooks theme paints scrollbar buttons depending on the style class
    
    Change-Id: I8e464e4b71671eccb2c0467d74542e6ddda0f5a6

diff --git a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
index fd4282f..98da944 100644
--- a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
@@ -266,6 +266,8 @@ void GtkSalGraphics::PaintScrollbar(GtkStyleContext *context,
     gdouble          arrow1Angle;                                        // backward
     gdouble          arrow2Angle;                                        // forward
     Rectangle        arrowRect;
+    const gchar*     button1StyleClass = NULL;
+    const gchar*     button2StyleClass = NULL;
     gint            slider_width = 0;
     gint            stepper_size = 0;
     gint            stepper_spacing = 0;
@@ -319,6 +321,8 @@ void GtkSalGraphics::PaintScrollbar(GtkStyleContext *context,
         scrollbarOrientation = GTK_ORIENTATION_HORIZONTAL;
         arrow1Angle = G_PI * 3 / 2;
         arrow2Angle = G_PI / 2;
+        button1StyleClass = GTK_STYLE_CLASS_LEFT;
+        button2StyleClass = GTK_STYLE_CLASS_RIGHT;
 
         if ( has_backward )
         {
@@ -359,6 +363,8 @@ void GtkSalGraphics::PaintScrollbar(GtkStyleContext *context,
         scrollbarOrientation = GTK_ORIENTATION_VERTICAL;
         arrow1Angle = 0;
         arrow2Angle = G_PI;
+        button1StyleClass = GTK_STYLE_CLASS_TOP;
+        button2StyleClass = GTK_STYLE_CLASS_BOTTOM;
 
         if ( has_backward )
         {
@@ -434,6 +440,7 @@ void GtkSalGraphics::PaintScrollbar(GtkStyleContext *context,
         gtk_style_context_save(context);
         gtk_style_context_set_state(context, stateFlags);
         gtk_style_context_add_class(context, GTK_STYLE_CLASS_BUTTON);
+        gtk_style_context_add_class(context, button1StyleClass);
 
         gtk_render_background(context, cr,
                               button11BoundRect.Left(), button11BoundRect.Top(),
@@ -460,6 +467,7 @@ void GtkSalGraphics::PaintScrollbar(GtkStyleContext *context,
         gtk_style_context_save(context);
         gtk_style_context_set_state(context, stateFlags);
         gtk_style_context_add_class(context, GTK_STYLE_CLASS_BUTTON);
+        gtk_style_context_add_class(context, button1StyleClass);
 
         gtk_render_background(context, cr,
                               button12BoundRect.Left(), button12BoundRect.Top(),
@@ -487,6 +495,7 @@ void GtkSalGraphics::PaintScrollbar(GtkStyleContext *context,
         gtk_style_context_save(context);
         gtk_style_context_set_state(context, stateFlags);
         gtk_style_context_add_class(context, GTK_STYLE_CLASS_BUTTON);
+        gtk_style_context_add_class(context, button2StyleClass);
 
         gtk_render_background(context, cr,
                               button21BoundRect.Left(), button21BoundRect.Top(),
@@ -513,6 +522,7 @@ void GtkSalGraphics::PaintScrollbar(GtkStyleContext *context,
         gtk_style_context_save(context);
         gtk_style_context_set_state(context, stateFlags);
         gtk_style_context_add_class(context, GTK_STYLE_CLASS_BUTTON);
+        gtk_style_context_add_class(context, button2StyleClass);
 
         gtk_render_background(context, cr,
                        button22BoundRect.Left(), button22BoundRect.Top(),
commit 010391b647f15efbeeba4e1a8158ab6dd550aa6b
Author: Ivan Timofeev <timofeev.i.s at gmail.com>
Date:   Tue Jul 2 12:06:13 2013 +0400

    gtk3: gtk_vscrollbar_new is deprecated, use gtk_scrollbar_new
    
    Change-Id: Iea6b6cd0147e42eab9889ea9a45aaf98c77cfaab

diff --git a/vcl/inc/unx/gtk/gtkgdi.hxx b/vcl/inc/unx/gtk/gtkgdi.hxx
index 912e27e..d75e9dc 100644
--- a/vcl/inc/unx/gtk/gtkgdi.hxx
+++ b/vcl/inc/unx/gtk/gtkgdi.hxx
@@ -61,7 +61,8 @@ private:
     GtkWidget       *mpWindow;
     static GtkStyleContext *mpButtonStyle;
     static GtkStyleContext *mpEntryStyle;
-    static GtkStyleContext *mpScrollbarStyle;
+    static GtkStyleContext *mpVScrollbarStyle;
+    static GtkStyleContext *mpHScrollbarStyle;
     static GtkStyleContext *mpToolbarStyle;
     static GtkStyleContext *mpToolButtonStyle;
     static GtkStyleContext *mpCheckButtonStyle;
diff --git a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
index 350d1e9..fd4282f 100644
--- a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
@@ -18,7 +18,8 @@
 
 GtkStyleContext* GtkSalGraphics::mpButtonStyle = NULL;
 GtkStyleContext* GtkSalGraphics::mpEntryStyle = NULL;
-GtkStyleContext* GtkSalGraphics::mpScrollbarStyle = NULL;
+GtkStyleContext* GtkSalGraphics::mpVScrollbarStyle = NULL;
+GtkStyleContext* GtkSalGraphics::mpHScrollbarStyle = NULL;
 GtkStyleContext* GtkSalGraphics::mpToolbarStyle = NULL;
 GtkStyleContext* GtkSalGraphics::mpToolButtonStyle = NULL;
 GtkStyleContext* GtkSalGraphics::mpCheckButtonStyle = NULL;
@@ -160,13 +161,19 @@ Rectangle GtkSalGraphics::NWGetSpinButtonRect( ControlPart nPart, Rectangle aAre
 
 Rectangle GtkSalGraphics::NWGetScrollButtonRect( ControlPart nPart, Rectangle aAreaRect )
 {
+    GtkStyleContext* pScrollbarStyle = NULL;
+    if ((nPart == PART_BUTTON_LEFT) || (nPart == PART_BUTTON_RIGHT))
+        pScrollbarStyle = mpHScrollbarStyle;
+    else // (nPart == PART_BUTTON_UP) || (nPart == PART_BUTTON_DOWN)
+        pScrollbarStyle = mpVScrollbarStyle;
+
     gint slider_width;
     gint stepper_size;
     gint stepper_spacing;
     gint trough_border;
 
     // Grab some button style attributes
-    gtk_style_context_get_style( mpScrollbarStyle,
+    gtk_style_context_get_style( pScrollbarStyle,
                                  "slider-width", &slider_width,
                                  "stepper-size", &stepper_size,
                                  "trough-border", &trough_border,
@@ -177,7 +184,7 @@ Rectangle GtkSalGraphics::NWGetScrollButtonRect( ControlPart nPart, Rectangle aA
     gboolean has_backward;
     gboolean has_backward2;
 
-    gtk_style_context_get_style( mpScrollbarStyle,
+    gtk_style_context_get_style( pScrollbarStyle,
                                  "has-forward-stepper", &has_forward,
                                  "has-secondary-forward-stepper", &has_forward2,
                                  "has-backward-stepper", &has_backward,
@@ -281,7 +288,7 @@ void GtkSalGraphics::PaintScrollbar(GtkStyleContext *context,
         return;
 
     // Grab some button style attributes
-    gtk_style_context_get_style( mpScrollbarStyle,
+    gtk_style_context_get_style( context,
                                  "slider_width", &slider_width,
                                  "stepper_size", &stepper_size,
                                  "trough_border", &trough_border,
@@ -292,7 +299,7 @@ void GtkSalGraphics::PaintScrollbar(GtkStyleContext *context,
     gboolean has_backward;
     gboolean has_backward2;
 
-    gtk_style_context_get_style( mpScrollbarStyle,
+    gtk_style_context_get_style( context,
                                  "has-forward-stepper", &has_forward,
                                  "has-secondary-forward-stepper", &has_forward2,
                                  "has-backward-stepper", &has_backward,
@@ -875,7 +882,8 @@ sal_Bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart
         {
         case PART_DRAW_BACKGROUND_VERT:
         case PART_DRAW_BACKGROUND_HORZ:
-            context = mpScrollbarStyle;
+            context = (nPart == PART_DRAW_BACKGROUND_VERT)
+                ? mpVScrollbarStyle : mpHScrollbarStyle;
             renderType = RENDER_SCROLLBAR;
             break;
         }
@@ -1388,7 +1396,7 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
     gint min_slider_length = 21;
 
     // Grab some button style attributes
-    gtk_style_context_get_style( mpScrollbarStyle,
+    gtk_style_context_get_style( mpVScrollbarStyle,
                                  "slider-width", &slider_width,
                                  "trough-border", &trough_border,
                                  "min-slider-length", &min_slider_length,
@@ -1499,8 +1507,10 @@ GtkSalGraphics::GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow )
     gtk_style_context_set_path(mpToolButtonStyle, path);
     gtk_widget_path_free (path);
 
-    getStyleContext(&mpScrollbarStyle, gtk_vscrollbar_new(NULL));
-    gtk_style_context_add_class(mpScrollbarStyle, GTK_STYLE_CLASS_SCROLLBAR);
+    getStyleContext(&mpVScrollbarStyle, gtk_scrollbar_new(GTK_ORIENTATION_VERTICAL, NULL));
+    gtk_style_context_add_class(mpVScrollbarStyle, GTK_STYLE_CLASS_SCROLLBAR);
+    getStyleContext(&mpHScrollbarStyle, gtk_scrollbar_new(GTK_ORIENTATION_HORIZONTAL, NULL));
+    gtk_style_context_add_class(mpHScrollbarStyle, GTK_STYLE_CLASS_SCROLLBAR);
 
     getStyleContext(&mpCheckButtonStyle, gtk_check_button_new());
 


More information about the Libreoffice-commits mailing list