GtkWidget: Add gtk_widget_reset_style().

This function is analogous to gtk_widget_reset_rc_styles(),
updates style recursively on a widget.
This commit is contained in:
Carlos Garnacho 2010-09-11 12:40:31 +02:00
parent 3c390c9c8e
commit f239704094
2 changed files with 21 additions and 3 deletions

View File

@ -8125,17 +8125,33 @@ _gtk_widget_propagate_screen_changed (GtkWidget *widget,
}
static void
reset_rc_styles_recurse (GtkWidget *widget, gpointer data)
reset_style_recurse (GtkWidget *widget, gpointer data)
{
GtkStyleContext *context;
#if 0
if (widget->priv->rc_style)
gtk_widget_reset_rc_style (widget);
#endif
context = g_object_get_qdata (G_OBJECT (widget),
quark_style_context);
if (context)
gtk_style_context_invalidate (context);
if (GTK_IS_CONTAINER (widget))
gtk_container_forall (GTK_CONTAINER (widget),
reset_rc_styles_recurse,
reset_style_recurse,
NULL);
}
void
gtk_widget_reset_style (GtkWidget *widget)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
reset_style_recurse (widget, NULL);
}
/**
* gtk_widget_reset_rc_styles:
@ -8152,7 +8168,7 @@ gtk_widget_reset_rc_styles (GtkWidget *widget)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
reset_rc_styles_recurse (widget, NULL);
reset_style_recurse (widget, NULL);
}
/**

View File

@ -803,6 +803,8 @@ gchar* gtk_widget_get_composite_name (GtkWidget *widget);
/* Descend recursively and set rc-style on all widgets without user styles */
void gtk_widget_reset_rc_styles (GtkWidget *widget);
void gtk_widget_reset_style (GtkWidget *widget);
/* Push/pop pairs, to change default values upon a widget's creation.
* This will override the values that got set by the
* gtk_widget_set_default_* () functions.