[monet] Add MnButton
- From: Thomas Wood <thos src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [monet] Add MnButton
- Date: Sat, 7 Nov 2009 18:39:33 +0000 (UTC)
commit 34071a11c8d5421fc9c3f019c32854188e4277f7
Author: Thomas Wood <thos gnome org>
Date: Sat Nov 7 18:39:19 2009 +0000
Add MnButton
MnButton stores the parameters required for drawing a button.
monet/Makefile.am | 2 +
monet/widgets/mn-button.c | 94 +++++++++++++++++++++++++++++++++++++++++++++
monet/widgets/mn-button.h | 76 ++++++++++++++++++++++++++++++++++++
3 files changed, 172 insertions(+), 0 deletions(-)
---
diff --git a/monet/Makefile.am b/monet/Makefile.am
index 1eeea17..47f2a16 100644
--- a/monet/Makefile.am
+++ b/monet/Makefile.am
@@ -18,6 +18,7 @@ source_h = \
mn-theme-engine.h \
mn-types.h \
mn-widget.h \
+ widgets/mn-button.h \
monet.h
source_h_priv = mn-private.h
@@ -75,6 +76,7 @@ libmonet_la_SOURCES = \
mn-palette.c \
mn-theme-engine.c\
mn-widget.c \
+ widgets/mn-button.c \
monet.c
libmonet_la_LIBADD = $(MONET_LIBS)
diff --git a/monet/widgets/mn-button.c b/monet/widgets/mn-button.c
new file mode 100644
index 0000000..225e852
--- /dev/null
+++ b/monet/widgets/mn-button.c
@@ -0,0 +1,94 @@
+/*
+ * mn-button.c: parameters required for drawing buttons
+ *
+ * Copyright 2009 Intel Corporation
+ *
+ * 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.1 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * Author: Thomas Wood <thos gnome org>
+ */
+
+#include "mn-button.h"
+
+G_DEFINE_TYPE (MnButton, mn_button, MN_TYPE_WIDGET)
+
+#define BUTTON_PRIVATE(o) \
+ (G_TYPE_INSTANCE_GET_PRIVATE ((o), MN_TYPE_BUTTON, MnButtonPrivate))
+
+struct _MnButtonPrivate
+{
+ gboolean has_default;
+};
+
+enum
+{
+ PROP_HAS_DEFAULT
+};
+
+static void
+mn_button_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
+{
+ MnButtonPrivate *priv = MN_BUTTON (object)->priv;
+
+ switch (property_id)
+ {
+ case PROP_HAS_DEFAULT:
+ g_value_set_boolean (value, priv->has_default);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ }
+}
+
+static void
+mn_button_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
+{
+ MnButtonPrivate *priv = MN_BUTTON (object)->priv;
+
+ switch (property_id)
+ {
+ case PROP_HAS_DEFAULT:
+ priv->has_default = g_value_get_boolean (value);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ }
+}
+
+static void
+mn_button_class_init (MnButtonClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (MnButtonPrivate));
+
+ object_class->get_property = mn_button_get_property;
+ object_class->set_property = mn_button_set_property;
+}
+
+static void
+mn_button_init (MnButton *self)
+{
+ self->priv = BUTTON_PRIVATE (self);
+}
+
+MnButton *
+mn_button_new (void)
+{
+ return g_object_new (MN_TYPE_BUTTON, NULL);
+}
diff --git a/monet/widgets/mn-button.h b/monet/widgets/mn-button.h
new file mode 100644
index 0000000..e837528
--- /dev/null
+++ b/monet/widgets/mn-button.h
@@ -0,0 +1,76 @@
+/*
+ * mn-button.h: parameters required for drawing buttons
+ *
+ * Copyright 2009 Intel Corporation
+ *
+ * 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.1 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * Author: Thomas Wood <thos gnome org>
+ */
+
+#ifndef _MN_BUTTON_H
+#define _MN_BUTTON_H
+
+#include <glib-object.h>
+#include <monet/mn-widget.h>
+
+G_BEGIN_DECLS
+
+#define MN_TYPE_BUTTON mn_button_get_type()
+
+#define MN_BUTTON(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ MN_TYPE_BUTTON, MnButton))
+
+#define MN_BUTTON_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ MN_TYPE_BUTTON, MnButtonClass))
+
+#define MN_IS_BUTTON(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ MN_TYPE_BUTTON))
+
+#define MN_IS_BUTTON_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ MN_TYPE_BUTTON))
+
+#define MN_BUTTON_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ MN_TYPE_BUTTON, MnButtonClass))
+
+typedef struct _MnButton MnButton;
+typedef struct _MnButtonClass MnButtonClass;
+typedef struct _MnButtonPrivate MnButtonPrivate;
+
+struct _MnButton
+{
+ MnWidget parent;
+
+ MnButtonPrivate *priv;
+};
+
+struct _MnButtonClass
+{
+ MnWidgetClass parent_class;
+};
+
+GType mn_button_get_type (void) G_GNUC_CONST;
+
+MnButton *mn_button_new (void);
+
+G_END_DECLS
+
+#endif /* _MN_BUTTON_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]