From 5b980c221ada88bf26f7d1d2fa5af01e79c9976a Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 2 Aug 2008 04:52:54 +0000 Subject: [PATCH] =?UTF-8?q?Bug=20429427=20=E2=80=93=20Add=20"arrow-spacing?= =?UTF-8?q?"=20style=20property=20to=20GtkRange?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2008-08-02 Matthias Clasen Bug 429427 – Add "arrow-spacing" style property to GtkRange * gtk/gtkrange.c: Add an arrow-spacing style property. Patch by Carlos Garnacho and Christian Dywan svn path=/trunk/; revision=20939 --- ChangeLog | 7 +++++++ gtk/gtkrange.c | 23 ++++++++++++++++++++--- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0e0664b277..648d579b90 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-08-02 Matthias Clasen + + Bug 429427 – Add "arrow-spacing" style property to GtkRange + + * gtk/gtkrange.c: Add an arrow-spacing style property. + Patch by Carlos Garnacho and Christian Dywan + 2008-08-02 Matthias Clasen Bug 429411 – add style properties to set minimum progressbar diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c index 32023ebaf6..6d76c7e7a8 100644 --- a/gtk/gtkrange.c +++ b/gtk/gtkrange.c @@ -522,6 +522,20 @@ gtk_range_class_init (GtkRangeClass *class) TRUE, GTK_PARAM_READABLE)); + /** + * GtkRange:arrow-scaling: + * + * The arrow size proportion relative to the scroll button size. + * + * Since: 2.14 + */ + gtk_widget_class_install_style_property (widget_class, + g_param_spec_float ("arrow-scaling", + P_("Arrow scaling"), + P_("Arrow scaling with regard to scroll button size"), + 0.0, 1.0, 0.5, + GTK_PARAM_READABLE)); + g_type_class_add_private (class, sizeof (GtkRangeLayout)); } @@ -1324,6 +1338,7 @@ draw_stepper (GtkRange *range, GtkShadowType shadow_type; GdkRectangle intersection; GtkWidget *widget = GTK_WIDGET (range); + gfloat arrow_scaling; gint arrow_x; gint arrow_y; @@ -1375,11 +1390,13 @@ draw_stepper (GtkRange *range, rect->width, rect->height); - arrow_width = rect->width / 2; - arrow_height = rect->height / 2; + gtk_widget_style_get (widget, "arrow-scaling", &arrow_scaling, NULL); + + arrow_width = rect->width * arrow_scaling; + arrow_height = rect->height * arrow_scaling; arrow_x = widget->allocation.x + rect->x + (rect->width - arrow_width) / 2; arrow_y = widget->allocation.y + rect->y + (rect->height - arrow_height) / 2; - + if (clicked && arrow_sensitive) { gint arrow_displacement_x;