]> Pileus Git - ~andy/gtk/commitdiff
Add a style property ::activate_slider that allows themes to draw the
authorMatthias Clasen <mclasen@redhat.com>
Sat, 11 Mar 2006 04:09:38 +0000 (04:09 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Sat, 11 Mar 2006 04:09:38 +0000 (04:09 +0000)
2006-03-10  Matthias Clasen  <mclasen@redhat.com>

* gtk/gtkrange.c: Add a style property ::activate_slider that
allows themes to draw the slider active while dragged.  (#311992,
Benjamin Berg)

* gtk/gtkcolorsel.c (gtk_color_selection_init): Fix two labels.

ChangeLog
ChangeLog.pre-2-10
gtk/gtkcolorsel.c
gtk/gtkrange.c

index c111e8b64dca58a4372f7b213aef04ad28b10b58..ea24cc8cd82c72de269e8093e46c1bd58a1c02a6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2006-03-10  Matthias Clasen  <mclasen@redhat.com>
 
+       * gtk/gtkrange.c: Add a style property ::activate_slider that
+       allows themes to draw the slider active while dragged.  (#311992,
+       Benjamin Berg)
+
+       * gtk/gtkcolorsel.c (gtk_color_selection_init): Fix two labels.
+
        * gtk-engine-check-abi.sh: Add a script to check that theme
        engines don't export any extra functions. 
 
index c111e8b64dca58a4372f7b213aef04ad28b10b58..ea24cc8cd82c72de269e8093e46c1bd58a1c02a6 100644 (file)
@@ -1,5 +1,11 @@
 2006-03-10  Matthias Clasen  <mclasen@redhat.com>
 
+       * gtk/gtkrange.c: Add a style property ::activate_slider that
+       allows themes to draw the slider active while dragged.  (#311992,
+       Benjamin Berg)
+
+       * gtk/gtkcolorsel.c (gtk_color_selection_init): Fix two labels.
+
        * gtk-engine-check-abi.sh: Add a script to check that theme
        engines don't export any extra functions. 
 
index ec6673dfc94e72fb94009cc3de679f92ed17aed9..7d3d608de49033dd103e864f6a2ec227311d6592 100644 (file)
@@ -2067,7 +2067,7 @@ gtk_color_selection_init (GtkColorSelection *colorsel)
     }
   set_selected_palette (colorsel, 0, 0);
   priv->palette_frame = gtk_vbox_new (FALSE, 6);
-  label = gtk_label_new_with_mnemonic (_("_Palette"));
+  label = gtk_label_new_with_mnemonic (_("_Palette:"));
   gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
   gtk_box_pack_start (GTK_BOX (priv->palette_frame), label, FALSE, FALSE, 0);
 
index c3cdf88f66172811032fc44a922c58ea8034a5d6..a5f5ca2fb6d62f274849a0c76f26add7318f2e3b 100644 (file)
@@ -419,6 +419,13 @@ gtk_range_class_init (GtkRangeClass *class)
                                                             G_MAXINT,
                                                             0,
                                                             GTK_PARAM_READABLE));
+
+  gtk_widget_class_install_style_property (widget_class,
+                                          g_param_spec_boolean ("activate_slider",
+                                                                 P_("Draw slider ACTIVE during drag"),
+                                                                P_("With this option set to TRUE, sliders will be drawn ACTIVE and with shadow IN while they are dragged"),
+                                                                FALSE,
+                                                                G_PARAM_READABLE));
 }
 
 static void
@@ -1149,11 +1156,13 @@ gtk_range_expose (GtkWidget      *widget,
   GtkRange *range;
   gboolean sensitive;
   GtkStateType state;
+  GtkShadowType shadow_type;
   GdkRectangle expose_area;    /* Relative to widget->allocation */
   GdkRectangle area;
   gint focus_line_width = 0;
   gint focus_padding = 0;
   gboolean touchscreen;
+  gboolean activate_slider;
 
   g_object_get (gtk_widget_get_settings (widget),
                 "gtk-touchscreen-mode", &touchscreen,
@@ -1211,6 +1220,8 @@ gtk_range_expose (GtkWidget      *widget,
                          range->range_rect.height);
     }
 
+  shadow_type = GTK_SHADOW_OUT;
+
   if (!sensitive)
     state = GTK_STATE_INSENSITIVE;
   else if (!touchscreen && range->layout->mouse_location == MOUSE_SLIDER)
@@ -1218,6 +1229,17 @@ gtk_range_expose (GtkWidget      *widget,
   else
     state = GTK_STATE_NORMAL;
 
+  if (range->layout->grab_location == MOUSE_SLIDER)
+    {
+      gtk_widget_style_get (widget, "activate_slider", &activate_slider, NULL);
+      
+      if (activate_slider)
+        {
+          state = GTK_STATE_ACTIVE;
+          shadow_type = GTK_SHADOW_IN;
+        }
+    }
+
   if (gdk_rectangle_intersect (&expose_area,
                                &range->layout->slider,
                                &area))
@@ -1228,7 +1250,7 @@ gtk_range_expose (GtkWidget      *widget,
       gtk_paint_slider (widget->style,
                         widget->window,
                         state,
-                        GTK_SHADOW_OUT,
+                        shadow_type,
                         &area,
                         widget,
                         GTK_RANGE_GET_CLASS (range)->slider_detail,
@@ -1456,6 +1478,7 @@ gtk_range_button_press (GtkWidget      *widget,
            range->layout->mouse_location == MOUSE_SLIDER)
     {
       gboolean need_value_update = FALSE;
+      gboolean activate_slider;
 
       /* Any button can be used to drag the slider, but you can start
        * dragging the slider with a trough click using button 2;
@@ -1502,11 +1525,17 @@ gtk_range_button_press (GtkWidget      *widget,
           range->slide_initial_coordinate = event->x;
         }
 
+      range_grab_add (range, MOUSE_SLIDER, event->button);
+      
+      gtk_widget_style_get (widget, "activate_slider", &activate_slider, NULL);
+      
+      /* force a redraw, if the active slider is drawn differently to the prelight one */
+      if (activate_slider)
+        gtk_widget_queue_draw (widget);
+      
       if (need_value_update)
         update_slider_position (range, event->x, event->y);
 
-      range_grab_add (range, MOUSE_SLIDER, event->button);
-      
       return TRUE;
     }