mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-10-02 12:07:29 +00:00
button: Remove _gtk_button_paint()
All buttons use the same paint function these days. States are managed correctly so this was just leftovers from GTK 1 or GTK 2.
This commit is contained in:
parent
d8b99d47ea
commit
8b1385804e
@ -1677,15 +1677,12 @@ gtk_button_size_allocate (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static gboolean
|
||||||
_gtk_button_paint (GtkButton *button,
|
gtk_button_draw (GtkWidget *widget,
|
||||||
cairo_t *cr,
|
cairo_t *cr)
|
||||||
int width,
|
|
||||||
int height,
|
|
||||||
GtkStateFlags state)
|
|
||||||
{
|
{
|
||||||
|
GtkButton *button = GTK_BUTTON (widget);
|
||||||
GtkButtonPrivate *priv = button->priv;
|
GtkButtonPrivate *priv = button->priv;
|
||||||
GtkWidget *widget;
|
|
||||||
gint x, y;
|
gint x, y;
|
||||||
GtkBorder default_border;
|
GtkBorder default_border;
|
||||||
GtkBorder default_outside_border;
|
GtkBorder default_outside_border;
|
||||||
@ -1694,13 +1691,12 @@ _gtk_button_paint (GtkButton *button,
|
|||||||
gint focus_pad;
|
gint focus_pad;
|
||||||
GtkAllocation allocation;
|
GtkAllocation allocation;
|
||||||
GtkStyleContext *context;
|
GtkStyleContext *context;
|
||||||
|
GtkStateFlags state;
|
||||||
gboolean draw_focus;
|
gboolean draw_focus;
|
||||||
|
gint width, height;
|
||||||
|
|
||||||
widget = GTK_WIDGET (button);
|
|
||||||
context = gtk_widget_get_style_context (widget);
|
context = gtk_widget_get_style_context (widget);
|
||||||
|
state = gtk_style_context_get_state (context);
|
||||||
gtk_style_context_save (context);
|
|
||||||
gtk_style_context_set_state (context, state);
|
|
||||||
|
|
||||||
gtk_button_get_props (button, &default_border, &default_outside_border, NULL, NULL, &interior_focus);
|
gtk_button_get_props (button, &default_border, &default_outside_border, NULL, NULL, &interior_focus);
|
||||||
gtk_style_context_get_style (context,
|
gtk_style_context_get_style (context,
|
||||||
@ -1712,6 +1708,8 @@ _gtk_button_paint (GtkButton *button,
|
|||||||
|
|
||||||
x = 0;
|
x = 0;
|
||||||
y = 0;
|
y = 0;
|
||||||
|
width = allocation.width;
|
||||||
|
height = allocation.height;
|
||||||
|
|
||||||
if (gtk_widget_has_default (widget) &&
|
if (gtk_widget_has_default (widget) &&
|
||||||
priv->relief == GTK_RELIEF_NORMAL)
|
priv->relief == GTK_RELIEF_NORMAL)
|
||||||
@ -1787,20 +1785,6 @@ _gtk_button_paint (GtkButton *button,
|
|||||||
gtk_render_focus (context, cr, x, y, width, height);
|
gtk_render_focus (context, cr, x, y, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_style_context_restore (context);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
gtk_button_draw (GtkWidget *widget,
|
|
||||||
cairo_t *cr)
|
|
||||||
{
|
|
||||||
GtkButton *button = GTK_BUTTON (widget);
|
|
||||||
|
|
||||||
_gtk_button_paint (button, cr,
|
|
||||||
gtk_widget_get_allocated_width (widget),
|
|
||||||
gtk_widget_get_allocated_height (widget),
|
|
||||||
gtk_widget_get_state_flags (widget));
|
|
||||||
|
|
||||||
GTK_WIDGET_CLASS (gtk_button_parent_class)->draw (widget, cr);
|
GTK_WIDGET_CLASS (gtk_button_parent_class)->draw (widget, cr);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -63,11 +63,6 @@ struct _GtkButtonPrivate
|
|||||||
|
|
||||||
void _gtk_button_set_depressed (GtkButton *button,
|
void _gtk_button_set_depressed (GtkButton *button,
|
||||||
gboolean depressed);
|
gboolean depressed);
|
||||||
void _gtk_button_paint (GtkButton *button,
|
|
||||||
cairo_t *cr,
|
|
||||||
int width,
|
|
||||||
int height,
|
|
||||||
GtkStateFlags state);
|
|
||||||
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
@ -113,8 +113,6 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static gint gtk_toggle_button_draw (GtkWidget *widget,
|
|
||||||
cairo_t *cr);
|
|
||||||
static gboolean gtk_toggle_button_mnemonic_activate (GtkWidget *widget,
|
static gboolean gtk_toggle_button_mnemonic_activate (GtkWidget *widget,
|
||||||
gboolean group_cycling);
|
gboolean group_cycling);
|
||||||
static void gtk_toggle_button_pressed (GtkButton *button);
|
static void gtk_toggle_button_pressed (GtkButton *button);
|
||||||
@ -159,7 +157,6 @@ gtk_toggle_button_class_init (GtkToggleButtonClass *class)
|
|||||||
gobject_class->set_property = gtk_toggle_button_set_property;
|
gobject_class->set_property = gtk_toggle_button_set_property;
|
||||||
gobject_class->get_property = gtk_toggle_button_get_property;
|
gobject_class->get_property = gtk_toggle_button_get_property;
|
||||||
|
|
||||||
widget_class->draw = gtk_toggle_button_draw;
|
|
||||||
widget_class->mnemonic_activate = gtk_toggle_button_mnemonic_activate;
|
widget_class->mnemonic_activate = gtk_toggle_button_mnemonic_activate;
|
||||||
|
|
||||||
button_class->pressed = gtk_toggle_button_pressed;
|
button_class->pressed = gtk_toggle_button_pressed;
|
||||||
@ -563,34 +560,6 @@ gtk_toggle_button_get_inconsistent (GtkToggleButton *toggle_button)
|
|||||||
return toggle_button->priv->inconsistent;
|
return toggle_button->priv->inconsistent;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
|
||||||
gtk_toggle_button_draw (GtkWidget *widget,
|
|
||||||
cairo_t *cr)
|
|
||||||
{
|
|
||||||
GtkToggleButton *toggle_button = GTK_TOGGLE_BUTTON (widget);
|
|
||||||
GtkToggleButtonPrivate *priv = toggle_button->priv;
|
|
||||||
GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget));
|
|
||||||
GtkButton *button = GTK_BUTTON (widget);
|
|
||||||
GtkStateType state;
|
|
||||||
|
|
||||||
state = gtk_widget_get_state_flags (widget);
|
|
||||||
|
|
||||||
if (priv->inconsistent)
|
|
||||||
state |= GTK_STATE_FLAG_INCONSISTENT;
|
|
||||||
else if (button->priv->depressed)
|
|
||||||
state |= GTK_STATE_FLAG_ACTIVE;
|
|
||||||
|
|
||||||
_gtk_button_paint (button, cr,
|
|
||||||
gtk_widget_get_allocated_width (widget),
|
|
||||||
gtk_widget_get_allocated_height (widget),
|
|
||||||
state);
|
|
||||||
|
|
||||||
if (child)
|
|
||||||
gtk_container_propagate_draw (GTK_CONTAINER (widget), child, cr);
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gtk_toggle_button_mnemonic_activate (GtkWidget *widget,
|
gtk_toggle_button_mnemonic_activate (GtkWidget *widget,
|
||||||
gboolean group_cycling)
|
gboolean group_cycling)
|
||||||
|
Loading…
Reference in New Issue
Block a user