Commit 63985b01 authored by Matthias Clasen's avatar Matthias Clasen Committed by Matthias Clasen

Add a style property ::activate_slider that allows themes to draw the

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.
parent e040b780
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.
......
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.
......
......@@ -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);
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment