diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | ChangeLog.pre-2-10 | 6 | ||||
-rw-r--r-- | ChangeLog.pre-2-6 | 6 | ||||
-rw-r--r-- | ChangeLog.pre-2-8 | 6 | ||||
-rw-r--r-- | gtk/gtkbutton.c | 31 |
5 files changed, 55 insertions, 0 deletions
@@ -1,3 +1,9 @@ +2004-09-20 Matthias Clasen <mclasen@redhat.com> + + * gtk/gtkbutton.c (gtk_button_class_init): Add a boolean ::displace-focus + style property and apply child displacement to the focus rectangle + if it is TRUE. (#141170, Soeren Sandmann) + Sun Sep 19 23:56:18 2004 Søren Sandmann <sandmann@redhat.com> * gtk/gtkmenu.c (MENU_SCROLL_TIMEOUT2): Change from 50 to 20 to diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index d23d7ae0c..8f40d4897 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,9 @@ +2004-09-20 Matthias Clasen <mclasen@redhat.com> + + * gtk/gtkbutton.c (gtk_button_class_init): Add a boolean ::displace-focus + style property and apply child displacement to the focus rectangle + if it is TRUE. (#141170, Soeren Sandmann) + Sun Sep 19 23:56:18 2004 Søren Sandmann <sandmann@redhat.com> * gtk/gtkmenu.c (MENU_SCROLL_TIMEOUT2): Change from 50 to 20 to diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index d23d7ae0c..8f40d4897 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,9 @@ +2004-09-20 Matthias Clasen <mclasen@redhat.com> + + * gtk/gtkbutton.c (gtk_button_class_init): Add a boolean ::displace-focus + style property and apply child displacement to the focus rectangle + if it is TRUE. (#141170, Soeren Sandmann) + Sun Sep 19 23:56:18 2004 Søren Sandmann <sandmann@redhat.com> * gtk/gtkmenu.c (MENU_SCROLL_TIMEOUT2): Change from 50 to 20 to diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index d23d7ae0c..8f40d4897 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,9 @@ +2004-09-20 Matthias Clasen <mclasen@redhat.com> + + * gtk/gtkbutton.c (gtk_button_class_init): Add a boolean ::displace-focus + style property and apply child displacement to the focus rectangle + if it is TRUE. (#141170, Soeren Sandmann) + Sun Sep 19 23:56:18 2004 Søren Sandmann <sandmann@redhat.com> * gtk/gtkmenu.c (MENU_SCROLL_TIMEOUT2): Change from 50 to 20 to diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c index d2ed60125..bcce75134 100644 --- a/gtk/gtkbutton.c +++ b/gtk/gtkbutton.c @@ -376,6 +376,21 @@ gtk_button_class_init (GtkButtonClass *klass) 0, G_PARAM_READABLE)); + /** + * GtkButton:displace-focus: + * + * Whether the child_displacement_x/child_displacement_y properties should also + * affect the focus rectangle. + * + * Since: 2.6 + */ + gtk_widget_class_install_style_property (widget_class, + g_param_spec_boolean ("displace-focus", + P_("Displace focus"), + P_("Whether the child_displacement_x/_y properties should also affect the focus rectangle"), + FALSE, + G_PARAM_READABLE)); + gtk_settings_install_property (g_param_spec_boolean ("gtk-button-images", P_("Show button images"), P_("Whether stock icons should be shown in buttons"), @@ -1064,6 +1079,16 @@ _gtk_button_paint (GtkButton *button, if (GTK_WIDGET_HAS_FOCUS (widget)) { + gint child_displacement_x; + gint child_displacement_y; + gboolean displace_focus; + + gtk_widget_style_get (GTK_WIDGET (widget), + "child_displacement_y", &child_displacement_y, + "child_displacement_x", &child_displacement_x, + "displace_focus", &displace_focus, + NULL); + if (interior_focus) { x += widget->style->xthickness + focus_pad; @@ -1079,6 +1104,12 @@ _gtk_button_paint (GtkButton *button, height += 2 * (focus_width + focus_pad); } + if (button->depressed && displace_focus) + { + x += child_displacement_x; + y += child_displacement_y; + } + gtk_paint_focus (widget->style, widget->window, GTK_WIDGET_STATE (widget), area, widget, "button", x, y, width, height); |