+2006-12-12 Emmanuele Bassi <ebassi@openedhand.com>
+
+ Rework part of the show/hide machinery. Allow groups sub-classes
+ and composite actors to override show_all/hide_all in order to
+ decide which children they wish to show/hide. This means that
+ if an actor overrides the default show/hide virtual methods, it'll
+ have to chain up to the parent class show/hide. While we're at it,
+ provide the fully recursive clutter_actor_show_all() and
+ clutter_actor_hide_all() methods.
+
+ * clutter/clutter-behaviour-path.c: Add apidoc for the ClutterKnot
+ functions; add pathological equality case for clutter_knot_equal().
+
+ * clutter/clutter-event.h:
+ * clutter/clutter-feature.h:
+ * clutter/clutter-behaviour.c:
+ * clutter/clutter-behaviour-scale.c:Fix parameters name so that
+ gtk-doc doesn't complain.
+
+ * clutter/clutter-actor.c:
+ * clutter/clutter-event.c: Add apidoc
+
+ * clutter/clutter-actor.h:
+ * clutter/clutter-actor.c: Add a clutter_actor_show_all() and a
+ clutter_actor_hide_all() functions; provide a mechanism for
+ groups and composited actors to programmatically select what to
+ show/hide when clutter_actor_show_all() and clutter_actor_hide_all()
+ are called. If you are overriding the ClutterActor::show or
+ the ClutterActor::hide virtual methods you should chain up with
+ the parent class.
+
+ * clutter/clutter-group.c: Override show_all and hide_all and
+ recursively show/hide every child inside the group;
+ clutter_group_show_all() and clutter_group_hide_all() remain as non
+ recursive versions of clutter_actor_show_all() and
+ clutter_actor_hide_all() (maybe we should rename them in order
+ to avoid name clashes with the bindings).
+
+ * clutter/clutter-stage.c:
+ * clutter/clutter-texture.c: Chain up with parent class show
+ and hide vfuncs.
+
+ * clutter/clutter-clone-texture.h:
+ * clutter/clutter-clone-texture.c: Provide API for changing the
+ parent texture of a clone texture actor.
+
+ * examples/behave.c:
+ * examples/super-oh.c:
+ * examples/test.c: Use clutter_actor_show_all() instead of
+ clutter_group_show_all().
+
2006-12-08 Matthew Allum <mallum@openedhand.com>
* clutter.doap:
return FALSE;
}
+static void
+clutter_actor_real_show (ClutterActor *self)
+{
+ if (!CLUTTER_ACTOR_IS_VISIBLE (self))
+ {
+ if (!CLUTTER_ACTOR_IS_REALIZED (self))
+ clutter_actor_realize (self);
+
+ CLUTTER_ACTOR_SET_FLAGS (self, CLUTTER_ACTOR_MAPPED);
+
+ if (CLUTTER_ACTOR_IS_VISIBLE (self))
+ clutter_actor_queue_redraw (self);
+ }
+}
+
/**
* clutter_actor_show
* @self: A #ClutterActor
{
if (!CLUTTER_ACTOR_IS_VISIBLE (self))
{
- ClutterActorClass *klass;
-
g_object_ref (self);
- if (!CLUTTER_ACTOR_IS_REALIZED (self))
- clutter_actor_realize(self);
+ g_signal_emit (self, actor_signals[SHOW], 0);
+ g_object_notify (G_OBJECT (self), "visible");
- CLUTTER_ACTOR_SET_FLAGS (self, CLUTTER_ACTOR_MAPPED);
+ g_object_unref (self);
+ }
+}
- klass = CLUTTER_ACTOR_GET_CLASS (self);
- if (klass->show)
- (klass->show) (self);
+/**
+ * clutter_actor_show_all:
+ * @self: a #ClutterActor
+ *
+ * Recursively show an actor, and any child actor if @self is a
+ * #ClutterGroup.
+ *
+ * Since: 0.2
+ */
+void
+clutter_actor_show_all (ClutterActor *self)
+{
+ ClutterActorClass *klass;
- if (CLUTTER_ACTOR_IS_VISIBLE (self))
- clutter_actor_queue_redraw (self);
+ g_return_if_fail (CLUTTER_IS_ACTOR (self));
- g_signal_emit (self, actor_signals[SHOW], 0);
- g_object_notify (G_OBJECT (self), "visible");
+ klass = CLUTTER_ACTOR_GET_CLASS (self);
+ if (klass->show_all)
+ klass->show_all (self);
+}
- g_object_unref (self);
+void
+clutter_actor_real_hide (ClutterActor *self)
+{
+ if (CLUTTER_ACTOR_IS_VISIBLE (self))
+ {
+ CLUTTER_ACTOR_UNSET_FLAGS (self, CLUTTER_ACTOR_MAPPED);
+ clutter_actor_queue_redraw (self);
}
}
{
if (CLUTTER_ACTOR_IS_VISIBLE (self))
{
- ClutterActorClass *klass;
-
g_object_ref (self);
- CLUTTER_ACTOR_UNSET_FLAGS (self, CLUTTER_ACTOR_MAPPED);
-
- klass = CLUTTER_ACTOR_GET_CLASS (self);
- if (klass->hide)
- (klass->hide) (self);
-
- clutter_actor_queue_redraw (self);
-
g_signal_emit (self, actor_signals[HIDE], 0);
g_object_notify (G_OBJECT (self), "visible");
}
/**
+ * clutter_actor_hide_all:
+ * @self: a #ClutterActor
+ *
+ * Recursively hides an actor, and any child actor if @self
+ * is a #ClutterGroup.
+ *
+ * Since: 0.2
+ */
+void
+clutter_actor_hide_all (ClutterActor *self)
+{
+ ClutterActorClass *klass;
+
+ g_return_if_fail (CLUTTER_IS_ACTOR (self));
+
+ klass = CLUTTER_ACTOR_GET_CLASS (self);
+ if (klass->hide_all)
+ klass->hide_all (self);
+}
+
+/**
* clutter_actor_realize
* @self: A #ClutterActor
*
clutter_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
CLUTTER_TYPE_ACTOR);
+
+ klass->show = clutter_actor_real_show;
+ klass->show_all = clutter_actor_show;
+ klass->hide = clutter_actor_real_hide;
+ klass->hide_all = clutter_actor_hide;
}
static void
clutter_actor_init (ClutterActor *self)
{
- gboolean was_floating;
-
- /* sink the GInitiallyUnowned floating flag */
- was_floating = g_object_is_floating (G_OBJECT (self));
- if (was_floating)
- g_object_force_floating (G_OBJECT (self));
-
self->priv = CLUTTER_ACTOR_GET_PRIVATE (self);
self->priv->parent_actor = NULL;
}
/*
- * clutter_actor_get_size
+ * clutter_actor_get_size:
* @self: A #ClutterActor
* @width: Location to store width if non NULL.
* @height: Location to store height if non NULL.
}
/**
- * clutter_actor_get_abs_size
+ * clutter_actor_get_abs_size:
* @self: A #ClutterActor
- * @x: Location to store width if non NULL.
- * @y: Location to store height if non NULL.
+ * @width: Location to store width if non NULL.
+ * @height: Location to store height if non NULL.
*
* Gets the absolute size of an actor taking into account
* an scaling factors
}
/**
- * clutter_actor_get_scalex
+ * clutter_actor_get_scalex:
* @self: A #ClutterActor
* @scale_x: FIXME
* @scale_y: FIXME
*
* FIXME
+ *
+ * Since: 0.2
*/
void
clutter_actor_get_scalex (ClutterActor *self,
}
/**
- * clutter_actor_get_scale
+ * clutter_actor_get_scale:
* @self: A #ClutterActor
* @scale_x: FIXME
* @scale_y: FIXME
*
* FIXME
+ *
+ * Since: 0.2
*/
void
clutter_actor_get_scale (ClutterActor *self,
clutter_actor_set_depth (ClutterActor *self,
gint depth)
{
+ ClutterActorPrivate *priv;
+
+ g_return_if_fail (CLUTTER_IS_ACTOR (self));
+
+ priv = self->priv;
+
/* Sets Z value. - FIXME: should invert ?*/
- self->priv->z = depth;
+ priv->z = depth;
- if (self->priv->parent_actor)
+ if (priv->parent_actor)
{
/* We need to resort the group stacking order as to
* correctly render alpha values.
* FIXME: This is sub optimal. maybe queue the the sort
* before stacking
*/
- clutter_group_sort_depth_order
- (CLUTTER_GROUP(self->priv->parent_actor));
+ clutter_group_sort_depth_order (CLUTTER_GROUP (priv->parent_actor));
}
}
#define CLUTTER_ACTOR_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_ACTOR, ClutterActorClass))
-#define CLUTTER_ACTOR_SET_FLAGS(e,f) ((e)->flags |= (f))
-#define CLUTTER_ACTOR_UNSET_FLAGS(e,f) ((e)->flags &= ~(f))
+#define CLUTTER_ACTOR_SET_FLAGS(e,f) ((e)->flags |= (f))
+#define CLUTTER_ACTOR_UNSET_FLAGS(e,f) ((e)->flags &= ~(f))
-#define CLUTTER_ACTOR_IS_MAPPED(e) ((e)->flags & CLUTTER_ACTOR_MAPPED)
-#define CLUTTER_ACTOR_IS_REALIZED(e) ((e)->flags & CLUTTER_ACTOR_REALIZED)
-#define CLUTTER_ACTOR_IS_VISIBLE(e) \
- (CLUTTER_ACTOR_IS_MAPPED(e) && CLUTTER_ACTOR_IS_REALIZED(e))
+#define CLUTTER_ACTOR_IS_MAPPED(e) ((e)->flags & CLUTTER_ACTOR_MAPPED)
+#define CLUTTER_ACTOR_IS_REALIZED(e) ((e)->flags & CLUTTER_ACTOR_REALIZED)
+#define CLUTTER_ACTOR_IS_VISIBLE(e) (CLUTTER_ACTOR_IS_MAPPED (e) && \
+ CLUTTER_ACTOR_IS_REALIZED (e))
typedef struct _ClutterActor ClutterActor;
typedef struct _ClutterActorClass ClutterActorClass;
typedef struct _ClutterActorBox ClutterActorBox;
typedef struct _ClutterActorPrivate ClutterActorPrivate;
-typedef struct _ClutterGeometry ClutterGeometry;
+typedef struct _ClutterGeometry ClutterGeometry;
typedef void (*ClutterCallback) (ClutterActor *actor, gpointer data);
#define CLUTTER_CALLBACK(f) ((ClutterCallback) (f))
GObjectClass parent_class;
void (* show) (ClutterActor *actor);
+ void (* show_all) (ClutterActor *actor);
void (* hide) (ClutterActor *actor);
+ void (* hide_all) (ClutterActor *actor);
void (* realize) (ClutterActor *actor);
void (* unrealize) (ClutterActor *actor);
void (* paint) (ClutterActor *actor);
void (* destroy) (ClutterActor *actor);
/* to go ? */
- void (* show_all) (ClutterActor *actor);
- void (* hide_all) (ClutterActor *actor);
void (* queue_redraw) (ClutterActor *actor);
/* padding for future expansion */
GType clutter_actor_get_type (void) G_GNUC_CONST;
void clutter_actor_show (ClutterActor *self);
+void clutter_actor_show_all (ClutterActor *self);
void clutter_actor_hide (ClutterActor *self);
+void clutter_actor_hide_all (ClutterActor *self);
void clutter_actor_realize (ClutterActor *self);
void clutter_actor_unrealize (ClutterActor *self);
void clutter_actor_paint (ClutterActor *self);
#include <math.h>
+/**
+ * clutter_knot_copy:
+ * @knot: a #ClutterKnot
+ *
+ * Makes an allocated copy of a knot.
+ *
+ * Return value: the copied knot.
+ *
+ * Since: 0.2
+ */
ClutterKnot *
clutter_knot_copy (const ClutterKnot *knot)
{
return copy;
}
+/**
+ * clutter_knot_free:
+ * @knot: a #ClutterKnot
+ *
+ * Frees the memory of an allocated knot.
+ *
+ * Since: 0.2
+ */
void
clutter_knot_free (ClutterKnot *knot)
{
}
}
+/**
+ * clutter_knot_equal:
+ * @knot_a: First knot
+ * @knot_b: Second knot
+ *
+ * Compares to knot and checks if the point to the same location.
+ *
+ * Return value: %TRUE if the knots point to the same location.
+ *
+ * Since: 0.2
+ */
gboolean
clutter_knot_equal (const ClutterKnot *knot_a,
const ClutterKnot *knot_b)
g_return_val_if_fail (knot_a != NULL, FALSE);
g_return_val_if_fail (knot_b != NULL, FALSE);
+ if (knot_a == knot_b)
+ return TRUE;
+
return knot_a->x == knot_b->x && knot_a->y == knot_b->y;
}
* @alpha: a #ClutterAlpha
* @scale_begin: initial scale factor
* @scale_end: final scale factor
+ * @gravity: FIXME
*
* A fixed point implementation of clutter_behaviour_scale_new()
*
/**
* clutter_behaviour_get_actors:
- * @behaviour: a #ClutterBehaviour
+ * @behave: a #ClutterBehaviour
*
- * Retrieves all the actors to which @behaviour applies.
+ * Retrieves all the actors to which @behave applies.
*
* Return value: a list of actors. You should free the returned list
* with g_slist_free() when finished using it.
* Since: 0.2
*/
GSList *
-clutter_behaviour_get_actors (ClutterBehaviour *behaviour)
+clutter_behaviour_get_actors (ClutterBehaviour *behave)
{
GSList *retval, *l;
- g_return_val_if_fail (CLUTTER_BEHAVIOUR (behaviour), NULL);
+ g_return_val_if_fail (CLUTTER_BEHAVIOUR (behave), NULL);
retval = NULL;
- for (l = behaviour->priv->actors; l != NULL; l = l->next)
+ for (l = behave->priv->actors; l != NULL; l = l->next)
retval = g_slist_prepend (retval, l->data);
return g_slist_reverse (retval);
#include "clutter-clone-texture.h"
#include "clutter-main.h"
#include "clutter-feature.h"
+#include "clutter-actor.h"
#include "clutter-util.h"
#include "clutter-enum-types.h"
#include "clutter-private.h"
clutter_texture_get_n_tiles (priv->parent_texture, &n_x_tiles, &n_y_tiles);
- for (x=0; x < n_x_tiles; x++)
+ for (x = 0; x < n_x_tiles; x++)
{
lasty = 0;
- for (y=0; y < n_y_tiles; y++)
+ for (y = 0; y < n_y_tiles; y++)
{
gint actual_w, actual_h;
gint xpos, ypos, xsize, ysize, ywaste, xwaste;
priv = CLUTTER_CLONE_TEXTURE (self)->priv;
+ /* no need to paint stuff if we don't have a texture to clone */
+ if (!priv->parent_texture)
+ return;
/* parent texture may have been hidden, there for need to make sure its
* realised with resources available.
/* FIXME: figure out nicer way of getting at this info...
*/
- if (clutter_feature_available (CLUTTER_FEATURE_TEXTURE_RECTANGLE)
- && clutter_texture_is_tiled (CLUTTER_TEXTURE(parent_texture)) == FALSE)
+ if (clutter_feature_available (CLUTTER_FEATURE_TEXTURE_RECTANGLE) &&
+ clutter_texture_is_tiled (CLUTTER_TEXTURE (parent_texture)) == FALSE)
target_type = GL_TEXTURE_RECTANGLE_ARB;
else
target_type = GL_TEXTURE_2D;
- glEnable(GL_BLEND);
- glEnable(target_type);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable (GL_BLEND);
+ glEnable (target_type);
+ glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glColor4ub(255, 255, 255, clutter_actor_get_opacity(self));
+ glColor4ub (255, 255, 255, clutter_actor_get_opacity (self));
clutter_actor_get_coords (self, &x1, &y1, &x2, &y2);
clutter_actor_get_opacity (self));
/* Parent paint translated us into position */
- clone_texture_render_to_gl_quad (CLUTTER_CLONE_TEXTURE(self),
+ clone_texture_render_to_gl_quad (CLUTTER_CLONE_TEXTURE (self),
0, 0, x2 - x1, y2 - y1);
- glDisable(target_type);
- glDisable(GL_BLEND);
+ glDisable (target_type);
+ glDisable (GL_BLEND);
}
static void
ClutterTexture *texture)
{
ClutterCloneTexturePrivate *priv = ctexture->priv;
+ ClutterActor *actor = CLUTTER_ACTOR (ctexture);
if (priv->parent_texture)
{
priv->parent_texture = NULL;
}
+ clutter_actor_hide (actor);
+
if (texture)
{
gint width, height;
priv->parent_texture = g_object_ref (texture);
- /* Sync up the size to parent texture base pixbuf size.
- */
+ /* Sync up the size to parent texture base pixbuf size. */
clutter_texture_get_base_size (texture, &width, &height);
- clutter_actor_set_size (CLUTTER_ACTOR(ctexture), width, height);
+ clutter_actor_set_size (actor, width, height);
+
+ /* queue a redraw if the cloned texture is already visible */
+ if (CLUTTER_ACTOR_IS_VISIBLE (CLUTTER_ACTOR (priv->parent_texture)) &&
+ CLUTTER_ACTOR_IS_VISIBLE (actor))
+ clutter_actor_queue_redraw (actor);
}
}
static void
clutter_clone_texture_class_init (ClutterCloneTextureClass *klass)
{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
- actor_class->paint = clutter_clone_texture_paint;
+ actor_class->paint = clutter_clone_texture_paint;
gobject_class->finalize = clutter_clone_texture_finalize;
gobject_class->dispose = clutter_clone_texture_dispose;
"Parent Texture",
"The parent texture to clone",
CLUTTER_TYPE_TEXTURE,
- (G_PARAM_CONSTRUCT_ONLY | CLUTTER_PARAM_READWRITE)));
+ (G_PARAM_CONSTRUCT | CLUTTER_PARAM_READWRITE)));
g_type_class_add_private (gobject_class, sizeof (ClutterCloneTexturePrivate));
}
/**
* clutter_clone_texture_new:
- * @texture: a #ClutterTexture
+ * @texture: a #ClutterTexture or %NULL
*
* Creates an efficient 'clone' of a pre-existing texture if which it
- * shares the underlying pixbuf data.
+ * shares the underlying pixbuf data.
+ *
+ * You can use clutter_clone_texture_set_parent_texture() to change the
+ * parent texture to be cloned.
*
* Return value: the newly created #ClutterCloneTexture
*/
ClutterActor *
clutter_clone_texture_new (ClutterTexture *texture)
{
- g_return_val_if_fail (CLUTTER_IS_TEXTURE (texture), NULL);
+ g_return_val_if_fail (texture == NULL || CLUTTER_IS_TEXTURE (texture), NULL);
return g_object_new (CLUTTER_TYPE_CLONE_TEXTURE,
"parent-texture", texture,
NULL);
}
+
+/**
+ * clutter_clone_texture_get_parent_texture:
+ * @clone: a #ClutterCloneTexture
+ *
+ * Retrieves the parent #ClutterTexture used by @clone.
+ *
+ * Return value: a #ClutterTexture actor, or %NULL
+ *
+ * Since: 0.2
+ */
+ClutterTexture *
+clutter_clone_texture_get_parent_texture (ClutterCloneTexture *clone)
+{
+ g_return_val_if_fail (CLUTTER_IS_CLONE_TEXTURE (clone), NULL);
+
+ return clone->priv->parent_texture;
+}
+
+/**
+ * clutter_clone_texture_set_parent_texture:
+ * @clone: a #ClutterCloneTexture
+ * @texture a #ClutterTexture or %NULL
+ *
+ * Sets the parent texture cloned by the #ClutterCloneTexture.
+ *
+ * Since: 0.2
+ */
+void
+clutter_clone_texture_set_parent_texture (ClutterCloneTexture *clone,
+ ClutterTexture *texture)
+{
+ g_return_if_fail (CLUTTER_IS_CLONE_TEXTURE (clone));
+ g_return_if_fail (texture == NULL || CLUTTER_IS_TEXTURE (texture));
+
+ g_object_ref (clone);
+
+ set_parent_texture (clone, texture);
+
+ g_object_notify (G_OBJECT (clone), "parent-texture");
+ g_object_unref (clone);
+}
#ifndef _HAVE_CLUTTER_CLONE_TEXTURE_H
#define _HAVE_CLUTTER_CLONE_TEXTURE_H
-#include <glib-object.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <clutter/clutter-actor.h>
#include <clutter/clutter-texture.h>
G_BEGIN_DECLS
void (*_clutter_clone_4) (void);
};
-GType clutter_clone_texture_get_type (void);
-ClutterActor *clutter_clone_texture_new (ClutterTexture *texture);
+GType clutter_clone_texture_get_type (void) G_GNUC_CONST;
+
+ClutterActor * clutter_clone_texture_new (ClutterTexture *texture);
+ClutterTexture *clutter_clone_texture_get_parent_texture (ClutterCloneTexture *clone);
+void clutter_clone_texture_set_parent_texture (ClutterCloneTexture *clone,
+ ClutterTexture *texture);
G_END_DECLS
* Boston, MA 02111-1307, USA.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "clutter-event.h"
#include <X11/Xlib.h>
#include <X11/Xatom.h>
+/**
+ * clutter_event_type:
+ * @event: a #ClutterEvent
+ *
+ * Retrieves the type of the event.
+ *
+ * Return value: a #ClutterEventType
+ */
ClutterEventType
clutter_event_type (ClutterEvent *event)
{
return event->type;
}
+/**
+ * clutter_button_event_time:
+ * @buttev: a #ClutterButtonEvent
+ *
+ * Retrieves the time of the event.
+ *
+ * Return value: the time of the event.
+ */
guint32
clutter_button_event_time (ClutterButtonEvent *buttev)
{
return buttev->time;
}
+/**
+ * clutter_button_event_x:
+ * @buttev: a #ClutterButtonEvent
+ *
+ * Retrieve the x coordinate of the event.
+ *
+ * Return value: the x coordinate.
+ */
gint
clutter_button_event_x (ClutterButtonEvent *buttev)
{
return buttev->x;
}
+/**
+ * clutter_button_event_y:
+ * @buttev: a #ClutterButtonEvent
+ *
+ * Retrieve the y coordinate of the event.
+ *
+ * Return value: the y coordinate
+ */
gint
clutter_button_event_y (ClutterButtonEvent *buttev)
{
GType clutter_event_get_type (void) G_GNUC_CONST;
-ClutterEvent *clutter_event_new (ClutterEventType type);
-ClutterEvent *clutter_event_copy (ClutterEvent *event);
-void clutter_event_free (ClutterEvent *event);
-
-ClutterEventType clutter_key_event_type (ClutterKeyEvent *keyev);
-
-guint32 clutter_key_event_time (ClutterKeyEvent *keyev);
-
-guint clutter_key_event_state (ClutterKeyEvent *keyev);
-
-gint clutter_button_event_x (ClutterButtonEvent *buttev);
-
-gint clutter_button_event_y (ClutterButtonEvent *buttev);
-
-guint clutter_key_event_symbol (ClutterKeyEvent *keyev);
-
-guint16 clutter_key_event_code (ClutterKeyEvent *keyev);
-
+ClutterEvent *clutter_event_new (ClutterEventType type);
+ClutterEvent *clutter_event_copy (ClutterEvent *event);
+void clutter_event_free (ClutterEvent *event);
+ClutterEventType clutter_event_type (ClutterEvent *keyev);
+
+guint32 clutter_key_event_time (ClutterKeyEvent *keyev);
+guint clutter_key_event_state (ClutterKeyEvent *keyev);
+guint clutter_key_event_symbol (ClutterKeyEvent *keyev);
+guint16 clutter_key_event_code (ClutterKeyEvent *keyev);
guint32 clutter_key_event_unicode (ClutterKeyEvent *keyev);
+guint32 clutter_button_event_time (ClutterButtonEvent *buttev);
+gint clutter_button_event_x (ClutterButtonEvent *buttev);
+gint clutter_button_event_y (ClutterButtonEvent *buttev);
+
guint32 clutter_keysym_to_unicode (guint keyval);
G_END_DECLS
#include <GL/glx.h>
#include <GL/gl.h>
-G_END_DECLS
+G_BEGIN_DECLS
typedef enum
{
CLUTTER_FEATURE_SYNC_TO_VBLANK = (1 << 2)
} ClutterFeatureFlags;
-gboolean clutter_feature_available (ClutterFeatureFlags flags);
+gboolean clutter_feature_available (ClutterFeatureFlags feature);
ClutterFeatureFlags clutter_feature_get_all (void);
void clutter_feature_wait_for_vblank (void);
}
static void
+clutter_group_real_show_all (ClutterActor *actor)
+{
+ clutter_group_foreach (CLUTTER_GROUP (actor),
+ CLUTTER_CALLBACK (clutter_actor_show_all),
+ NULL);
+ clutter_actor_show (actor);
+}
+
+static void
+clutter_group_real_hide_all (ClutterActor *actor)
+{
+ clutter_actor_hide (actor);
+ clutter_group_foreach (CLUTTER_GROUP (actor),
+ CLUTTER_CALLBACK (clutter_actor_hide_all),
+ NULL);
+}
+
+static void
clutter_group_class_init (ClutterGroupClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
- actor_class->paint = clutter_group_paint;
- /*
- actor_class->show = clutter_group_show_all;
- actor_class->hide = clutter_group_hide_all;
- */
+ actor_class->paint = clutter_group_paint;
+ actor_class->show_all = clutter_group_real_show_all;
+ actor_class->hide_all = clutter_group_real_hide_all;
actor_class->request_coords = clutter_group_request_coords;
actor_class->allocate_coords = clutter_group_allocate_coords;
/* GObject */
- object_class->finalize = clutter_group_finalize;
- object_class->dispose = clutter_group_dispose;
+ object_class->finalize = clutter_group_finalize;
+ object_class->dispose = clutter_group_dispose;
group_signals[ADD] =
g_signal_new ("add",
* clutter_group_show_all:
* @self: A #ClutterGroup
*
- * Show all child actors of the group. Note, does not recurse.
- **/
+ * Show all child actors of the group.
+ * Note, does not recurse: use clutter_actor_show_all() for
+ * a recursive show.
+ */
void
clutter_group_show_all (ClutterGroup *self)
{
g_return_if_fail (CLUTTER_IS_GROUP (self));
- clutter_actor_show(CLUTTER_ACTOR(self));
+ clutter_actor_show (CLUTTER_ACTOR (self));
g_list_foreach (self->priv->children,
- (GFunc)clutter_actor_show,
+ (GFunc) clutter_actor_show,
NULL);
}
* clutter_group_hide_all:
* @self: A #ClutterGroup
*
- * Hide all child actors of the group. Note, does not recurse.
- **/
+ * Hide all child actors of the group.
+ * Note, does not recurse: use clutter_actor_hide_all() for
+ * a recursive hide.
+ */
void
clutter_group_hide_all (ClutterGroup *self)
{
clutter_actor_hide(CLUTTER_ACTOR(self));
g_list_foreach (self->priv->children,
- (GFunc)clutter_actor_hide,
+ (GFunc) clutter_actor_hide,
NULL);
}
static void
clutter_stage_show (ClutterActor *self)
{
- if (clutter_stage_get_xwindow (CLUTTER_STAGE(self)))
- XMapWindow (clutter_xdisplay(),
- clutter_stage_get_xwindow (CLUTTER_STAGE(self)));
+ ClutterActorClass *parent_class;
+
+ parent_class = CLUTTER_ACTOR_CLASS (clutter_stage_parent_class);
+ if (parent_class->show)
+ parent_class->show (self);
+
+ if (clutter_stage_get_xwindow (CLUTTER_STAGE (self)))
+ XMapWindow (clutter_xdisplay (),
+ clutter_stage_get_xwindow (CLUTTER_STAGE (self)));
}
static void
clutter_stage_hide (ClutterActor *self)
{
- if (clutter_stage_get_xwindow (CLUTTER_STAGE(self)))
- XUnmapWindow (clutter_xdisplay(),
- clutter_stage_get_xwindow (CLUTTER_STAGE(self)));
+ ClutterActorClass *parent_class;
+
+ parent_class = CLUTTER_ACTOR_CLASS (clutter_stage_parent_class);
+ if (parent_class->hide)
+ parent_class->hide (self);
+
+ if (clutter_stage_get_xwindow (CLUTTER_STAGE (self)))
+ XUnmapWindow (clutter_xdisplay (),
+ clutter_stage_get_xwindow (CLUTTER_STAGE (self)));
}
static void
static void
clutter_texture_show (ClutterActor *self)
{
+ ClutterActorClass *parent_class;
+
+ /* chain up parent show */
+ parent_class = CLUTTER_ACTOR_CLASS (clutter_texture_parent_class);
+ if (parent_class->show)
+ parent_class->show (self);
+
clutter_actor_realize (self);
}
static void
clutter_texture_hide (ClutterActor *self)
{
+ ClutterActorClass *parent_class;
+
+ /* chain up parent hide */
+ parent_class = CLUTTER_ACTOR_CLASS (clutter_texture_parent_class);
+ if (parent_class->hide)
+ parent_class->hide (self);
+
clutter_actor_unrealize (self);
}
#ifndef _HAVE_CLUTTER_TEXTURE_H
#define _HAVE_CLUTTER_TEXTURE_H
-#include <glib-object.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
#include <clutter/clutter-actor.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
G_BEGIN_DECLS
{
ClutterActorClass parent_class;
- void (*size_change) (ClutterTexture *texture,
- gint width,
- gint height);
+ void (*size_change) (ClutterTexture *texture,
+ gint width,
+ gint height);
void (*pixbuf_change) (ClutterTexture *texture);
+
+ /* padding, for future expansion */
+ void (*_clutter_texture1) (void);
+ void (*_clutter_texture2) (void);
+ void (*_clutter_texture3) (void);
+ void (*_clutter_texture4) (void);
+ void (*_clutter_texture5) (void);
+ void (*_clutter_texture6) (void);
};
GType clutter_texture_get_type (void) G_GNUC_CONST;
<FILE>clutter-color</FILE>
CLUTTER_TYPE_COLOR
ClutterColor
-clutter_color_get_type
clutter_color_parse
clutter_color_add
clutter_color_subtract
clutter_color_from_hls
clutter_color_to_pixel
clutter_color_from_pixel
+<SUBSECTION Private>
+clutter_color_get_type
</SECTION>
<SECTION>
ClutterMotionEvent
ClutterInputDevice
ClutterEvent
-clutter_event_get_type
clutter_event_new
clutter_event_copy
clutter_event_free
clutter_key_event_code
clutter_key_event_unicode
clutter_keysym_to_unicode
+<SUBSECTION Private>
+clutter_event_get_type
</SECTION>
<SECTION>
@parent_class:
@show:
+@show_all:
@hide:
+@hide_all:
@realize:
@unrealize:
@paint:
@get_depth:
@parent_set:
@destroy:
-@show_all:
-@hide_all:
@queue_redraw:
@_clutter_actor_1:
@_clutter_actor_2:
@blue:
@alpha:
-<!-- ##### FUNCTION clutter_color_get_type ##### -->
-<para>
-
-</para>
-
-@Returns:
-
-
<!-- ##### FUNCTION clutter_color_parse ##### -->
<para>
</para>
-<!-- ##### FUNCTION clutter_event_get_type ##### -->
-<para>
-
-</para>
-
-@Returns:
-
-
<!-- ##### FUNCTION clutter_event_new ##### -->
<para>
@event:
-<!-- ##### FUNCTION clutter_key_event_type ##### -->
-<para>
-
-</para>
-
-@keyev:
-@Returns:
-
-
<!-- ##### FUNCTION clutter_key_event_time ##### -->
<para>
</para>
-@flags:
+@feature:
@Returns:
@parent_class:
@size_change:
@pixbuf_change:
+@_clutter_texture1:
+@_clutter_texture2:
+@_clutter_texture3:
+@_clutter_texture4:
+@_clutter_texture5:
+@_clutter_texture6:
<!-- ##### FUNCTION clutter_texture_new_from_pixbuf ##### -->
<para>
clutter_rectangle_set_border_color (CLUTTER_RECTANGLE (rect),
&rect_border_color);
clutter_actor_show (rect);
-
+
hand = clutter_texture_new_from_pixbuf (pixbuf);
clutter_actor_set_position (hand, 0, 0);
clutter_actor_show (hand);
clutter_group_add_many (CLUTTER_GROUP (group), rect, hand, NULL);
-
+
/* Make a timeline */
timeline = clutter_timeline_new (100, 26); /* num frames, fps */
g_object_set (timeline, "loop", TRUE, 0);
/* start the timeline and thus the animations */
clutter_timeline_start (timeline);
- clutter_group_show_all (CLUTTER_GROUP (stage));
+ clutter_actor_show_all (stage);
clutter_main();
clutter_group_add (CLUTTER_GROUP (stage), CLUTTER_ACTOR(oh->group));
/* Show everying ( and map window ) */
- clutter_group_show_all (CLUTTER_GROUP (oh->group));
- clutter_group_show_all (CLUTTER_GROUP (stage));
+ clutter_actor_show_all (stage);
g_signal_connect (stage, "button-press-event",
G_CALLBACK (input_cb),
clutter_actor_set_size (CLUTTER_ACTOR (stage), 800, 600);
- clutter_group_show_all (CLUTTER_GROUP (stage));
+ clutter_actor_show_all (CLUTTER_ACTOR (stage));
timeline = clutter_timeline_new (360, 200);
g_object_set (timeline, "loop", TRUE, 0);