[clutter/wip/actor-content: 14/33] actor: Make Actor instantiatable



commit 185aa0e785e865c0b53e5c04aa006e4e3400d1d5
Author: Emmanuele Bassi <ebassi linux intel com>
Date:   Thu Dec 2 14:47:45 2010 +0000

    actor: Make Actor instantiatable
    
    ClutterActor does not need to be abstract, as all its internals either
    have a default implementation or expose enough hooks to be implemented
    through composition.

 clutter/clutter-actor.c |   61 ++++++++++++++++++++++++++++++++++++++++-------
 clutter/clutter-actor.h |    2 +
 2 files changed, 54 insertions(+), 9 deletions(-)
---
diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c
index 47df665..be57e00 100644
--- a/clutter/clutter-actor.c
+++ b/clutter/clutter-actor.c
@@ -698,15 +698,15 @@ static ClutterPaintVolume *_clutter_actor_get_paint_volume_mutable (ClutterActor
 
 static GQuark quark_shader_data = 0;
 
-G_DEFINE_ABSTRACT_TYPE_WITH_CODE (ClutterActor,
-                                  clutter_actor,
-                                  G_TYPE_INITIALLY_UNOWNED,
-                                  G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_SCRIPTABLE,
-                                                         clutter_scriptable_iface_init)
-                                  G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_ANIMATABLE,
-                                                         clutter_animatable_iface_init)
-                                  G_IMPLEMENT_INTERFACE (ATK_TYPE_IMPLEMENTOR,
-                                                         atk_implementor_iface_init));
+G_DEFINE_TYPE_WITH_CODE (ClutterActor,
+                         clutter_actor,
+                         G_TYPE_INITIALLY_UNOWNED,
+                         G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_SCRIPTABLE,
+                                                clutter_scriptable_iface_init)
+                         G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_ANIMATABLE,
+                                                clutter_animatable_iface_init)
+                         G_IMPLEMENT_INTERFACE (ATK_TYPE_IMPLEMENTOR,
+                                                atk_implementor_iface_init));
 
 G_CONST_RETURN gchar *
 _clutter_actor_get_debug_name (ClutterActor *actor)
@@ -12553,6 +12553,38 @@ _clutter_actor_traverse (ClutterActor              *actor,
                                    user_data);
 }
 
+/**
+ * clutter_actor_new:
+ *
+ * Creates a new #ClutterActor instance.
+ *
+ * An actor created this way will not have any implicit size, nor
+ * will paint anything.
+ *
+ * Return value: the newly created #ClutterActor instance
+ *
+ * Since: 1.6
+ */
+ClutterActor *
+clutter_actor_new (void)
+{
+  return g_object_new (CLUTTER_TYPE_ACTOR, NULL);
+}
+
+/**
+ * clutter_actor_set_content:
+ * @self: a #ClutterActor
+ * @content: a #ClutterContent
+ *
+ * Sets @content to be the painted content of a #ClutterActor.
+ *
+ * The actor will take a reference on @content.
+ *
+ * If the actor already has an existing content, it will release
+ * the reference it holds on it.
+ *
+ * Since: 1.6
+ */
 void
 clutter_actor_set_content (ClutterActor   *self,
                            ClutterContent *content)
@@ -12583,6 +12615,17 @@ clutter_actor_set_content (ClutterActor   *self,
   g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_CONTENT]);
 }
 
+/**
+ * clutter_actor_get_content:
+ * @self: a #ClutterActor
+ *
+ * Retrieves a pointer to the #ClutterContent set using
+ * clutter_actor_set_content().
+ *
+ * Return value: (transfer none): a #ClutterContent, or %NULL
+ *
+ * Since: 1.6
+ */
 ClutterContent *
 clutter_actor_get_content (ClutterActor *self)
 {
diff --git a/clutter/clutter-actor.h b/clutter/clutter-actor.h
index f8de547..1315bf9 100644
--- a/clutter/clutter-actor.h
+++ b/clutter/clutter-actor.h
@@ -327,6 +327,8 @@ struct _ClutterActorClass
 
 GType                 clutter_actor_get_type                  (void) G_GNUC_CONST;
 
+ClutterActor *        clutter_actor_new                       (void);
+
 void                  clutter_actor_set_flags                 (ClutterActor          *self,
                                                                ClutterActorFlags      flags);
 void                  clutter_actor_unset_flags               (ClutterActor          *self,



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