diff options
author | Tim Janik <timj@imendio.com> | 2006-09-19 15:51:19 +0000 |
---|---|---|
committer | Tim Janik <timj@src.gnome.org> | 2006-09-19 15:51:19 +0000 |
commit | fb12bbcebbf5fe614ef9660f28505a31c9cd997d (patch) | |
tree | 8900141abbd757263b9754b4d373f1df4301d62d | |
parent | 19063333ad586dba76029e3de7a88670ff9a5cb1 (diff) | |
download | gtk+-fb12bbcebbf5fe614ef9660f28505a31c9cd997d.tar.gz |
added GtkArrow::arrow-scaling style property to control the arrow/border
Tue Sep 19 17:00:04 2006 Tim Janik <timj@imendio.com>
* gtk/gtkarrow.c: added GtkArrow::arrow-scaling style property to
control the arrow/border ratio within the allocation.
* tests/testgtk.c: added a GtkArrow to handle box test.
* tests/testgtkrc: test ::arrow-scaling property.
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | gtk/gtkarrow.c | 18 | ||||
-rw-r--r-- | tests/testgtk.c | 4 | ||||
-rw-r--r-- | tests/testgtkrc | 1 |
4 files changed, 25 insertions, 7 deletions
@@ -1,3 +1,12 @@ +Tue Sep 19 17:00:04 2006 Tim Janik <timj@imendio.com> + + * gtk/gtkarrow.c: added GtkArrow::arrow-scaling style property to + control the arrow/border ratio within the allocation. + + * tests/testgtk.c: added a GtkArrow to handle box test. + + * tests/testgtkrc: test ::arrow-scaling property. + 2006-09-19 Matthias Clasen <mclasen@redhat.com> * gtk/gtkfilechooserdefault.c (update_current_folder_get_info_cb): diff --git a/gtk/gtkarrow.c b/gtk/gtkarrow.c index 45f024d613..2a2427410b 100644 --- a/gtk/gtkarrow.c +++ b/gtk/gtkarrow.c @@ -86,7 +86,13 @@ gtk_arrow_class_init (GtkArrowClass *class) GTK_TYPE_SHADOW_TYPE, GTK_SHADOW_OUT, GTK_PARAM_READWRITE)); - + gtk_widget_class_install_style_property (widget_class, + g_param_spec_float ("arrow-scaling", + P_("Arrow Scaling"), + P_("Amount of space sed up by arrow"), + 0.0, 1.0, 0.7, + GTK_PARAM_READABLE)); + widget_class->expose_event = gtk_arrow_expose; } @@ -204,8 +210,6 @@ static gboolean gtk_arrow_expose (GtkWidget *widget, GdkEventExpose *event) { - GtkArrow *arrow; - GtkMisc *misc; GtkShadowType shadow_type; gint width, height; gint x, y; @@ -215,12 +219,14 @@ gtk_arrow_expose (GtkWidget *widget, if (GTK_WIDGET_DRAWABLE (widget)) { - arrow = GTK_ARROW (widget); - misc = GTK_MISC (widget); + GtkArrow *arrow = GTK_ARROW (widget); + GtkMisc *misc = GTK_MISC (widget); + gfloat arrow_scaling; + gtk_widget_style_get (widget, "arrow-scaling", &arrow_scaling, NULL); width = widget->allocation.width - misc->xpad * 2; height = widget->allocation.height - misc->ypad * 2; - extent = MIN (width, height) * 0.7; + extent = MIN (width, height) * arrow_scaling; effective_arrow_type = arrow->arrow_type; if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR) diff --git a/tests/testgtk.c b/tests/testgtk.c index e12089ada0..c7274e05b8 100644 --- a/tests/testgtk.c +++ b/tests/testgtk.c @@ -2389,9 +2389,11 @@ create_handle_box (GtkWidget *widget) "detached"); gtk_widget_show (handle_box2); + hbox = g_object_new (GTK_TYPE_HBOX, "visible", 1, "parent", handle_box2, NULL); label = gtk_label_new ("Fooo!"); - gtk_container_add (GTK_CONTAINER (handle_box2), label); + gtk_container_add (GTK_CONTAINER (hbox), label); gtk_widget_show (label); + g_object_new (GTK_TYPE_ARROW, "visible", 1, "parent", hbox, NULL); } if (!GTK_WIDGET_VISIBLE (window)) diff --git a/tests/testgtkrc b/tests/testgtkrc index f711ae79bd..e94ab284b7 100644 --- a/tests/testgtkrc +++ b/tests/testgtkrc @@ -31,6 +31,7 @@ style "global-style-properties" GtkToolbar::button_relief = none GtkButtonBox::child_min_width = 0 GtkButtonBox::child_min_height = 0 + GtkArrow::arrow-scaling = 1.0 } class "GtkWidget" style "global-style-properties" |