Commit b7e6ae39 authored by Carlos Garnacho's avatar Carlos Garnacho

GtkStyleContext: Add gtk_style_context_[gs]et_path()

This relates a GtkStyleContext with a widget path, so
all style querying would happen based on it.
parent 9794b6ad
......@@ -40,6 +40,8 @@ struct GtkStyleContextPrivate
{
GList *providers;
GtkStyleSet *store;
GtkWidgetPath *widget_path;
GtkStateFlags state_flags;
};
......@@ -325,5 +327,35 @@ gtk_style_context_is_state_set (GtkStyleContext *context,
}
}
void
gtk_style_context_set_path (GtkStyleContext *context,
GtkWidgetPath *path)
{
GtkStyleContextPrivate *priv;
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
g_return_if_fail (path != NULL);
priv = GTK_STYLE_CONTEXT_GET_PRIVATE (context);
if (priv->widget_path)
{
gtk_widget_path_free (priv->widget_path);
priv->widget_path = NULL;
}
if (path)
priv->widget_path = gtk_widget_path_copy (path);
}
G_CONST_RETURN GtkWidgetPath *
gtk_style_context_get_path (GtkStyleContext *context)
{
GtkStyleContextPrivate *priv;
priv = GTK_STYLE_CONTEXT_GET_PRIVATE (context);
return priv->widget_path;
}
#define __GTK_STYLE_CONTEXT_C__
#include "gtkaliasdef.c"
......@@ -21,7 +21,8 @@
#define __GTK_STYLE_CONTEXT_H__
#include <glib-object.h>
#include "gtkstyleprovider.h"
#include <gtk/gtkstyleprovider.h>
#include <gtk/gtkwidgetpath.h>
G_BEGIN_DECLS
......@@ -72,6 +73,11 @@ GtkStateFlags gtk_style_context_get_state (GtkStyleContext *context);
gboolean gtk_style_context_is_state_set (GtkStyleContext *context,
GtkStateType state);
void gtk_style_context_set_path (GtkStyleContext *context,
GtkWidgetPath *path);
G_CONST_RETURN GtkWidgetPath * gtk_style_context_get_path (GtkStyleContext *context);
G_END_DECLS
#endif /* __GTK_STYLE_CONTEXT_H__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment