mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
clutter/container: Drop ClutterContainer
Finally drop the type itself Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3384>
This commit is contained in:
parent
c42fa34b01
commit
db4bbf6899
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* CallyActor:
|
* CallyActor:
|
||||||
*
|
*
|
||||||
* Implementation of the ATK interfaces for [class@Clutter.Actor]
|
* Implementation of the ATK interfaces for [class@Clutter.Actor]
|
||||||
*
|
*
|
||||||
* #CallyActor implements the required ATK interfaces of [class@Clutter.Actor]
|
* #CallyActor implements the required ATK interfaces of [class@Clutter.Actor]
|
||||||
@ -564,7 +564,7 @@ cally_actor_real_add_actor (ClutterActor *container,
|
|||||||
CallyActorPrivate *priv = cally_actor->priv;
|
CallyActorPrivate *priv = cally_actor->priv;
|
||||||
gint index;
|
gint index;
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_CONTAINER (container), 0);
|
g_return_val_if_fail (CLUTTER_IS_ACTOR (container), 0);
|
||||||
g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), 0);
|
g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), 0);
|
||||||
|
|
||||||
g_object_notify (G_OBJECT (atk_child), "accessible_parent");
|
g_object_notify (G_OBJECT (atk_child), "accessible_parent");
|
||||||
@ -591,7 +591,7 @@ cally_actor_real_remove_actor (ClutterActor *container,
|
|||||||
CallyActorPrivate *priv = NULL;
|
CallyActorPrivate *priv = NULL;
|
||||||
gint index;
|
gint index;
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_CONTAINER (container), 0);
|
g_return_val_if_fail (CLUTTER_IS_ACTOR (container), 0);
|
||||||
g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), 0);
|
g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), 0);
|
||||||
|
|
||||||
atk_parent = ATK_OBJECT (data);
|
atk_parent = ATK_OBJECT (data);
|
||||||
|
@ -537,7 +537,6 @@
|
|||||||
#include "clutter/clutter-color-static.h"
|
#include "clutter/clutter-color-static.h"
|
||||||
#include "clutter/clutter-color.h"
|
#include "clutter/clutter-color.h"
|
||||||
#include "clutter/clutter-constraint-private.h"
|
#include "clutter/clutter-constraint-private.h"
|
||||||
#include "clutter/clutter-container.h"
|
|
||||||
#include "clutter/clutter-content-private.h"
|
#include "clutter/clutter-content-private.h"
|
||||||
#include "clutter/clutter-debug.h"
|
#include "clutter/clutter-debug.h"
|
||||||
#include "clutter/clutter-easing.h"
|
#include "clutter/clutter-easing.h"
|
||||||
@ -564,8 +563,6 @@
|
|||||||
#include "clutter/clutter-transition.h"
|
#include "clutter/clutter-transition.h"
|
||||||
#include "clutter/clutter-units.h"
|
#include "clutter/clutter-units.h"
|
||||||
|
|
||||||
#include "clutter/deprecated/clutter-container.h"
|
|
||||||
|
|
||||||
/* Internal enum used to control mapped state update. This is a hint
|
/* Internal enum used to control mapped state update. This is a hint
|
||||||
* which indicates when to do something other than just enforce
|
* which indicates when to do something other than just enforce
|
||||||
* invariants.
|
* invariants.
|
||||||
@ -944,7 +941,6 @@ typedef struct _TransitionClosure
|
|||||||
gulong completed_id;
|
gulong completed_id;
|
||||||
} TransitionClosure;
|
} TransitionClosure;
|
||||||
|
|
||||||
static void clutter_container_iface_init (ClutterContainerIface *iface);
|
|
||||||
static void clutter_scriptable_iface_init (ClutterScriptableIface *iface);
|
static void clutter_scriptable_iface_init (ClutterScriptableIface *iface);
|
||||||
static void clutter_animatable_iface_init (ClutterAnimatableInterface *iface);
|
static void clutter_animatable_iface_init (ClutterAnimatableInterface *iface);
|
||||||
static void atk_implementor_iface_init (AtkImplementorIface *iface);
|
static void atk_implementor_iface_init (AtkImplementorIface *iface);
|
||||||
@ -1030,8 +1026,6 @@ G_DEFINE_TYPE_WITH_CODE (ClutterActor,
|
|||||||
clutter_actor,
|
clutter_actor,
|
||||||
G_TYPE_INITIALLY_UNOWNED,
|
G_TYPE_INITIALLY_UNOWNED,
|
||||||
G_ADD_PRIVATE (ClutterActor)
|
G_ADD_PRIVATE (ClutterActor)
|
||||||
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_CONTAINER,
|
|
||||||
clutter_container_iface_init)
|
|
||||||
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_SCRIPTABLE,
|
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_SCRIPTABLE,
|
||||||
clutter_scriptable_iface_init)
|
clutter_scriptable_iface_init)
|
||||||
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_ANIMATABLE,
|
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_ANIMATABLE,
|
||||||
@ -4085,7 +4079,6 @@ remove_child (ClutterActor *self,
|
|||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
REMOVE_CHILD_DESTROY_META = 1 << 0,
|
|
||||||
REMOVE_CHILD_EMIT_PARENT_SET = 1 << 1,
|
REMOVE_CHILD_EMIT_PARENT_SET = 1 << 1,
|
||||||
REMOVE_CHILD_EMIT_CHILD_REMOVED = 1 << 2,
|
REMOVE_CHILD_EMIT_CHILD_REMOVED = 1 << 2,
|
||||||
REMOVE_CHILD_CHECK_STATE = 1 << 3,
|
REMOVE_CHILD_CHECK_STATE = 1 << 3,
|
||||||
@ -4095,7 +4088,6 @@ typedef enum
|
|||||||
|
|
||||||
/* default flags for public API */
|
/* default flags for public API */
|
||||||
REMOVE_CHILD_DEFAULT_FLAGS = REMOVE_CHILD_STOP_TRANSITIONS |
|
REMOVE_CHILD_DEFAULT_FLAGS = REMOVE_CHILD_STOP_TRANSITIONS |
|
||||||
REMOVE_CHILD_DESTROY_META |
|
|
||||||
REMOVE_CHILD_EMIT_PARENT_SET |
|
REMOVE_CHILD_EMIT_PARENT_SET |
|
||||||
REMOVE_CHILD_EMIT_CHILD_REMOVED |
|
REMOVE_CHILD_EMIT_CHILD_REMOVED |
|
||||||
REMOVE_CHILD_CHECK_STATE |
|
REMOVE_CHILD_CHECK_STATE |
|
||||||
@ -4117,7 +4109,7 @@ clutter_actor_remove_child_internal (ClutterActor *self,
|
|||||||
ClutterActorRemoveChildFlags flags)
|
ClutterActorRemoveChildFlags flags)
|
||||||
{
|
{
|
||||||
ClutterActor *old_first, *old_last;
|
ClutterActor *old_first, *old_last;
|
||||||
gboolean destroy_meta, emit_parent_set, emit_child_removed, check_state;
|
gboolean emit_parent_set, emit_child_removed, check_state;
|
||||||
gboolean notify_first_last;
|
gboolean notify_first_last;
|
||||||
gboolean stop_transitions;
|
gboolean stop_transitions;
|
||||||
gboolean clear_stage_views;
|
gboolean clear_stage_views;
|
||||||
@ -4130,7 +4122,6 @@ clutter_actor_remove_child_internal (ClutterActor *self,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
destroy_meta = (flags & REMOVE_CHILD_DESTROY_META) != 0;
|
|
||||||
emit_parent_set = (flags & REMOVE_CHILD_EMIT_PARENT_SET) != 0;
|
emit_parent_set = (flags & REMOVE_CHILD_EMIT_PARENT_SET) != 0;
|
||||||
emit_child_removed = (flags & REMOVE_CHILD_EMIT_CHILD_REMOVED) != 0;
|
emit_child_removed = (flags & REMOVE_CHILD_EMIT_CHILD_REMOVED) != 0;
|
||||||
check_state = (flags & REMOVE_CHILD_CHECK_STATE) != 0;
|
check_state = (flags & REMOVE_CHILD_CHECK_STATE) != 0;
|
||||||
@ -4144,9 +4135,6 @@ clutter_actor_remove_child_internal (ClutterActor *self,
|
|||||||
if (stop_transitions)
|
if (stop_transitions)
|
||||||
_clutter_actor_stop_transitions (child);
|
_clutter_actor_stop_transitions (child);
|
||||||
|
|
||||||
if (destroy_meta)
|
|
||||||
clutter_container_destroy_child_meta (CLUTTER_CONTAINER (self), child);
|
|
||||||
|
|
||||||
if (check_state)
|
if (check_state)
|
||||||
{
|
{
|
||||||
/* we need to unrealize *before* we set parent_actor to NULL,
|
/* we need to unrealize *before* we set parent_actor to NULL,
|
||||||
@ -5471,7 +5459,7 @@ clutter_actor_dispose (GObject *object)
|
|||||||
if (priv->parent != NULL)
|
if (priv->parent != NULL)
|
||||||
{
|
{
|
||||||
ClutterActor *parent = priv->parent;
|
ClutterActor *parent = priv->parent;
|
||||||
clutter_container_remove_actor (CLUTTER_CONTAINER (parent), self);
|
clutter_actor_remove_child (parent, self);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* parent must be gone at this point */
|
/* parent must be gone at this point */
|
||||||
@ -6911,8 +6899,7 @@ clutter_actor_class_init (ClutterActorClass *klass)
|
|||||||
* This signal might result in the finalization of the #ClutterActor
|
* This signal might result in the finalization of the #ClutterActor
|
||||||
* if all references are released.
|
* if all references are released.
|
||||||
*
|
*
|
||||||
* Composite actors and actors implementing the #ClutterContainer
|
* Composite actors should override the default implementation of the
|
||||||
* interface should override the default implementation of the
|
|
||||||
* class handler of this signal and call clutter_actor_destroy() on
|
* class handler of this signal and call clutter_actor_destroy() on
|
||||||
* their children. When overriding the default class handler, it is
|
* their children. When overriding the default class handler, it is
|
||||||
* required to chain up to the parent's implementation.
|
* required to chain up to the parent's implementation.
|
||||||
@ -10994,7 +10981,6 @@ typedef void (* ClutterActorAddChildFunc) (ClutterActor *parent,
|
|||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
ADD_CHILD_CREATE_META = 1 << 0,
|
|
||||||
ADD_CHILD_EMIT_PARENT_SET = 1 << 1,
|
ADD_CHILD_EMIT_PARENT_SET = 1 << 1,
|
||||||
ADD_CHILD_EMIT_CHILD_ADDED = 1 << 2,
|
ADD_CHILD_EMIT_CHILD_ADDED = 1 << 2,
|
||||||
ADD_CHILD_CHECK_STATE = 1 << 3,
|
ADD_CHILD_CHECK_STATE = 1 << 3,
|
||||||
@ -11002,8 +10988,7 @@ typedef enum
|
|||||||
ADD_CHILD_SHOW_ON_SET_PARENT = 1 << 5,
|
ADD_CHILD_SHOW_ON_SET_PARENT = 1 << 5,
|
||||||
|
|
||||||
/* default flags for public API */
|
/* default flags for public API */
|
||||||
ADD_CHILD_DEFAULT_FLAGS = ADD_CHILD_CREATE_META |
|
ADD_CHILD_DEFAULT_FLAGS = ADD_CHILD_EMIT_PARENT_SET |
|
||||||
ADD_CHILD_EMIT_PARENT_SET |
|
|
||||||
ADD_CHILD_EMIT_CHILD_ADDED |
|
ADD_CHILD_EMIT_CHILD_ADDED |
|
||||||
ADD_CHILD_CHECK_STATE |
|
ADD_CHILD_CHECK_STATE |
|
||||||
ADD_CHILD_NOTIFY_FIRST_LAST |
|
ADD_CHILD_NOTIFY_FIRST_LAST |
|
||||||
@ -11034,7 +11019,6 @@ clutter_actor_add_child_internal (ClutterActor *self,
|
|||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
ClutterTextDirection text_dir;
|
ClutterTextDirection text_dir;
|
||||||
gboolean create_meta;
|
|
||||||
gboolean emit_parent_set, emit_child_added;
|
gboolean emit_parent_set, emit_child_added;
|
||||||
gboolean check_state;
|
gboolean check_state;
|
||||||
gboolean notify_first_last;
|
gboolean notify_first_last;
|
||||||
@ -11114,7 +11098,6 @@ clutter_actor_add_child_internal (ClutterActor *self,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
create_meta = (flags & ADD_CHILD_CREATE_META) != 0;
|
|
||||||
emit_parent_set = (flags & ADD_CHILD_EMIT_PARENT_SET) != 0;
|
emit_parent_set = (flags & ADD_CHILD_EMIT_PARENT_SET) != 0;
|
||||||
emit_child_added = (flags & ADD_CHILD_EMIT_CHILD_ADDED) != 0;
|
emit_child_added = (flags & ADD_CHILD_EMIT_CHILD_ADDED) != 0;
|
||||||
check_state = (flags & ADD_CHILD_CHECK_STATE) != 0;
|
check_state = (flags & ADD_CHILD_CHECK_STATE) != 0;
|
||||||
@ -11127,9 +11110,6 @@ clutter_actor_add_child_internal (ClutterActor *self,
|
|||||||
obj = G_OBJECT (self);
|
obj = G_OBJECT (self);
|
||||||
g_object_freeze_notify (obj);
|
g_object_freeze_notify (obj);
|
||||||
|
|
||||||
if (create_meta)
|
|
||||||
clutter_container_create_child_meta (CLUTTER_CONTAINER (self), child);
|
|
||||||
|
|
||||||
g_object_ref_sink (child);
|
g_object_ref_sink (child);
|
||||||
child->priv->parent = NULL;
|
child->priv->parent = NULL;
|
||||||
child->priv->next_sibling = NULL;
|
child->priv->next_sibling = NULL;
|
||||||
@ -11971,14 +11951,6 @@ clutter_actor_store_content_box (ClutterActor *self,
|
|||||||
g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_CONTENT_BOX]);
|
g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_CONTENT_BOX]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
clutter_container_iface_init (ClutterContainerIface *iface)
|
|
||||||
{
|
|
||||||
/* we don't override anything, as ClutterContainer already has a default
|
|
||||||
* implementation that we can use, and which calls into our own API.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
PARSE_X,
|
PARSE_X,
|
||||||
@ -14052,12 +14024,7 @@ set_direction_recursive (ClutterActor *actor,
|
|||||||
*
|
*
|
||||||
* The passed text direction must not be %CLUTTER_TEXT_DIRECTION_DEFAULT
|
* The passed text direction must not be %CLUTTER_TEXT_DIRECTION_DEFAULT
|
||||||
*
|
*
|
||||||
* If @self implements #ClutterContainer then this function will recurse
|
* This function will recurse inside all the children of @self
|
||||||
* inside all the children of @self (including the internal ones).
|
|
||||||
*
|
|
||||||
* Composite actors not implementing #ClutterContainer, or actors requiring
|
|
||||||
* special handling when the text direction changes, should connect to
|
|
||||||
* the #GObject::notify signal for the #ClutterActor:text-direction property
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
clutter_actor_set_text_direction (ClutterActor *self,
|
clutter_actor_set_text_direction (ClutterActor *self,
|
||||||
|
@ -42,7 +42,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterChildMeta, g_object_unref)
|
|||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterClone, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterClone, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterColorizeEffect, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterColorizeEffect, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterConstraint, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterConstraint, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterContainer, g_object_unref)
|
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDeformEffect, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDeformEffect, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDesaturateEffect, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDesaturateEffect, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterEffect, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterEffect, g_object_unref)
|
||||||
|
@ -28,10 +28,10 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* ClutterChildMeta:
|
* ClutterChildMeta:
|
||||||
*
|
*
|
||||||
* Base interface for container specific state for child actors.
|
* Base interface for container specific state for child actors.
|
||||||
*
|
*
|
||||||
* A child data is meant to be used when you need to keep track
|
* A child data is meant to be used when you need to keep track
|
||||||
* of information about each individual child added to a container.
|
* of information about each individual child added to a container.
|
||||||
*
|
*
|
||||||
* In order to use it you should create your own subclass of
|
* In order to use it you should create your own subclass of
|
||||||
@ -53,7 +53,7 @@
|
|||||||
*
|
*
|
||||||
* The child data for an actor can be retrieved using the
|
* The child data for an actor can be retrieved using the
|
||||||
* clutter_container_get_child_meta() function.
|
* clutter_container_get_child_meta() function.
|
||||||
*
|
*
|
||||||
* The properties of the data and your subclass can be manipulated with
|
* The properties of the data and your subclass can be manipulated with
|
||||||
* clutter_container_child_set() and clutter_container_child_get() which
|
* clutter_container_child_set() and clutter_container_child_get() which
|
||||||
* act like g_object_set() and g_object_get().
|
* act like g_object_set() and g_object_get().
|
||||||
@ -93,7 +93,7 @@ clutter_child_meta_set_property (GObject *object,
|
|||||||
{
|
{
|
||||||
ClutterChildMeta *child_meta = CLUTTER_CHILD_META (object);
|
ClutterChildMeta *child_meta = CLUTTER_CHILD_META (object);
|
||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
case PROP_CONTAINER:
|
case PROP_CONTAINER:
|
||||||
child_meta->container = g_value_get_object (value);
|
child_meta->container = g_value_get_object (value);
|
||||||
@ -109,7 +109,7 @@ clutter_child_meta_set_property (GObject *object,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_child_meta_get_property (GObject *object,
|
clutter_child_meta_get_property (GObject *object,
|
||||||
guint prop_id,
|
guint prop_id,
|
||||||
GValue *value,
|
GValue *value,
|
||||||
@ -117,7 +117,7 @@ clutter_child_meta_get_property (GObject *object,
|
|||||||
{
|
{
|
||||||
ClutterChildMeta *child_meta = CLUTTER_CHILD_META (object);
|
ClutterChildMeta *child_meta = CLUTTER_CHILD_META (object);
|
||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
case PROP_CONTAINER:
|
case PROP_CONTAINER:
|
||||||
g_value_set_object (value, child_meta->container);
|
g_value_set_object (value, child_meta->container);
|
||||||
@ -148,7 +148,7 @@ clutter_child_meta_class_init (ClutterChildMetaClass *klass)
|
|||||||
*/
|
*/
|
||||||
obj_props[PROP_CONTAINER] =
|
obj_props[PROP_CONTAINER] =
|
||||||
g_param_spec_object ("container", NULL, NULL,
|
g_param_spec_object ("container", NULL, NULL,
|
||||||
CLUTTER_TYPE_CONTAINER,
|
CLUTTER_TYPE_ACTOR,
|
||||||
G_PARAM_CONSTRUCT_ONLY |
|
G_PARAM_CONSTRUCT_ONLY |
|
||||||
CLUTTER_PARAM_READWRITE);
|
CLUTTER_PARAM_READWRITE);
|
||||||
|
|
||||||
@ -179,9 +179,9 @@ clutter_child_meta_init (ClutterChildMeta *self)
|
|||||||
*
|
*
|
||||||
* Retrieves the container using @data
|
* Retrieves the container using @data
|
||||||
*
|
*
|
||||||
* Return value: (transfer none): a #ClutterContainer
|
* Return value: (transfer none): a #ClutterActor
|
||||||
*/
|
*/
|
||||||
ClutterContainer *
|
ClutterActor *
|
||||||
clutter_child_meta_get_container (ClutterChildMeta *data)
|
clutter_child_meta_get_container (ClutterChildMeta *data)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (CLUTTER_IS_CHILD_META (data), NULL);
|
g_return_val_if_fail (CLUTTER_IS_CHILD_META (data), NULL);
|
||||||
|
@ -52,7 +52,7 @@ struct _ClutterChildMeta
|
|||||||
GObject parent_instance;
|
GObject parent_instance;
|
||||||
|
|
||||||
/*< public >*/
|
/*< public >*/
|
||||||
ClutterContainer *container;
|
ClutterActor *container;
|
||||||
ClutterActor *actor;
|
ClutterActor *actor;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -65,13 +65,13 @@ struct _ClutterChildMetaClass
|
|||||||
{
|
{
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
GObjectClass parent_class;
|
GObjectClass parent_class;
|
||||||
};
|
};
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
GType clutter_child_meta_get_type (void) G_GNUC_CONST;
|
GType clutter_child_meta_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
ClutterContainer * clutter_child_meta_get_container (ClutterChildMeta *data);
|
ClutterActor * clutter_child_meta_get_container (ClutterChildMeta *data);
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
ClutterActor * clutter_child_meta_get_actor (ClutterChildMeta *data);
|
ClutterActor * clutter_child_meta_get_actor (ClutterChildMeta *data);
|
||||||
|
|
||||||
|
@ -1,951 +0,0 @@
|
|||||||
/*
|
|
||||||
* Clutter.
|
|
||||||
*
|
|
||||||
* An OpenGL based 'interactive canvas' library.
|
|
||||||
*
|
|
||||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
|
||||||
*
|
|
||||||
* Copyright (C) 2006 OpenedHand
|
|
||||||
*
|
|
||||||
* 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 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, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* ClutterContainer: Generic actor container interface.
|
|
||||||
* Author: Emmanuele Bassi <ebassi@openedhand.com>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "clutter/clutter-build-config.h"
|
|
||||||
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <glib-object.h>
|
|
||||||
#include <gobject/gvaluecollector.h>
|
|
||||||
|
|
||||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
|
||||||
#include "clutter/deprecated/clutter-container.h"
|
|
||||||
|
|
||||||
#include "clutter/clutter-actor-private.h"
|
|
||||||
#include "clutter/clutter-child-meta.h"
|
|
||||||
#include "clutter/clutter-debug.h"
|
|
||||||
#include "clutter/clutter-main.h"
|
|
||||||
#include "clutter/clutter-marshal.h"
|
|
||||||
#include "clutter/clutter-private.h"
|
|
||||||
#include "clutter/clutter-enum-types.h"
|
|
||||||
|
|
||||||
#define CLUTTER_CONTAINER_WARN_NOT_IMPLEMENTED(container,vfunc) \
|
|
||||||
G_STMT_START { \
|
|
||||||
g_warning ("Container of type '%s' does not implement " \
|
|
||||||
"the required ClutterContainer::%s virtual " \
|
|
||||||
"function.", \
|
|
||||||
G_OBJECT_TYPE_NAME ((container)), \
|
|
||||||
(vfunc)); \
|
|
||||||
} G_STMT_END
|
|
||||||
|
|
||||||
#define CLUTTER_CONTAINER_NOTE_NOT_IMPLEMENTED(container,vfunc) \
|
|
||||||
G_STMT_START { \
|
|
||||||
CLUTTER_NOTE (ACTOR, "Container of type '%s' does not " \
|
|
||||||
"implement the ClutterContainer::%s " \
|
|
||||||
"virtual function.", \
|
|
||||||
G_OBJECT_TYPE_NAME ((container)), \
|
|
||||||
(vfunc)); \
|
|
||||||
} G_STMT_END
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ClutterContainer:
|
|
||||||
*
|
|
||||||
* An interface for container actors
|
|
||||||
*
|
|
||||||
* #ClutterContainer is an interface implemented by [class@Actor], and
|
|
||||||
* it provides some common API for notifying when a child actor is added
|
|
||||||
* or removed, as well as the infrastructure for accessing child properties
|
|
||||||
* through [class@ChildMeta].
|
|
||||||
*/
|
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
CHILD_NOTIFY,
|
|
||||||
|
|
||||||
LAST_SIGNAL
|
|
||||||
};
|
|
||||||
|
|
||||||
static guint container_signals[LAST_SIGNAL] = { 0, };
|
|
||||||
static GQuark quark_child_meta = 0;
|
|
||||||
|
|
||||||
static ClutterChildMeta *get_child_meta (ClutterContainer *container,
|
|
||||||
ClutterActor *actor);
|
|
||||||
static void create_child_meta (ClutterContainer *container,
|
|
||||||
ClutterActor *actor);
|
|
||||||
static void destroy_child_meta (ClutterContainer *container,
|
|
||||||
ClutterActor *actor);
|
|
||||||
static void child_notify (ClutterContainer *container,
|
|
||||||
ClutterActor *child,
|
|
||||||
GParamSpec *pspec);
|
|
||||||
|
|
||||||
typedef ClutterContainerIface ClutterContainerInterface;
|
|
||||||
|
|
||||||
G_DEFINE_INTERFACE (ClutterContainer, clutter_container, G_TYPE_OBJECT);
|
|
||||||
|
|
||||||
static void
|
|
||||||
container_real_add (ClutterContainer *container,
|
|
||||||
ClutterActor *actor)
|
|
||||||
{
|
|
||||||
clutter_actor_add_child (CLUTTER_ACTOR (container), actor);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
container_real_remove (ClutterContainer *container,
|
|
||||||
ClutterActor *actor)
|
|
||||||
{
|
|
||||||
clutter_actor_remove_child (CLUTTER_ACTOR (container), actor);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
clutter_container_default_init (ClutterContainerInterface *iface)
|
|
||||||
{
|
|
||||||
GType iface_type = G_TYPE_FROM_INTERFACE (iface);
|
|
||||||
|
|
||||||
quark_child_meta =
|
|
||||||
g_quark_from_static_string ("clutter-container-child-data");
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ClutterContainer::child-notify:
|
|
||||||
* @container: the container which received the signal
|
|
||||||
* @actor: the child that has had a property set
|
|
||||||
* @pspec: (type GParamSpec): the #GParamSpec of the property set
|
|
||||||
*
|
|
||||||
* The signal is emitted each time a property is
|
|
||||||
* being set through the clutter_container_child_set() and
|
|
||||||
* clutter_container_child_set_property() calls.
|
|
||||||
*/
|
|
||||||
container_signals[CHILD_NOTIFY] =
|
|
||||||
g_signal_new (I_("child-notify"),
|
|
||||||
iface_type,
|
|
||||||
G_SIGNAL_RUN_FIRST | G_SIGNAL_DETAILED,
|
|
||||||
G_STRUCT_OFFSET (ClutterContainerIface, child_notify),
|
|
||||||
NULL, NULL,
|
|
||||||
_clutter_marshal_VOID__OBJECT_PARAM,
|
|
||||||
G_TYPE_NONE, 2,
|
|
||||||
CLUTTER_TYPE_ACTOR, G_TYPE_PARAM);
|
|
||||||
|
|
||||||
iface->add = container_real_add;
|
|
||||||
iface->remove = container_real_remove;
|
|
||||||
|
|
||||||
iface->child_meta_type = G_TYPE_INVALID;
|
|
||||||
iface->create_child_meta = create_child_meta;
|
|
||||||
iface->destroy_child_meta = destroy_child_meta;
|
|
||||||
iface->get_child_meta = get_child_meta;
|
|
||||||
iface->child_notify = child_notify;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void
|
|
||||||
container_add_actor (ClutterContainer *container,
|
|
||||||
ClutterActor *actor)
|
|
||||||
{
|
|
||||||
ClutterActor *parent;
|
|
||||||
|
|
||||||
parent = clutter_actor_get_parent (actor);
|
|
||||||
if (G_UNLIKELY (parent != NULL))
|
|
||||||
{
|
|
||||||
g_warning ("Attempting to add actor of type '%s' to a "
|
|
||||||
"container of type '%s', but the actor has "
|
|
||||||
"already a parent of type '%s'.",
|
|
||||||
g_type_name (G_OBJECT_TYPE (actor)),
|
|
||||||
g_type_name (G_OBJECT_TYPE (container)),
|
|
||||||
g_type_name (G_OBJECT_TYPE (parent)));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
clutter_container_create_child_meta (container, actor);
|
|
||||||
|
|
||||||
#ifdef CLUTTER_ENABLE_DEBUG
|
|
||||||
if (G_UNLIKELY (_clutter_diagnostic_enabled ()))
|
|
||||||
{
|
|
||||||
ClutterContainerIface *iface = CLUTTER_CONTAINER_GET_IFACE (container);
|
|
||||||
|
|
||||||
if (iface->add != container_real_add)
|
|
||||||
_clutter_diagnostic_message ("The ClutterContainer::add() virtual "
|
|
||||||
"function has been deprecated and it "
|
|
||||||
"should not be overridden by newly "
|
|
||||||
"written code");
|
|
||||||
}
|
|
||||||
#endif /* CLUTTER_ENABLE_DEBUG */
|
|
||||||
|
|
||||||
CLUTTER_CONTAINER_GET_IFACE (container)->add (container, actor);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void
|
|
||||||
container_remove_actor (ClutterContainer *container,
|
|
||||||
ClutterActor *actor)
|
|
||||||
{
|
|
||||||
ClutterActor *parent;
|
|
||||||
|
|
||||||
parent = clutter_actor_get_parent (actor);
|
|
||||||
if (parent != CLUTTER_ACTOR (container))
|
|
||||||
{
|
|
||||||
g_warning ("Attempting to remove actor of type '%s' from "
|
|
||||||
"group of class '%s', but the container is not "
|
|
||||||
"the actor's parent.",
|
|
||||||
g_type_name (G_OBJECT_TYPE (actor)),
|
|
||||||
g_type_name (G_OBJECT_TYPE (container)));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
clutter_container_destroy_child_meta (container, actor);
|
|
||||||
|
|
||||||
#ifdef CLUTTER_ENABLE_DEBUG
|
|
||||||
if (G_UNLIKELY (_clutter_diagnostic_enabled ()))
|
|
||||||
{
|
|
||||||
ClutterContainerIface *iface = CLUTTER_CONTAINER_GET_IFACE (container);
|
|
||||||
|
|
||||||
if (iface->remove != container_real_remove)
|
|
||||||
_clutter_diagnostic_message ("The ClutterContainer::remove() virtual "
|
|
||||||
"function has been deprecated and it "
|
|
||||||
"should not be overridden by newly "
|
|
||||||
"written code");
|
|
||||||
}
|
|
||||||
#endif /* CLUTTER_ENABLE_DEBUG */
|
|
||||||
|
|
||||||
CLUTTER_CONTAINER_GET_IFACE (container)->remove (container, actor);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void
|
|
||||||
container_add_valist (ClutterContainer *container,
|
|
||||||
ClutterActor *first_actor,
|
|
||||||
va_list args)
|
|
||||||
{
|
|
||||||
ClutterActor *actor = first_actor;
|
|
||||||
|
|
||||||
while (actor != NULL)
|
|
||||||
{
|
|
||||||
container_add_actor (container, actor);
|
|
||||||
actor = va_arg (args, ClutterActor *);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void
|
|
||||||
container_remove_valist (ClutterContainer *container,
|
|
||||||
ClutterActor *first_actor,
|
|
||||||
va_list args)
|
|
||||||
{
|
|
||||||
ClutterActor *actor = first_actor;
|
|
||||||
|
|
||||||
while (actor != NULL)
|
|
||||||
{
|
|
||||||
container_remove_actor (container, actor);
|
|
||||||
actor = va_arg (args, ClutterActor *);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* clutter_container_add: (skip)
|
|
||||||
* @container: a #ClutterContainer
|
|
||||||
* @first_actor: the first #ClutterActor to add
|
|
||||||
* @...: %NULL terminated list of actors to add
|
|
||||||
*
|
|
||||||
* Adds a list of `ClutterActor`s to @container. Each time and
|
|
||||||
* actor is added, the "actor-added" signal is emitted. Each actor should
|
|
||||||
* be parented to @container, which takes a reference on the actor. You
|
|
||||||
* cannot add a #ClutterActor to more than one #ClutterContainer.
|
|
||||||
*
|
|
||||||
* This function will call #ClutterContainerIface.add(), which is a
|
|
||||||
* deprecated virtual function. The default implementation will
|
|
||||||
* call clutter_actor_add_child().
|
|
||||||
*
|
|
||||||
* Deprecated: 1.10: Use clutter_actor_add_child() instead.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
clutter_container_add (ClutterContainer *container,
|
|
||||||
ClutterActor *first_actor,
|
|
||||||
...)
|
|
||||||
{
|
|
||||||
va_list args;
|
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
|
|
||||||
g_return_if_fail (CLUTTER_IS_ACTOR (first_actor));
|
|
||||||
|
|
||||||
va_start (args, first_actor);
|
|
||||||
container_add_valist (container, first_actor, args);
|
|
||||||
va_end (args);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* clutter_container_add_actor: (virtual add)
|
|
||||||
* @container: a #ClutterContainer
|
|
||||||
* @actor: the first #ClutterActor to add
|
|
||||||
*
|
|
||||||
* Adds a #ClutterActor to @container. This function will emit the
|
|
||||||
* "actor-added" signal. The actor should be parented to
|
|
||||||
* @container. You cannot add a #ClutterActor to more than one
|
|
||||||
* #ClutterContainer.
|
|
||||||
*
|
|
||||||
* This function will call #ClutterContainerIface.add(), which is a
|
|
||||||
* deprecated virtual function. The default implementation will
|
|
||||||
* call clutter_actor_add_child().
|
|
||||||
*
|
|
||||||
* Deprecated: 1.10: Use clutter_actor_add_child() instead.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
clutter_container_add_actor (ClutterContainer *container,
|
|
||||||
ClutterActor *actor)
|
|
||||||
{
|
|
||||||
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
|
|
||||||
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
|
|
||||||
|
|
||||||
container_add_actor (container, actor);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* clutter_container_remove: (skip)
|
|
||||||
* @container: a #ClutterContainer
|
|
||||||
* @first_actor: first #ClutterActor to remove
|
|
||||||
* @...: a %NULL-terminated list of actors to remove
|
|
||||||
*
|
|
||||||
* Removes a %NULL terminated list of `ClutterActor`s from
|
|
||||||
* @container. Each actor should be unparented, so if you want to keep it
|
|
||||||
* around you must hold a reference to it yourself, using g_object_ref().
|
|
||||||
* Each time an actor is removed, the "actor-removed" signal is
|
|
||||||
* emitted by @container.
|
|
||||||
*
|
|
||||||
* This function will call #ClutterContainerIface.remove(), which is a
|
|
||||||
* deprecated virtual function. The default implementation will call
|
|
||||||
* clutter_actor_remove_child().
|
|
||||||
*
|
|
||||||
* Deprecated: 1.10: Use clutter_actor_remove_child() instead.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
clutter_container_remove (ClutterContainer *container,
|
|
||||||
ClutterActor *first_actor,
|
|
||||||
...)
|
|
||||||
{
|
|
||||||
va_list var_args;
|
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
|
|
||||||
g_return_if_fail (CLUTTER_IS_ACTOR (first_actor));
|
|
||||||
|
|
||||||
va_start (var_args, first_actor);
|
|
||||||
container_remove_valist (container, first_actor, var_args);
|
|
||||||
va_end (var_args);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* clutter_container_remove_actor: (virtual remove)
|
|
||||||
* @container: a #ClutterContainer
|
|
||||||
* @actor: a #ClutterActor
|
|
||||||
*
|
|
||||||
* Removes @actor from @container. The actor should be unparented, so
|
|
||||||
* if you want to keep it around you must hold a reference to it
|
|
||||||
* yourself, using g_object_ref(). When the actor has been removed,
|
|
||||||
* the "actor-removed" signal is emitted by @container.
|
|
||||||
*
|
|
||||||
* This function will call #ClutterContainerIface.remove(), which is a
|
|
||||||
* deprecated virtual function. The default implementation will call
|
|
||||||
* clutter_actor_remove_child().
|
|
||||||
*
|
|
||||||
* Deprecated: 1.10: Use clutter_actor_remove_child() instead.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
clutter_container_remove_actor (ClutterContainer *container,
|
|
||||||
ClutterActor *actor)
|
|
||||||
{
|
|
||||||
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
|
|
||||||
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
|
|
||||||
|
|
||||||
container_remove_actor (container, actor);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* clutter_container_find_child_by_name:
|
|
||||||
* @container: a #ClutterContainer
|
|
||||||
* @child_name: the name of the requested child.
|
|
||||||
*
|
|
||||||
* Finds a child actor of a container by its name. Search recurses
|
|
||||||
* into any child container.
|
|
||||||
*
|
|
||||||
* Return value: (transfer none): The child actor with the requested name,
|
|
||||||
* or %NULL if no actor with that name was found.
|
|
||||||
*/
|
|
||||||
ClutterActor *
|
|
||||||
clutter_container_find_child_by_name (ClutterContainer *container,
|
|
||||||
const gchar *child_name)
|
|
||||||
{
|
|
||||||
GList *children;
|
|
||||||
GList *iter;
|
|
||||||
ClutterActor *actor = NULL;
|
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_CONTAINER (container), NULL);
|
|
||||||
g_return_val_if_fail (child_name != NULL, NULL);
|
|
||||||
|
|
||||||
children = clutter_actor_get_children (CLUTTER_ACTOR (container));
|
|
||||||
|
|
||||||
for (iter = children; iter; iter = g_list_next (iter))
|
|
||||||
{
|
|
||||||
ClutterActor *a;
|
|
||||||
const gchar *iter_name;
|
|
||||||
|
|
||||||
a = CLUTTER_ACTOR (iter->data);
|
|
||||||
iter_name = clutter_actor_get_name (a);
|
|
||||||
|
|
||||||
if (iter_name && !strcmp (iter_name, child_name))
|
|
||||||
{
|
|
||||||
actor = a;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CLUTTER_IS_CONTAINER (a))
|
|
||||||
{
|
|
||||||
ClutterContainer *c = CLUTTER_CONTAINER (a);
|
|
||||||
|
|
||||||
actor = clutter_container_find_child_by_name (c, child_name);
|
|
||||||
if (actor)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
g_list_free (children);
|
|
||||||
|
|
||||||
return actor;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ClutterChildMeta *
|
|
||||||
get_child_meta (ClutterContainer *container,
|
|
||||||
ClutterActor *actor)
|
|
||||||
{
|
|
||||||
ClutterContainerIface *iface = CLUTTER_CONTAINER_GET_IFACE (container);
|
|
||||||
ClutterChildMeta *meta;
|
|
||||||
|
|
||||||
if (iface->child_meta_type == G_TYPE_INVALID)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
meta = g_object_get_qdata (G_OBJECT (actor), quark_child_meta);
|
|
||||||
if (meta != NULL && meta->actor == actor)
|
|
||||||
return meta;
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
create_child_meta (ClutterContainer *container,
|
|
||||||
ClutterActor *actor)
|
|
||||||
{
|
|
||||||
ClutterContainerIface *iface = CLUTTER_CONTAINER_GET_IFACE (container);
|
|
||||||
ClutterChildMeta *child_meta = NULL;
|
|
||||||
|
|
||||||
if (iface->child_meta_type == G_TYPE_INVALID)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!g_type_is_a (iface->child_meta_type, CLUTTER_TYPE_CHILD_META))
|
|
||||||
{
|
|
||||||
g_warning ("%s: Child data of type '%s' is not a ClutterChildMeta",
|
|
||||||
G_STRLOC, g_type_name (iface->child_meta_type));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
child_meta = g_object_new (iface->child_meta_type,
|
|
||||||
"container", container,
|
|
||||||
"actor", actor,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
g_object_set_qdata_full (G_OBJECT (actor), quark_child_meta,
|
|
||||||
child_meta,
|
|
||||||
(GDestroyNotify) g_object_unref);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
destroy_child_meta (ClutterContainer *container,
|
|
||||||
ClutterActor *actor)
|
|
||||||
{
|
|
||||||
ClutterContainerIface *iface = CLUTTER_CONTAINER_GET_IFACE (container);
|
|
||||||
|
|
||||||
if (iface->child_meta_type == G_TYPE_INVALID)
|
|
||||||
return;
|
|
||||||
|
|
||||||
g_object_set_qdata (G_OBJECT (actor), quark_child_meta, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* clutter_container_get_child_meta:
|
|
||||||
* @container: a #ClutterContainer
|
|
||||||
* @actor: a #ClutterActor that is a child of @container.
|
|
||||||
*
|
|
||||||
* Retrieves the #ClutterChildMeta which contains the data about the
|
|
||||||
* @container specific state for @actor.
|
|
||||||
*
|
|
||||||
* Return value: (transfer none): the #ClutterChildMeta for the @actor child
|
|
||||||
* of @container or %NULL if the specific actor does not exist or the
|
|
||||||
* container is not configured to provide `ClutterChildMeta`s
|
|
||||||
*/
|
|
||||||
ClutterChildMeta *
|
|
||||||
clutter_container_get_child_meta (ClutterContainer *container,
|
|
||||||
ClutterActor *actor)
|
|
||||||
{
|
|
||||||
ClutterContainerIface *iface = CLUTTER_CONTAINER_GET_IFACE (container);
|
|
||||||
|
|
||||||
if (iface->child_meta_type == G_TYPE_INVALID)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (G_LIKELY (iface->get_child_meta))
|
|
||||||
return iface->get_child_meta (container, actor);
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* clutter_container_create_child_meta:
|
|
||||||
* @container: a #ClutterContainer
|
|
||||||
* @actor: a #ClutterActor
|
|
||||||
*
|
|
||||||
* Creates the #ClutterChildMeta wrapping @actor inside the
|
|
||||||
* @container, if the #ClutterContainerIface::child_meta_type
|
|
||||||
* class member is not set to %G_TYPE_INVALID.
|
|
||||||
*
|
|
||||||
* This function is only useful when adding a #ClutterActor to
|
|
||||||
* a #ClutterContainer implementation outside of the
|
|
||||||
* #ClutterContainer::add() virtual function implementation.
|
|
||||||
*
|
|
||||||
* Applications should not call this function.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
clutter_container_create_child_meta (ClutterContainer *container,
|
|
||||||
ClutterActor *actor)
|
|
||||||
{
|
|
||||||
ClutterContainerIface *iface;
|
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
|
|
||||||
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
|
|
||||||
|
|
||||||
iface = CLUTTER_CONTAINER_GET_IFACE (container);
|
|
||||||
|
|
||||||
if (iface->child_meta_type == G_TYPE_INVALID)
|
|
||||||
return;
|
|
||||||
|
|
||||||
g_assert (g_type_is_a (iface->child_meta_type, CLUTTER_TYPE_CHILD_META));
|
|
||||||
|
|
||||||
if (G_LIKELY (iface->create_child_meta))
|
|
||||||
iface->create_child_meta (container, actor);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* clutter_container_destroy_child_meta:
|
|
||||||
* @container: a #ClutterContainer
|
|
||||||
* @actor: a #ClutterActor
|
|
||||||
*
|
|
||||||
* Destroys the #ClutterChildMeta wrapping @actor inside the
|
|
||||||
* @container, if any.
|
|
||||||
*
|
|
||||||
* This function is only useful when removing a #ClutterActor to
|
|
||||||
* a #ClutterContainer implementation outside of the
|
|
||||||
* #ClutterContainer::add() virtual function implementation.
|
|
||||||
*
|
|
||||||
* Applications should not call this function.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
clutter_container_destroy_child_meta (ClutterContainer *container,
|
|
||||||
ClutterActor *actor)
|
|
||||||
{
|
|
||||||
ClutterContainerIface *iface;
|
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
|
|
||||||
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
|
|
||||||
|
|
||||||
iface = CLUTTER_CONTAINER_GET_IFACE (container);
|
|
||||||
|
|
||||||
if (iface->child_meta_type == G_TYPE_INVALID)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (G_LIKELY (iface->destroy_child_meta))
|
|
||||||
iface->destroy_child_meta (container, actor);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* clutter_container_class_find_child_property:
|
|
||||||
* @klass: a #GObjectClass implementing the #ClutterContainer interface.
|
|
||||||
* @property_name: a property name.
|
|
||||||
*
|
|
||||||
* Looks up the #GParamSpec for a child property of @klass.
|
|
||||||
*
|
|
||||||
* Return value: (transfer none): The #GParamSpec for the property or %NULL
|
|
||||||
* if no such property exist.
|
|
||||||
*/
|
|
||||||
GParamSpec *
|
|
||||||
clutter_container_class_find_child_property (GObjectClass *klass,
|
|
||||||
const gchar *property_name)
|
|
||||||
{
|
|
||||||
ClutterContainerIface *iface;
|
|
||||||
GObjectClass *child_class;
|
|
||||||
GParamSpec *pspec;
|
|
||||||
|
|
||||||
g_return_val_if_fail (G_IS_OBJECT_CLASS (klass), NULL);
|
|
||||||
g_return_val_if_fail (property_name != NULL, NULL);
|
|
||||||
g_return_val_if_fail (g_type_is_a (G_TYPE_FROM_CLASS (klass),
|
|
||||||
CLUTTER_TYPE_CONTAINER),
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
iface = g_type_interface_peek (klass, CLUTTER_TYPE_CONTAINER);
|
|
||||||
g_return_val_if_fail (iface != NULL, NULL);
|
|
||||||
|
|
||||||
if (iface->child_meta_type == G_TYPE_INVALID)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
child_class = g_type_class_ref (iface->child_meta_type);
|
|
||||||
pspec = g_object_class_find_property (child_class, property_name);
|
|
||||||
g_type_class_unref (child_class);
|
|
||||||
|
|
||||||
return pspec;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* clutter_container_class_list_child_properties:
|
|
||||||
* @klass: a #GObjectClass implementing the #ClutterContainer interface.
|
|
||||||
* @n_properties: return location for length of returned array.
|
|
||||||
*
|
|
||||||
* Returns an array of #GParamSpec for all child properties.
|
|
||||||
*
|
|
||||||
* Return value: (array length=n_properties) (transfer full): an array
|
|
||||||
* of `GParamSpec`s which should be freed after use.
|
|
||||||
*/
|
|
||||||
GParamSpec **
|
|
||||||
clutter_container_class_list_child_properties (GObjectClass *klass,
|
|
||||||
guint *n_properties)
|
|
||||||
{
|
|
||||||
ClutterContainerIface *iface;
|
|
||||||
GObjectClass *child_class;
|
|
||||||
GParamSpec **retval;
|
|
||||||
|
|
||||||
g_return_val_if_fail (G_IS_OBJECT_CLASS (klass), NULL);
|
|
||||||
g_return_val_if_fail (g_type_is_a (G_TYPE_FROM_CLASS (klass),
|
|
||||||
CLUTTER_TYPE_CONTAINER),
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
iface = g_type_interface_peek (klass, CLUTTER_TYPE_CONTAINER);
|
|
||||||
g_return_val_if_fail (iface != NULL, NULL);
|
|
||||||
|
|
||||||
if (iface->child_meta_type == G_TYPE_INVALID)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
child_class = g_type_class_ref (iface->child_meta_type);
|
|
||||||
retval = g_object_class_list_properties (child_class, n_properties);
|
|
||||||
g_type_class_unref (child_class);
|
|
||||||
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
child_notify (ClutterContainer *container,
|
|
||||||
ClutterActor *actor,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void
|
|
||||||
container_set_child_property (ClutterContainer *container,
|
|
||||||
ClutterActor *actor,
|
|
||||||
const GValue *value,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
{
|
|
||||||
ClutterChildMeta *data;
|
|
||||||
|
|
||||||
data = clutter_container_get_child_meta (container, actor);
|
|
||||||
g_object_set_property (G_OBJECT (data), pspec->name, value);
|
|
||||||
|
|
||||||
g_signal_emit (container, container_signals[CHILD_NOTIFY],
|
|
||||||
(pspec->flags & G_PARAM_STATIC_NAME)
|
|
||||||
? g_quark_from_static_string (pspec->name)
|
|
||||||
: g_quark_from_string (pspec->name),
|
|
||||||
actor, pspec);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* clutter_container_child_set_property:
|
|
||||||
* @container: a #ClutterContainer
|
|
||||||
* @child: a #ClutterActor that is a child of @container.
|
|
||||||
* @property: the name of the property to set.
|
|
||||||
* @value: the value.
|
|
||||||
*
|
|
||||||
* Sets a container-specific property on a child of @container.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
clutter_container_child_set_property (ClutterContainer *container,
|
|
||||||
ClutterActor *child,
|
|
||||||
const gchar *property,
|
|
||||||
const GValue *value)
|
|
||||||
{
|
|
||||||
GObjectClass *klass;
|
|
||||||
GParamSpec *pspec;
|
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
|
|
||||||
g_return_if_fail (CLUTTER_IS_ACTOR (child));
|
|
||||||
g_return_if_fail (property != NULL);
|
|
||||||
g_return_if_fail (value != NULL);
|
|
||||||
|
|
||||||
klass = G_OBJECT_GET_CLASS (container);
|
|
||||||
|
|
||||||
pspec = clutter_container_class_find_child_property (klass, property);
|
|
||||||
if (!pspec)
|
|
||||||
{
|
|
||||||
g_warning ("%s: Containers of type '%s' have no child "
|
|
||||||
"property named '%s'",
|
|
||||||
G_STRLOC, G_OBJECT_TYPE_NAME (container), property);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(pspec->flags & G_PARAM_WRITABLE))
|
|
||||||
{
|
|
||||||
g_warning ("%s: Child property '%s' of the container '%s' "
|
|
||||||
"is not writable",
|
|
||||||
G_STRLOC, pspec->name, G_OBJECT_TYPE_NAME (container));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
container_set_child_property (container, child, value, pspec);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* clutter_container_child_set:
|
|
||||||
* @container: a #ClutterContainer
|
|
||||||
* @actor: a #ClutterActor that is a child of @container.
|
|
||||||
* @first_prop: name of the first property to be set.
|
|
||||||
* @...: value for the first property, followed optionally by more name/value
|
|
||||||
* pairs terminated with NULL.
|
|
||||||
*
|
|
||||||
* Sets container specific properties on the child of a container.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
clutter_container_child_set (ClutterContainer *container,
|
|
||||||
ClutterActor *actor,
|
|
||||||
const gchar *first_prop,
|
|
||||||
...)
|
|
||||||
{
|
|
||||||
GObjectClass *klass;
|
|
||||||
const gchar *name;
|
|
||||||
va_list var_args;
|
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
|
|
||||||
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
|
|
||||||
|
|
||||||
klass = G_OBJECT_GET_CLASS (container);
|
|
||||||
|
|
||||||
va_start (var_args, first_prop);
|
|
||||||
|
|
||||||
name = first_prop;
|
|
||||||
while (name)
|
|
||||||
{
|
|
||||||
GValue value = G_VALUE_INIT;
|
|
||||||
gchar *error = NULL;
|
|
||||||
GParamSpec *pspec;
|
|
||||||
|
|
||||||
pspec = clutter_container_class_find_child_property (klass, name);
|
|
||||||
if (!pspec)
|
|
||||||
{
|
|
||||||
g_warning ("%s: Containers of type '%s' have no child "
|
|
||||||
"property named '%s'",
|
|
||||||
G_STRLOC, G_OBJECT_TYPE_NAME (container), name);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(pspec->flags & G_PARAM_WRITABLE))
|
|
||||||
{
|
|
||||||
g_warning ("%s: Child property '%s' of the container '%s' "
|
|
||||||
"is not writable",
|
|
||||||
G_STRLOC, pspec->name, G_OBJECT_TYPE_NAME (container));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
G_VALUE_COLLECT_INIT (&value, G_PARAM_SPEC_VALUE_TYPE (pspec),
|
|
||||||
var_args, 0,
|
|
||||||
&error);
|
|
||||||
|
|
||||||
if (error)
|
|
||||||
{
|
|
||||||
/* we intentionally leak the GValue because it might
|
|
||||||
* be in an undefined state and calling g_value_unset()
|
|
||||||
* on it might crash
|
|
||||||
*/
|
|
||||||
g_warning ("%s: %s", G_STRLOC, error);
|
|
||||||
g_free (error);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
container_set_child_property (container, actor, &value, pspec);
|
|
||||||
|
|
||||||
g_value_unset (&value);
|
|
||||||
|
|
||||||
name = va_arg (var_args, gchar*);
|
|
||||||
}
|
|
||||||
|
|
||||||
va_end (var_args);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void
|
|
||||||
container_get_child_property (ClutterContainer *container,
|
|
||||||
ClutterActor *actor,
|
|
||||||
GValue *value,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
{
|
|
||||||
ClutterChildMeta *data;
|
|
||||||
|
|
||||||
data = clutter_container_get_child_meta (container, actor);
|
|
||||||
g_object_get_property (G_OBJECT (data), pspec->name, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* clutter_container_child_get_property:
|
|
||||||
* @container: a #ClutterContainer
|
|
||||||
* @child: a #ClutterActor that is a child of @container.
|
|
||||||
* @property: the name of the property to set.
|
|
||||||
* @value: the value.
|
|
||||||
*
|
|
||||||
* Gets a container specific property of a child of @container, In general,
|
|
||||||
* a copy is made of the property contents and the caller is responsible for
|
|
||||||
* freeing the memory by calling g_value_unset().
|
|
||||||
*
|
|
||||||
* Note that clutter_container_child_set_property() is really intended for
|
|
||||||
* language bindings, clutter_container_child_set() is much more convenient
|
|
||||||
* for C programming.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
clutter_container_child_get_property (ClutterContainer *container,
|
|
||||||
ClutterActor *child,
|
|
||||||
const gchar *property,
|
|
||||||
GValue *value)
|
|
||||||
{
|
|
||||||
GObjectClass *klass;
|
|
||||||
GParamSpec *pspec;
|
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
|
|
||||||
g_return_if_fail (CLUTTER_IS_ACTOR (child));
|
|
||||||
g_return_if_fail (property != NULL);
|
|
||||||
g_return_if_fail (value != NULL);
|
|
||||||
|
|
||||||
klass = G_OBJECT_GET_CLASS (container);
|
|
||||||
|
|
||||||
pspec = clutter_container_class_find_child_property (klass, property);
|
|
||||||
if (!pspec)
|
|
||||||
{
|
|
||||||
g_warning ("%s: Containers of type '%s' have no child "
|
|
||||||
"property named '%s'",
|
|
||||||
G_STRLOC, G_OBJECT_TYPE_NAME (container), property);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(pspec->flags & G_PARAM_READABLE))
|
|
||||||
{
|
|
||||||
g_warning ("%s: Child property '%s' of the container '%s' "
|
|
||||||
"is not writable",
|
|
||||||
G_STRLOC, pspec->name, G_OBJECT_TYPE_NAME (container));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
container_get_child_property (container, child, value, pspec);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* clutter_container_child_get:
|
|
||||||
* @container: a #ClutterContainer
|
|
||||||
* @actor: a #ClutterActor that is a child of @container.
|
|
||||||
* @first_prop: name of the first property to be set.
|
|
||||||
* @...: value for the first property, followed optionally by more name/value
|
|
||||||
* pairs terminated with NULL.
|
|
||||||
*
|
|
||||||
* Gets @container specific properties of an actor.
|
|
||||||
*
|
|
||||||
* In general, a copy is made of the property contents and the caller is
|
|
||||||
* responsible for freeing the memory in the appropriate manner for the type, for
|
|
||||||
* instance by calling g_free() or g_object_unref().
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
clutter_container_child_get (ClutterContainer *container,
|
|
||||||
ClutterActor *actor,
|
|
||||||
const gchar *first_prop,
|
|
||||||
...)
|
|
||||||
{
|
|
||||||
GObjectClass *klass;
|
|
||||||
const gchar *name;
|
|
||||||
va_list var_args;
|
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
|
|
||||||
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
|
|
||||||
|
|
||||||
klass = G_OBJECT_GET_CLASS (container);
|
|
||||||
|
|
||||||
va_start (var_args, first_prop);
|
|
||||||
|
|
||||||
name = first_prop;
|
|
||||||
while (name)
|
|
||||||
{
|
|
||||||
GValue value = G_VALUE_INIT;
|
|
||||||
gchar *error = NULL;
|
|
||||||
GParamSpec *pspec;
|
|
||||||
|
|
||||||
pspec = clutter_container_class_find_child_property (klass, name);
|
|
||||||
if (!pspec)
|
|
||||||
{
|
|
||||||
g_warning ("%s: container '%s' has no child property named '%s'",
|
|
||||||
G_STRLOC, G_OBJECT_TYPE_NAME (container), name);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(pspec->flags & G_PARAM_READABLE))
|
|
||||||
{
|
|
||||||
g_warning ("%s: child property '%s' of container '%s' is not readable",
|
|
||||||
G_STRLOC, pspec->name, G_OBJECT_TYPE_NAME (container));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec));
|
|
||||||
|
|
||||||
container_get_child_property (container, actor, &value, pspec);
|
|
||||||
|
|
||||||
G_VALUE_LCOPY (&value, var_args, 0, &error);
|
|
||||||
if (error)
|
|
||||||
{
|
|
||||||
g_warning ("%s: %s", G_STRLOC, error);
|
|
||||||
g_free (error);
|
|
||||||
g_value_unset (&value);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_value_unset (&value);
|
|
||||||
|
|
||||||
name = va_arg (var_args, gchar*);
|
|
||||||
}
|
|
||||||
|
|
||||||
va_end (var_args);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* clutter_container_child_notify:
|
|
||||||
* @container: a #ClutterContainer
|
|
||||||
* @child: a #ClutterActor
|
|
||||||
* @pspec: a #GParamSpec
|
|
||||||
*
|
|
||||||
* Calls the #ClutterContainerIface.child_notify() virtual function
|
|
||||||
* of #ClutterContainer. The default implementation will emit the
|
|
||||||
* #ClutterContainer::child-notify signal.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
clutter_container_child_notify (ClutterContainer *container,
|
|
||||||
ClutterActor *child,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
{
|
|
||||||
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
|
|
||||||
g_return_if_fail (CLUTTER_IS_ACTOR (child));
|
|
||||||
g_return_if_fail (pspec != NULL);
|
|
||||||
|
|
||||||
g_return_if_fail (clutter_actor_get_parent (child) == CLUTTER_ACTOR (container));
|
|
||||||
|
|
||||||
CLUTTER_CONTAINER_GET_IFACE (container)->child_notify (container,
|
|
||||||
child,
|
|
||||||
pspec);
|
|
||||||
}
|
|
@ -1,151 +0,0 @@
|
|||||||
/*
|
|
||||||
* Clutter.
|
|
||||||
*
|
|
||||||
* An OpenGL based 'interactive canvas' library.
|
|
||||||
*
|
|
||||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
|
||||||
*
|
|
||||||
* Copyright (C) 2006 OpenedHand
|
|
||||||
*
|
|
||||||
* 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 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, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* ClutterContainer: Generic actor container interface.
|
|
||||||
* Author: Emmanuele Bassi <ebassi@openedhand.com>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
|
||||||
#error "Only <clutter/clutter.h> can be included directly."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "clutter/clutter-actor.h"
|
|
||||||
#include "clutter/clutter-child-meta.h"
|
|
||||||
#include "clutter/clutter-types.h"
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define CLUTTER_TYPE_CONTAINER (clutter_container_get_type ())
|
|
||||||
#define CLUTTER_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_CONTAINER, ClutterContainer))
|
|
||||||
#define CLUTTER_IS_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_CONTAINER))
|
|
||||||
#define CLUTTER_CONTAINER_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CLUTTER_TYPE_CONTAINER, ClutterContainerIface))
|
|
||||||
|
|
||||||
typedef struct _ClutterContainerIface ClutterContainerIface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ClutterContainerIface:
|
|
||||||
* @add: virtual function for adding an actor to the container. This virtual
|
|
||||||
* function is deprecated, and it should not be overridden.
|
|
||||||
* @remove: virtual function for removing an actor from the container. This
|
|
||||||
* virtual function is deprecated, and it should not be overridden.
|
|
||||||
* @child_meta_type: The GType used for storing auxiliary information about
|
|
||||||
* each of the containers children.
|
|
||||||
* @create_child_meta: virtual function that gets called for each added
|
|
||||||
* child, the function should instantiate an object of type
|
|
||||||
* #ClutterContainerIface::child_meta_type, set the container and actor
|
|
||||||
* fields in the instance and add the record to a data structure for
|
|
||||||
* subsequent access for #ClutterContainerIface::get_child_meta
|
|
||||||
* @destroy_child_meta: virtual function that gets called when a child is
|
|
||||||
* removed; it should release all resources held by the record
|
|
||||||
* @get_child_meta: return the record for a container child
|
|
||||||
* @actor_added: class handler for #ClutterContainer::actor-added
|
|
||||||
* @actor_removed: class handler for #ClutterContainer::actor-removed
|
|
||||||
* @child_notify: class handler for #ClutterContainer::child-notify
|
|
||||||
*
|
|
||||||
* Base interface for container actors. The @add and @remove
|
|
||||||
* virtual functions must be provided by any implementation; the other
|
|
||||||
* virtual functions are optional.
|
|
||||||
*/
|
|
||||||
struct _ClutterContainerIface
|
|
||||||
{
|
|
||||||
/*< private >*/
|
|
||||||
GTypeInterface g_iface;
|
|
||||||
|
|
||||||
/*< public >*/
|
|
||||||
void (* add) (ClutterContainer *container,
|
|
||||||
ClutterActor *actor);
|
|
||||||
void (* remove) (ClutterContainer *container,
|
|
||||||
ClutterActor *actor);
|
|
||||||
|
|
||||||
/* ClutterChildMeta management */
|
|
||||||
GType child_meta_type;
|
|
||||||
void (* create_child_meta) (ClutterContainer *container,
|
|
||||||
ClutterActor *actor);
|
|
||||||
void (* destroy_child_meta) (ClutterContainer *container,
|
|
||||||
ClutterActor *actor);
|
|
||||||
ClutterChildMeta *(* get_child_meta) (ClutterContainer *container,
|
|
||||||
ClutterActor *actor);
|
|
||||||
|
|
||||||
/* signals */
|
|
||||||
void (* actor_added) (ClutterContainer *container,
|
|
||||||
ClutterActor *actor);
|
|
||||||
void (* actor_removed) (ClutterContainer *container,
|
|
||||||
ClutterActor *actor);
|
|
||||||
|
|
||||||
void (* child_notify) (ClutterContainer *container,
|
|
||||||
ClutterActor *child,
|
|
||||||
GParamSpec *pspec);
|
|
||||||
};
|
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
GType clutter_container_get_type (void) G_GNUC_CONST;
|
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
ClutterActor * clutter_container_find_child_by_name (ClutterContainer *container,
|
|
||||||
const gchar *child_name);
|
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
GParamSpec * clutter_container_class_find_child_property (GObjectClass *klass,
|
|
||||||
const gchar *property_name);
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
GParamSpec ** clutter_container_class_list_child_properties (GObjectClass *klass,
|
|
||||||
guint *n_properties);
|
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
void clutter_container_create_child_meta (ClutterContainer *container,
|
|
||||||
ClutterActor *actor);
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
void clutter_container_destroy_child_meta (ClutterContainer *container,
|
|
||||||
ClutterActor *actor);
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
ClutterChildMeta * clutter_container_get_child_meta (ClutterContainer *container,
|
|
||||||
ClutterActor *actor);
|
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
void clutter_container_child_set_property (ClutterContainer *container,
|
|
||||||
ClutterActor *child,
|
|
||||||
const gchar * property,
|
|
||||||
const GValue *value);
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
void clutter_container_child_get_property (ClutterContainer *container,
|
|
||||||
ClutterActor *child,
|
|
||||||
const gchar *property,
|
|
||||||
GValue *value);
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
void clutter_container_child_set (ClutterContainer *container,
|
|
||||||
ClutterActor *actor,
|
|
||||||
const gchar *first_prop,
|
|
||||||
...) G_GNUC_NULL_TERMINATED;
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
void clutter_container_child_get (ClutterContainer *container,
|
|
||||||
ClutterActor *actor,
|
|
||||||
const gchar *first_prop,
|
|
||||||
...) G_GNUC_NULL_TERMINATED;
|
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
void clutter_container_child_notify (ClutterContainer *container,
|
|
||||||
ClutterActor *child,
|
|
||||||
GParamSpec *pspec);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
@ -1,8 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#define __CLUTTER_DEPRECATED_H_INSIDE__
|
|
||||||
|
|
||||||
#include "clutter/deprecated/clutter-container.h"
|
|
||||||
|
|
||||||
#undef __CLUTTER_DEPRECATED_H_INSIDE__
|
|
||||||
|
|
@ -1322,18 +1322,3 @@ _clutter_diagnostic_enabled (void)
|
|||||||
|
|
||||||
return *clutter_enable_diagnostic != '0';
|
return *clutter_enable_diagnostic != '0';
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
_clutter_diagnostic_message (const char *format, ...)
|
|
||||||
{
|
|
||||||
va_list args;
|
|
||||||
char *fmt;
|
|
||||||
|
|
||||||
fmt = g_strconcat ("[DIAGNOSTIC]: ", format, NULL);
|
|
||||||
|
|
||||||
va_start (args, format);
|
|
||||||
g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, fmt, args);
|
|
||||||
va_end (args);
|
|
||||||
|
|
||||||
g_free (fmt);
|
|
||||||
}
|
|
||||||
|
@ -166,7 +166,6 @@ gboolean _clutter_context_get_show_fps (void);
|
|||||||
|
|
||||||
/* Diagnostic mode */
|
/* Diagnostic mode */
|
||||||
gboolean _clutter_diagnostic_enabled (void);
|
gboolean _clutter_diagnostic_enabled (void);
|
||||||
void _clutter_diagnostic_message (const char *fmt, ...) G_GNUC_PRINTF (1, 2);
|
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void _clutter_set_sync_to_vblank (gboolean sync_to_vblank);
|
void _clutter_set_sync_to_vblank (gboolean sync_to_vblank);
|
||||||
|
@ -33,7 +33,6 @@
|
|||||||
#include <gmodule.h>
|
#include <gmodule.h>
|
||||||
|
|
||||||
#include "clutter/clutter-actor.h"
|
#include "clutter/clutter-actor.h"
|
||||||
#include "clutter/clutter-container.h"
|
|
||||||
#include "clutter/clutter-debug.h"
|
#include "clutter/clutter-debug.h"
|
||||||
#include "clutter/clutter-enum-types.h"
|
#include "clutter/clutter-enum-types.h"
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* ClutterScript:
|
* ClutterScript:
|
||||||
*
|
*
|
||||||
* Loads a scene from UI definition data
|
* Loads a scene from UI definition data
|
||||||
*
|
*
|
||||||
* #ClutterScript is an object used for loading and building parts or a
|
* #ClutterScript is an object used for loading and building parts or a
|
||||||
@ -140,8 +140,6 @@
|
|||||||
#include "clutter/clutter-private.h"
|
#include "clutter/clutter-private.h"
|
||||||
#include "clutter/clutter-debug.h"
|
#include "clutter/clutter-debug.h"
|
||||||
|
|
||||||
#include "clutter/deprecated/clutter-container.h"
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
PROP_0,
|
PROP_0,
|
||||||
@ -586,7 +584,7 @@ clutter_script_get_objects_valist (ClutterScript *script,
|
|||||||
while (name)
|
while (name)
|
||||||
{
|
{
|
||||||
GObject **obj = NULL;
|
GObject **obj = NULL;
|
||||||
|
|
||||||
obj = va_arg (args, GObject**);
|
obj = va_arg (args, GObject**);
|
||||||
|
|
||||||
*obj = clutter_script_get_object (script, name);
|
*obj = clutter_script_get_object (script, name);
|
||||||
@ -749,7 +747,7 @@ clutter_script_ensure_objects (ClutterScript *script)
|
|||||||
* @script: a #ClutterScript
|
* @script: a #ClutterScript
|
||||||
* @type_name: name of the type to look up
|
* @type_name: name of the type to look up
|
||||||
*
|
*
|
||||||
* Looks up a type by name, using the virtual function that
|
* Looks up a type by name, using the virtual function that
|
||||||
* #ClutterScript has for that purpose. This function should
|
* #ClutterScript has for that purpose. This function should
|
||||||
* rarely be used.
|
* rarely be used.
|
||||||
*
|
*
|
||||||
@ -853,7 +851,7 @@ clutter_script_default_connect (ClutterScript *script,
|
|||||||
* This method invokes [method@Script.connect_signals_full] internally
|
* This method invokes [method@Script.connect_signals_full] internally
|
||||||
* and uses #GModule's introspective features (by opening the current
|
* and uses #GModule's introspective features (by opening the current
|
||||||
* module's scope) to look at the application's symbol table.
|
* module's scope) to look at the application's symbol table.
|
||||||
*
|
*
|
||||||
* Note that this function will not work if #GModule is not supported by
|
* Note that this function will not work if #GModule is not supported by
|
||||||
* the platform Clutter is running on.
|
* the platform Clutter is running on.
|
||||||
*/
|
*/
|
||||||
@ -1093,14 +1091,14 @@ clutter_script_lookup_filename (ClutterScript *script,
|
|||||||
dirname = g_path_get_dirname (script->priv->filename);
|
dirname = g_path_get_dirname (script->priv->filename);
|
||||||
else
|
else
|
||||||
dirname = g_get_current_dir ();
|
dirname = g_get_current_dir ();
|
||||||
|
|
||||||
retval = g_build_filename (dirname, filename, NULL);
|
retval = g_build_filename (dirname, filename, NULL);
|
||||||
if (!g_file_test (retval, G_FILE_TEST_EXISTS))
|
if (!g_file_test (retval, G_FILE_TEST_EXISTS))
|
||||||
{
|
{
|
||||||
g_free (retval);
|
g_free (retval);
|
||||||
retval = NULL;
|
retval = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (dirname);
|
g_free (dirname);
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
|
@ -46,8 +46,6 @@ typedef struct _ClutterActor ClutterActor;
|
|||||||
typedef struct _ClutterStage ClutterStage;
|
typedef struct _ClutterStage ClutterStage;
|
||||||
typedef struct _ClutterFrame ClutterFrame;
|
typedef struct _ClutterFrame ClutterFrame;
|
||||||
typedef struct _ClutterFrameInfo ClutterFrameInfo;
|
typedef struct _ClutterFrameInfo ClutterFrameInfo;
|
||||||
typedef struct _ClutterContainer ClutterContainer; /* dummy */
|
|
||||||
typedef struct _ClutterChildMeta ClutterChildMeta;
|
|
||||||
typedef struct _ClutterLayoutMeta ClutterLayoutMeta;
|
typedef struct _ClutterLayoutMeta ClutterLayoutMeta;
|
||||||
typedef struct _ClutterActorMeta ClutterActorMeta;
|
typedef struct _ClutterActorMeta ClutterActorMeta;
|
||||||
typedef struct _ClutterLayoutManager ClutterLayoutManager;
|
typedef struct _ClutterLayoutManager ClutterLayoutManager;
|
||||||
@ -102,7 +100,7 @@ typedef struct _ClutterEventSequence ClutterEventSequence;
|
|||||||
/**
|
/**
|
||||||
* ClutterPaintVolume:
|
* ClutterPaintVolume:
|
||||||
*
|
*
|
||||||
* A #ClutterPaintVolume represents a bounding volume whose internal
|
* A #ClutterPaintVolume represents a bounding volume whose internal
|
||||||
* representation isn't defined but can be set and queried in terms
|
* representation isn't defined but can be set and queried in terms
|
||||||
* of an axis aligned bounding box.
|
* of an axis aligned bounding box.
|
||||||
*
|
*
|
||||||
@ -121,8 +119,8 @@ typedef struct _ClutterPaintVolume ClutterPaintVolume;
|
|||||||
* @x2: X coordinate of the bottom right corner
|
* @x2: X coordinate of the bottom right corner
|
||||||
* @y2: Y coordinate of the bottom right corner
|
* @y2: Y coordinate of the bottom right corner
|
||||||
*
|
*
|
||||||
* Bounding box of an actor.
|
* Bounding box of an actor.
|
||||||
*
|
*
|
||||||
* The coordinates of the top left and right bottom corners
|
* The coordinates of the top left and right bottom corners
|
||||||
* of an actor. The coordinates of the two points are expressed in
|
* of an actor. The coordinates of the two points are expressed in
|
||||||
* pixels with sub-pixel precision
|
* pixels with sub-pixel precision
|
||||||
|
@ -50,7 +50,6 @@
|
|||||||
#include "clutter/clutter-color-static.h"
|
#include "clutter/clutter-color-static.h"
|
||||||
#include "clutter/clutter-colorize-effect.h"
|
#include "clutter/clutter-colorize-effect.h"
|
||||||
#include "clutter/clutter-constraint.h"
|
#include "clutter/clutter-constraint.h"
|
||||||
#include "clutter/clutter-container.h"
|
|
||||||
#include "clutter/clutter-content.h"
|
#include "clutter/clutter-content.h"
|
||||||
#include "clutter/clutter-deform-effect.h"
|
#include "clutter/clutter-deform-effect.h"
|
||||||
#include "clutter/clutter-desaturate-effect.h"
|
#include "clutter/clutter-desaturate-effect.h"
|
||||||
@ -109,8 +108,6 @@
|
|||||||
#include "clutter/clutter-virtual-input-device.h"
|
#include "clutter/clutter-virtual-input-device.h"
|
||||||
#include "clutter/clutter-zoom-action.h"
|
#include "clutter/clutter-zoom-action.h"
|
||||||
|
|
||||||
#include "clutter/clutter-deprecated.h"
|
|
||||||
|
|
||||||
#include "clutter/clutter-autocleanups.h"
|
#include "clutter/clutter-autocleanups.h"
|
||||||
|
|
||||||
#undef __CLUTTER_H_INSIDE__
|
#undef __CLUTTER_H_INSIDE__
|
||||||
|
@ -1,54 +0,0 @@
|
|||||||
/*
|
|
||||||
* Clutter.
|
|
||||||
*
|
|
||||||
* An OpenGL based 'interactive canvas' library.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2011 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 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, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* ClutterContainer: Generic actor container interface.
|
|
||||||
*
|
|
||||||
* Author: Emmanuele Bassi <ebassi@linux.intel.com>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
|
||||||
#error "Only <clutter/clutter.h> can be included directly."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "clutter/clutter-container.h"
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
CLUTTER_DEPRECATED_FOR(clutter_actor_add_child)
|
|
||||||
void clutter_container_add (ClutterContainer *container,
|
|
||||||
ClutterActor *first_actor,
|
|
||||||
...) G_GNUC_NULL_TERMINATED;
|
|
||||||
|
|
||||||
CLUTTER_DEPRECATED_FOR(clutter_actor_add_child)
|
|
||||||
void clutter_container_add_actor (ClutterContainer *container,
|
|
||||||
ClutterActor *actor);
|
|
||||||
|
|
||||||
CLUTTER_DEPRECATED_FOR(clutter_actor_remove_child)
|
|
||||||
void clutter_container_remove (ClutterContainer *container,
|
|
||||||
ClutterActor *first_actor,
|
|
||||||
...) G_GNUC_NULL_TERMINATED;
|
|
||||||
|
|
||||||
CLUTTER_DEPRECATED_FOR(clutter_actor_remove_child)
|
|
||||||
void clutter_container_remove_actor (ClutterContainer *container,
|
|
||||||
ClutterActor *actor);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
@ -25,10 +25,8 @@ clutter_headers = [
|
|||||||
'clutter-color.h',
|
'clutter-color.h',
|
||||||
'clutter-colorize-effect.h',
|
'clutter-colorize-effect.h',
|
||||||
'clutter-constraint.h',
|
'clutter-constraint.h',
|
||||||
'clutter-container.h',
|
|
||||||
'clutter-content.h',
|
'clutter-content.h',
|
||||||
'clutter-deform-effect.h',
|
'clutter-deform-effect.h',
|
||||||
'clutter-deprecated.h',
|
|
||||||
'clutter-desaturate-effect.h',
|
'clutter-desaturate-effect.h',
|
||||||
'clutter-effect.h',
|
'clutter-effect.h',
|
||||||
'clutter-enums.h',
|
'clutter-enums.h',
|
||||||
@ -117,7 +115,6 @@ clutter_sources = [
|
|||||||
'clutter-color-state.c',
|
'clutter-color-state.c',
|
||||||
'clutter-colorize-effect.c',
|
'clutter-colorize-effect.c',
|
||||||
'clutter-constraint.c',
|
'clutter-constraint.c',
|
||||||
'clutter-container.c',
|
|
||||||
'clutter-content.c',
|
'clutter-content.c',
|
||||||
'clutter-damage-history.c',
|
'clutter-damage-history.c',
|
||||||
'clutter-deform-effect.c',
|
'clutter-deform-effect.c',
|
||||||
@ -227,10 +224,6 @@ clutter_nonintrospected_sources = [
|
|||||||
'clutter-easing.c',
|
'clutter-easing.c',
|
||||||
]
|
]
|
||||||
|
|
||||||
clutter_deprecated_headers = [
|
|
||||||
'deprecated/clutter-container.h',
|
|
||||||
]
|
|
||||||
|
|
||||||
clutter_backend_private_headers = []
|
clutter_backend_private_headers = []
|
||||||
|
|
||||||
cally_headers = [
|
cally_headers = [
|
||||||
@ -278,7 +271,7 @@ clutter_build_config_h = configure_file(
|
|||||||
clutter_built_private_headers += clutter_build_config_h
|
clutter_built_private_headers += clutter_build_config_h
|
||||||
|
|
||||||
clutter_enum_types = gnome.mkenums('clutter-enum-types',
|
clutter_enum_types = gnome.mkenums('clutter-enum-types',
|
||||||
sources: [clutter_headers, clutter_deprecated_headers],
|
sources: clutter_headers,
|
||||||
c_template: 'clutter-enum-types.c.in',
|
c_template: 'clutter-enum-types.c.in',
|
||||||
h_template: 'clutter-enum-types.h.in',
|
h_template: 'clutter-enum-types.h.in',
|
||||||
install_dir: clutter_clutter_includedir,
|
install_dir: clutter_clutter_includedir,
|
||||||
@ -305,7 +298,6 @@ libmutter_clutter = shared_library(libmutter_clutter_name,
|
|||||||
clutter_headers,
|
clutter_headers,
|
||||||
clutter_private_headers,
|
clutter_private_headers,
|
||||||
clutter_nonintrospected_sources,
|
clutter_nonintrospected_sources,
|
||||||
clutter_deprecated_headers,
|
|
||||||
clutter_built_sources,
|
clutter_built_sources,
|
||||||
clutter_built_headers,
|
clutter_built_headers,
|
||||||
cally_sources,
|
cally_sources,
|
||||||
@ -346,7 +338,6 @@ if have_introspection
|
|||||||
clutter_built_headers,
|
clutter_built_headers,
|
||||||
clutter_sources,
|
clutter_sources,
|
||||||
clutter_headers,
|
clutter_headers,
|
||||||
clutter_deprecated_headers,
|
|
||||||
],
|
],
|
||||||
nsversion: libmutter_api_version,
|
nsversion: libmutter_api_version,
|
||||||
namespace: 'Clutter',
|
namespace: 'Clutter',
|
||||||
@ -396,9 +387,6 @@ install_headers(clutter_headers,
|
|||||||
install_headers(cally_headers,
|
install_headers(cally_headers,
|
||||||
subdir: clutter_includesubdir / 'cally')
|
subdir: clutter_includesubdir / 'cally')
|
||||||
|
|
||||||
install_headers(clutter_deprecated_headers,
|
|
||||||
subdir: clutter_clutter_includesubdir / 'deprecated')
|
|
||||||
|
|
||||||
pkg.generate(libmutter_clutter,
|
pkg.generate(libmutter_clutter,
|
||||||
name: 'Mutters Clutter',
|
name: 'Mutters Clutter',
|
||||||
filebase: libmutter_clutter_name,
|
filebase: libmutter_clutter_name,
|
||||||
|
Loading…
Reference in New Issue
Block a user