[gtk+/gtk-style-context: 218/260] GtkStyleContext: Add gtk_style_context_invalidate().
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-style-context: 218/260] GtkStyleContext: Add gtk_style_context_invalidate().
- Date: Wed, 20 Oct 2010 10:39:45 +0000 (UTC)
commit 8e126b3689aa5135c22bce97928314bb112d6d37
Author: Carlos Garnacho <carlosg gnome org>
Date: Sat Sep 11 12:18:26 2010 +0200
GtkStyleContext: Add gtk_style_context_invalidate().
This function will regenerate all styling information.
gtk/gtkstylecontext.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++-
gtk/gtkstylecontext.h | 5 +++++
2 files changed, 51 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index 148dbd4..c738e91 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -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,
diff --git a/gtk/gtkstylecontext.h b/gtk/gtkstylecontext.h
index 020368c..fba6028 100644
--- a/gtk/gtkstylecontext.h
+++ b/gtk/gtkstylecontext.h
@@ -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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]