[gtk+/gtk-style-context: 22/490] Add GtkThemingEngine.
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-style-context: 22/490] Add GtkThemingEngine.
- Date: Wed, 24 Nov 2010 13:41:24 +0000 (UTC)
commit 13c825b21d7a7b1d98aca260a9ae26200a99b68d
Author: Carlos Garnacho <carlosg gnome org>
Date: Sat Mar 13 11:23:23 2010 +0100
Add GtkThemingEngine.
GtkThemingEngine will be the theming engines base class, with default
implementations for all paint functions, and readonly access to the
related GtkStyleContext data.
gtk/Makefile.am | 2 +
gtk/gtk.h | 1 +
gtk/gtkthemingengine.c | 152 ++++++++++++++++++++++++++++++++++++++++++++++++
gtk/gtkthemingengine.h | 77 ++++++++++++++++++++++++
4 files changed, 232 insertions(+), 0 deletions(-)
---
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index f1e1321..ae9fcd9 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -305,6 +305,7 @@ gtk_public_h_sources = \
gtktexttag.h \
gtktexttagtable.h \
gtktextview.h \
+ gtkthemingengine.h \
gtktoggleaction.h \
gtktogglebutton.h \
gtktoggletoolbutton.h \
@@ -592,6 +593,7 @@ gtk_base_c_sources = \
gtktextutil.c \
gtktextview.c \
gtkthemes.c \
+ gtkthemingengine.c \
gtktoggleaction.c \
gtktogglebutton.c \
gtktoggletoolbutton.c \
diff --git a/gtk/gtk.h b/gtk/gtk.h
index 2abc54a..a875257 100644
--- a/gtk/gtk.h
+++ b/gtk/gtk.h
@@ -186,6 +186,7 @@
#include <gtk/gtktexttag.h>
#include <gtk/gtktexttagtable.h>
#include <gtk/gtktextview.h>
+#include <gtk/gtkthemingengine.h>
#include <gtk/gtktoggleaction.h>
#include <gtk/gtktogglebutton.h>
#include <gtk/gtktoggletoolbutton.h>
diff --git a/gtk/gtkthemingengine.c b/gtk/gtkthemingengine.c
new file mode 100644
index 0000000..b3209c8
--- /dev/null
+++ b/gtk/gtkthemingengine.c
@@ -0,0 +1,152 @@
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 2010 Carlos Garnacho <carlosg gnome org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+
+#include <gtk/gtkthemingengine.h>
+#include <gtk/gtkstylecontext.h>
+#include <gtk/gtkintl.h>
+
+#include "gtkalias.h"
+
+typedef struct GtkThemingEnginePrivate GtkThemingEnginePrivate;
+
+struct GtkThemingEnginePrivate
+{
+ GtkStyleContext *context;
+};
+
+#define GTK_THEMING_ENGINE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GTK_TYPE_THEMING_ENGINE, GtkThemingEnginePrivate))
+
+G_DEFINE_TYPE (GtkThemingEngine, gtk_theming_engine, G_TYPE_OBJECT)
+
+static void
+gtk_theming_engine_class_init (GtkThemingEngineClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ g_type_class_add_private (object_class, sizeof (GtkThemingEnginePrivate));
+}
+
+static void
+gtk_theming_engine_init (GtkThemingEngine *engine)
+{
+ engine->priv = GTK_THEMING_ENGINE_GET_PRIVATE (engine);
+}
+
+void
+_gtk_theming_engine_set_context (GtkThemingEngine *engine,
+ GtkStyleContext *context)
+{
+ GtkThemingEnginePrivate *priv;
+
+ g_return_if_fail (GTK_IS_THEMING_ENGINE (engine));
+ g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
+
+ priv = engine->priv;
+ priv->context = context;
+}
+
+void
+gtk_theming_engine_get_property (GtkThemingEngine *engine,
+ const gchar *property,
+ GtkStateType state,
+ GValue *value)
+{
+ GtkThemingEnginePrivate *priv;
+
+ g_return_if_fail (GTK_IS_THEMING_ENGINE (engine));
+ g_return_if_fail (property != NULL);
+ g_return_if_fail (state < GTK_STATE_LAST);
+ g_return_if_fail (value != NULL);
+
+ priv = engine->priv;
+ gtk_style_context_get_property (priv->context, property, state, value);
+}
+
+void
+gtk_theming_engine_get_valist (GtkThemingEngine *engine,
+ GtkStateType state,
+ va_list args)
+{
+ GtkThemingEnginePrivate *priv;
+
+ g_return_if_fail (GTK_IS_THEMING_ENGINE (engine));
+ g_return_if_fail (state < GTK_STATE_LAST);
+
+ priv = engine->priv;
+ gtk_style_context_get_valist (priv->context, state, args);
+}
+
+void
+gtk_theming_engine_get (GtkThemingEngine *engine,
+ GtkStateType state,
+ ...)
+{
+ GtkThemingEnginePrivate *priv;
+ va_list args;
+
+ g_return_if_fail (GTK_IS_THEMING_ENGINE (engine));
+ g_return_if_fail (state < GTK_STATE_LAST);
+
+ priv = engine->priv;
+
+ va_start (args, state);
+ gtk_style_context_get_valist (priv->context, state, args);
+ va_end (args);
+}
+
+GtkStateFlags
+gtk_theming_engine_get_state (GtkThemingEngine *engine)
+{
+ GtkThemingEnginePrivate *priv;
+
+ g_return_val_if_fail (GTK_IS_THEMING_ENGINE (engine), 0);
+
+ priv = engine->priv;
+ return gtk_style_context_get_state (priv->context);
+}
+
+gboolean
+gtk_theming_engine_is_state_set (GtkThemingEngine *engine,
+ GtkStateType state)
+{
+ GtkThemingEnginePrivate *priv;
+
+ g_return_val_if_fail (GTK_IS_THEMING_ENGINE (engine), 0);
+
+ priv = engine->priv;
+ return gtk_style_context_is_state_set (priv->context, state);
+}
+
+G_CONST_RETURN GtkWidgetPath *
+gtk_theming_engine_get_path (GtkThemingEngine *engine)
+{
+ GtkThemingEnginePrivate *priv;
+
+ g_return_val_if_fail (GTK_IS_THEMING_ENGINE (engine), NULL);
+
+ priv = engine->priv;
+ return gtk_style_context_get_path (priv->context);
+}
+
+#define __GTK_THEMING_ENGINE_C__
+#include "gtkaliasdef.c"
diff --git a/gtk/gtkthemingengine.h b/gtk/gtkthemingengine.h
new file mode 100644
index 0000000..5b7a3d7
--- /dev/null
+++ b/gtk/gtkthemingengine.h
@@ -0,0 +1,77 @@
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 2010 Carlos Garnacho <carlosg gnome org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GTK_THEMING_ENGINE_H__
+#define __GTK_THEMING_ENGINE_H__
+
+#include <glib-object.h>
+#include <cairo.h>
+
+#include <gtk/gtkstylecontext.h>
+#include <gtk/gtkwidgetpath.h>
+#include <gtk/gtkenums.h>
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_THEMING_ENGINE (gtk_theming_engine_get_type ())
+#define GTK_THEMING_ENGINE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GTK_TYPE_THEMING_ENGINE, GtkThemingEngine))
+#define GTK_THEMING_ENGINE_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GTK_TYPE_THEMING_ENGINE, GtkThemingEngineClass))
+#define GTK_IS_THEMING_ENGINE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTK_TYPE_THEMING_ENGINE))
+#define GTK_IS_THEMING_ENGINE_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), GTK_TYPE_THEMING_ENGINE))
+#define GTK_THEMING_ENGINE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GTK_TYPE_THEMING_ENGINE, GtkThemingEngineClass))
+
+typedef struct GtkThemingEngine GtkThemingEngine;
+typedef struct GtkThemingEngineClass GtkThemingEngineClass;
+
+struct GtkThemingEngine
+{
+ GObject parent_object;
+ gpointer priv;
+};
+
+struct GtkThemingEngineClass
+{
+ GObjectClass parent_class;
+};
+
+GType gtk_theming_engine_get_type (void) G_GNUC_CONST;
+
+void _gtk_theming_engine_set_context (GtkThemingEngine *engine,
+ GtkStyleContext *context);
+
+void gtk_theming_engine_get_property (GtkThemingEngine *engine,
+ const gchar *property,
+ GtkStateType state,
+ GValue *value);
+void gtk_theming_engine_get_valist (GtkThemingEngine *engine,
+ GtkStateType state,
+ va_list args);
+void gtk_theming_engine_get (GtkThemingEngine *engine,
+ GtkStateType state,
+ ...) G_GNUC_NULL_TERMINATED;
+
+G_CONST_RETURN GtkWidgetPath * gtk_theming_engine_get_path (GtkThemingEngine *engine);
+
+GtkStateFlags gtk_theming_engine_get_state (GtkThemingEngine *engine);
+gboolean gtk__theming_engine_is_state_set (GtkThemingEngine *engine,
+ GtkStateType state);
+
+G_END_DECLS
+
+#endif /* __GTK_THEMING_ENGINE_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]