[monet] Add MnThemeEngine
- From: Thomas Wood <thos src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [monet] Add MnThemeEngine
- Date: Sat, 7 Nov 2009 12:37:06 +0000 (UTC)
commit c717767e71efbfc92a4c1bd4e84815b57bbd06f0
Author: Thomas Wood <thos gnome org>
Date: Sat Nov 7 12:36:49 2009 +0000
Add MnThemeEngine
MnThemeEngine provides the base type for theme engines. It currently has
one virtual function that is used to draw widgets.
monet/Makefile.am | 2 +
monet/mn-theme-engine.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++
monet/mn-theme-engine.h | 64 ++++++++++++++++++++++++++++++++++++
3 files changed, 149 insertions(+), 0 deletions(-)
---
diff --git a/monet/Makefile.am b/monet/Makefile.am
index de70d3e..1eeea17 100644
--- a/monet/Makefile.am
+++ b/monet/Makefile.am
@@ -15,6 +15,7 @@ source_h = \
mn-color.h \
mn-palette.h \
mn-parts.h \
+ mn-theme-engine.h \
mn-types.h \
mn-widget.h \
monet.h
@@ -72,6 +73,7 @@ libmonet_la_SOURCES = \
$(source_h_priv) \
mn-color.c \
mn-palette.c \
+ mn-theme-engine.c\
mn-widget.c \
monet.c
diff --git a/monet/mn-theme-engine.c b/monet/mn-theme-engine.c
new file mode 100644
index 0000000..b12cb11
--- /dev/null
+++ b/monet/mn-theme-engine.c
@@ -0,0 +1,83 @@
+/* mn-theme-engine.c */
+
+#include "mn-theme-engine.h"
+
+G_DEFINE_ABSTRACT_TYPE (MnThemeEngine, mn_theme_engine, G_TYPE_OBJECT)
+
+#define THEME_ENGINE_PRIVATE(o) \
+ (G_TYPE_INSTANCE_GET_PRIVATE ((o), MN_TYPE_THEME_ENGINE, MnThemeEnginePrivate))
+
+struct _MnThemeEnginePrivate
+{
+ gpointer dummy;
+};
+
+
+static void
+mn_theme_engine_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
+{
+ switch (property_id)
+ {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ }
+}
+
+static void
+mn_theme_engine_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
+{
+ switch (property_id)
+ {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ }
+}
+
+static void
+mn_theme_engine_dispose (GObject *object)
+{
+ G_OBJECT_CLASS (mn_theme_engine_parent_class)->dispose (object);
+}
+
+static void
+mn_theme_engine_finalize (GObject *object)
+{
+ G_OBJECT_CLASS (mn_theme_engine_parent_class)->finalize (object);
+}
+
+static void
+mn_theme_engine_class_init (MnThemeEngineClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (MnThemeEnginePrivate));
+
+ object_class->get_property = mn_theme_engine_get_property;
+ object_class->set_property = mn_theme_engine_set_property;
+ object_class->dispose = mn_theme_engine_dispose;
+ object_class->finalize = mn_theme_engine_finalize;
+}
+
+static void
+mn_theme_engine_init (MnThemeEngine *self)
+{
+ self->priv = THEME_ENGINE_PRIVATE (self);
+}
+
+gboolean
+mn_theme_engine_paint_widget (MnThemeEngine *engine,
+ MnWidget *widget,
+ cairo_t *cr)
+{
+ MnThemeEngineClass *klass = MN_THEME_ENGINE_GET_CLASS (engine);
+
+ if (klass->paint_widget)
+ return klass->paint_widget (engine, widget, cr);
+ else
+ g_warning ("Theme Engine of type '%s' does not implement the"
+ " required MnThemeEngine::%s virtual function.",
+ G_OBJECT_TYPE_NAME (engine), "paint_widget");
+
+ return FALSE;
+}
+
diff --git a/monet/mn-theme-engine.h b/monet/mn-theme-engine.h
new file mode 100644
index 0000000..a90329a
--- /dev/null
+++ b/monet/mn-theme-engine.h
@@ -0,0 +1,64 @@
+/* mn-theme-engine.h */
+
+#ifndef _MN_THEME_ENGINE_H
+#define _MN_THEME_ENGINE_H
+
+#include <glib-object.h>
+#include "mn-widget.h"
+#include <cairo.h>
+
+G_BEGIN_DECLS
+
+#define MN_TYPE_THEME_ENGINE mn_theme_engine_get_type()
+
+#define MN_THEME_ENGINE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ MN_TYPE_THEME_ENGINE, MnThemeEngine))
+
+#define MN_THEME_ENGINE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ MN_TYPE_THEME_ENGINE, MnThemeEngineClass))
+
+#define MN_IS_THEME_ENGINE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ MN_TYPE_THEME_ENGINE))
+
+#define MN_IS_THEME_ENGINE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ MN_TYPE_THEME_ENGINE))
+
+#define MN_THEME_ENGINE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ MN_TYPE_THEME_ENGINE, MnThemeEngineClass))
+
+typedef struct _MnThemeEngine MnThemeEngine;
+typedef struct _MnThemeEngineClass MnThemeEngineClass;
+typedef struct _MnThemeEnginePrivate MnThemeEnginePrivate;
+
+struct _MnThemeEngine
+{
+ GObject parent;
+
+ MnThemeEnginePrivate *priv;
+};
+
+struct _MnThemeEngineClass
+{
+ GObjectClass parent_class;
+
+ /* vfuncs */
+
+ gboolean (*paint_widget) (MnThemeEngine *engine,
+ MnWidget *widget,
+ cairo_t *cr);
+};
+
+GType mn_theme_engine_get_type (void) G_GNUC_CONST;
+
+gboolean mn_theme_engine_paint_widget (MnThemeEngine *engine,
+ MnWidget *widget,
+ cairo_t *cr);
+
+G_END_DECLS
+
+#endif /* _MN_THEME_ENGINE_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]