mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-07 01:00:28 +00:00
GtkStyleContext: Add gtk_style_context_invalidate().
This function will regenerate all styling information.
This commit is contained in:
parent
756bbf526f
commit
9f84e101bf
@ -97,7 +97,9 @@ struct GtkStyleContextPrivate
|
||||
|
||||
GSList *animation_regions;
|
||||
GSList *animations;
|
||||
gboolean animations_invalidated;
|
||||
|
||||
guint animations_invalidated : 1;
|
||||
guint invalidating_context : 1;
|
||||
|
||||
GtkThemingEngine *theming_engine;
|
||||
|
||||
@ -110,6 +112,13 @@ enum {
|
||||
PROP_DIRECTION
|
||||
};
|
||||
|
||||
enum {
|
||||
CHANGED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
guint signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
static void gtk_style_context_finalize (GObject *object);
|
||||
|
||||
static void gtk_style_context_impl_set_property (GObject *object,
|
||||
@ -133,6 +142,15 @@ gtk_style_context_class_init (GtkStyleContextClass *klass)
|
||||
object_class->set_property = gtk_style_context_impl_set_property;
|
||||
object_class->get_property = gtk_style_context_impl_get_property;
|
||||
|
||||
signals[CHANGED] =
|
||||
g_signal_new (I_("changed"),
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (GtkStyleContextClass, changed),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_SCREEN,
|
||||
g_param_spec_object ("screen",
|
||||
@ -1798,6 +1816,33 @@ store_animation_region (GtkStyleContext *context,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gtk_style_context_invalidate (GtkStyleContext *context)
|
||||
{
|
||||
GtkStyleContextPrivate *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
|
||||
|
||||
priv = context->priv;
|
||||
|
||||
/* Avoid reentrancy */
|
||||
if (priv->invalidating_context)
|
||||
return;
|
||||
|
||||
if (!priv->widget_path)
|
||||
return;
|
||||
|
||||
priv->invalidating_context = TRUE;
|
||||
|
||||
rebuild_properties (context);
|
||||
clear_property_cache (context);
|
||||
rebuild_icon_factories (context);
|
||||
|
||||
g_signal_emit (context, signals[CHANGED], 0);
|
||||
|
||||
priv->invalidating_context = FALSE;
|
||||
}
|
||||
|
||||
/* Paint methods */
|
||||
void
|
||||
gtk_render_check (GtkStyleContext *context,
|
||||
|
@ -45,6 +45,8 @@ struct GtkStyleContext
|
||||
struct GtkStyleContextClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
|
||||
void (* changed) (GtkStyleContext *context);
|
||||
};
|
||||
|
||||
GType gtk_style_context_get_type (void) G_GNUC_CONST;
|
||||
@ -160,6 +162,9 @@ void gtk_style_context_state_transition_update (GtkStyleContext *context,
|
||||
void gtk_style_context_state_transition_stop (GtkStyleContext *context,
|
||||
gpointer identifier);
|
||||
|
||||
void gtk_style_context_invalidate (GtkStyleContext *context);
|
||||
|
||||
|
||||
/* Paint methods */
|
||||
void gtk_render_check (GtkStyleContext *context,
|
||||
cairo_t *cr,
|
||||
|
Loading…
Reference in New Issue
Block a user