[glide] Begin adding a shape actor



commit e4960c41e83002818f23ad5e3bee8c5a7e0546ce
Author: Robert Carr <racarr Valentine localdomain>
Date:   Thu May 6 06:44:42 2010 -0400

    Begin adding a shape actor

 libglide/Makefile.am                          |    4 +-
 libglide/glide-rectangle.h                    |   57 ------------------------
 libglide/glide-shape-priv.h                   |   34 ++++++++++++++
 libglide/{glide-rectangle.c => glide-shape.c} |   30 +++++++-----
 libglide/glide-shape.h                        |   59 +++++++++++++++++++++++++
 5 files changed, 112 insertions(+), 72 deletions(-)
---
diff --git a/libglide/Makefile.am b/libglide/Makefile.am
index c32e4f4..ac0654c 100644
--- a/libglide/Makefile.am
+++ b/libglide/Makefile.am
@@ -47,7 +47,7 @@ glideheaders_HEADERS = \
 	glide-text.h \
 	glide-image.h \
 	glide-stage-manager.h \
-	glide-rectangle.h \
+	glide-shape.h \
 	glide-actor.h \
 	glide-manipulator.h \
 	glide-window.h \
@@ -62,7 +62,7 @@ libglide_la_SOURCES = \
 	glide-window.c \
 	glide-manipulator.c \
 	glide-actor.c \
-	glide-rectangle.c \
+	glide-shape.c \
 	glide-stage-manager.c \
 	glide-image.c \
 	glide-text.c \
diff --git a/libglide/glide-shape-priv.h b/libglide/glide-shape-priv.h
new file mode 100644
index 0000000..6171daa
--- /dev/null
+++ b/libglide/glide-shape-priv.h
@@ -0,0 +1,34 @@
+/*
+ * glide-shape-priv.h
+ * Copyright (C) Robert Carr 2010 <racarr gnome org>
+ * 
+ * Glide is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * 
+ * Glide 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 General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License along
+ * with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+ 
+#ifndef __GLIDE_SHAPE_PRIVATE_H__
+#define __GLIDE_SHAPE_PRIVATE_H__
+
+#include "glide-shape.h"
+
+G_BEGIN_DECLS
+
+struct _GlideShapePrivate
+{
+  gpointer fillter;
+};
+
+G_END_DECLS
+
+#endif  /* __GLIDE_SHAPE_PRIVATE_H__  */
diff --git a/libglide/glide-rectangle.c b/libglide/glide-shape.c
similarity index 70%
rename from libglide/glide-rectangle.c
rename to libglide/glide-shape.c
index 4f46da1..2bac2c7 100644
--- a/libglide/glide-rectangle.c
+++ b/libglide/glide-shape.c
@@ -1,5 +1,5 @@
 /*
- * glide-rectangle.c
+ * glide-shape.c
  * Copyright (C) Robert Carr 2010 <racarr gnome org>
  * 
  * Glide is free software: you can redistribute it and/or modify it
@@ -17,12 +17,15 @@
  */
 
 
-#include "glide-rectangle.h"
+#include "glide-shape.h"
+#include "glide-shape-priv.h"
 
-G_DEFINE_TYPE (GlideRectangle, glide_rectangle, GLIDE_TYPE_ACTOR);
+#define GLIDE_SHAPE_GET_PRIVATE(obj)   (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GLIDE_TYPE_SHAPE, GlideShapePrivate))
+
+G_DEFINE_TYPE (GlideShape, glide_shape, GLIDE_TYPE_ACTOR);
 
 static void
-glide_rectangle_paint (ClutterActor *self)
+glide_shape_paint (ClutterActor *self)
 {
   ClutterGeometry          geom;
 
@@ -59,7 +62,7 @@ glide_rectangle_paint (ClutterActor *self)
 }
 
 static gboolean
-glide_rectangle_button_press (ClutterActor *actor,
+glide_shape_button_press (ClutterActor *actor,
 			      ClutterButtonEvent *event)
 {
   GlideStageManager *m;
@@ -75,24 +78,25 @@ glide_rectangle_button_press (ClutterActor *actor,
 }
 
 static void
-glide_rectangle_class_init (GlideRectangleClass *klass)
+glide_shape_class_init (GlideShapeClass *klass)
 {
   ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
   
-  actor_class->paint = glide_rectangle_paint;
-  actor_class->button_press_event = glide_rectangle_button_press;
+  g_type_class_add_private (klass, sizeof (GlideShapePrivate));
+  
+  actor_class->paint = glide_shape_paint;
+  actor_class->button_press_event = glide_shape_button_press;
 }
 
 static void
-glide_rectangle_init (GlideRectangle *self)
+glide_shape_init (GlideShape *self)
 {
+  self->priv = GLIDE_SHAPE_GET_PRIVATE (self);
 }
 
 ClutterActor*
-glide_rectangle_new (GlideStageManager *m)
+glide_shape_new ()
 {
-  return g_object_new (GLIDE_TYPE_RECTANGLE, 
-		       "stage-manager", m,
-		       NULL);
+  return g_object_new (GLIDE_TYPE_SHAPE, NULL);
 }
 
diff --git a/libglide/glide-shape.h b/libglide/glide-shape.h
new file mode 100644
index 0000000..5936a00
--- /dev/null
+++ b/libglide/glide-shape.h
@@ -0,0 +1,59 @@
+/*
+ * glide-shape.h
+ * Copyright (C) Robert Carr 2010 <racarr gnome org>
+ * 
+ * Glide is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * 
+ * Glide 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 General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License along
+ * with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef __GLIDE_SHAPE_H__
+#define __GLIDE_SHAPE_H__
+
+#include <glib-object.h>
+#include <clutter/clutter.h>
+#include "glide-actor.h"
+
+
+G_BEGIN_DECLS
+
+#define GLIDE_TYPE_SHAPE                  (glide_shape_get_type())
+#define GLIDE_SHAPE(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GLIDE_TYPE_SHAPE, GlideShape))
+#define GLIDE_SHAPE_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), GLIDE_TYPE_SHAPE, GlideShapeClass))
+#define GLIDE_IS_SHAPE(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLIDE_TYPE_SHAPE))
+#define GLIDE_IS_SHAPE_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), GLIDE_TYPE_SHAPE))
+#define GLIDE_SHAPE_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), GLIDE_TYPE_SHAPE, GlideShapeClass))
+
+typedef struct _GlideShape        GlideShape;
+typedef struct _GlideShapePrivate GlideShapePrivate;
+typedef struct _GlideShapeClass   GlideShapeClass;
+
+struct _GlideShape
+{
+  GlideActor           parent;
+  
+  GlideShapePrivate *priv;
+}; 
+
+struct _GlideShapeClass 
+{
+  /*< private >*/
+  GlideActorClass parent_class;
+};
+
+GType glide_shape_get_type (void) G_GNUC_CONST;
+ClutterActor *glide_shape_new              ();
+
+G_END_DECLS
+
+#endif /* __CLUTTER_SHAPE_H__ */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]