diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2011-01-10 02:26:28 +0100 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2011-01-10 03:49:59 +0100 |
commit | e0e36b621f8008569d5ebfab453008f5fd34e7ea (patch) | |
tree | 1dd72478a135b8c2c712500e49130d8045b89d2c /gtk/gtkbutton.c | |
parent | f506fc3e93df6d701fe141dda39a55b5f2954a83 (diff) | |
download | gtk+-e0e36b621f8008569d5ebfab453008f5fd34e7ea.tar.gz |
Update _gtk_button_paint() arguments to GtkStyleContext
The detail strings weren't in use anymore, and the state
argument is now a GtkStateFlags. GtkToggleButton has been
updated as well.
Diffstat (limited to 'gtk/gtkbutton.c')
-rw-r--r-- | gtk/gtkbutton.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c index 374d7df935..d86ca46528 100644 --- a/gtk/gtkbutton.c +++ b/gtk/gtkbutton.c @@ -1555,10 +1555,7 @@ _gtk_button_paint (GtkButton *button, cairo_t *cr, int width, int height, - GtkStateType state_type, - GtkShadowType shadow_type, - const gchar *main_detail, - const gchar *default_detail) + GtkStateFlags state) { GtkButtonPrivate *priv = button->priv; GtkWidget *widget; @@ -1571,12 +1568,12 @@ _gtk_button_paint (GtkButton *button, GtkAllocation allocation; GdkWindow *window; GtkStyleContext *context; - GtkStateFlags state; widget = GTK_WIDGET (button); - context = gtk_widget_get_style_context (widget); - state = gtk_widget_get_state_flags (widget); + + gtk_style_context_save (context); + gtk_style_context_set_state (context, state); gtk_button_get_props (button, &default_border, &default_outside_border, NULL, &interior_focus); gtk_style_context_get_style (context, @@ -1616,9 +1613,6 @@ _gtk_button_paint (GtkButton *button, height -= 2 * (focus_width + focus_pad); } - state = gtk_widget_get_state_flags (widget); - gtk_style_context_set_state (context, state); - if (priv->relief != GTK_RELIEF_NONE || priv->depressed || state & GTK_STATE_FLAG_PRELIGHT) { @@ -1671,6 +1665,8 @@ _gtk_button_paint (GtkButton *button, gtk_border_free (border); } + + gtk_style_context_restore (context); } static gboolean @@ -1678,14 +1674,11 @@ gtk_button_draw (GtkWidget *widget, cairo_t *cr) { GtkButton *button = GTK_BUTTON (widget); - GtkButtonPrivate *priv = button->priv; _gtk_button_paint (button, cr, gtk_widget_get_allocated_width (widget), gtk_widget_get_allocated_height (widget), - gtk_widget_get_state (widget), - priv->depressed ? GTK_SHADOW_IN : GTK_SHADOW_OUT, - "button", "buttondefault"); + gtk_widget_get_state_flags (widget)); GTK_WIDGET_CLASS (gtk_button_parent_class)->draw (widget, cr); |