/** * clutter_container_remove_actor: * @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. * * Since: 0.4 */ void clutter_container_remove_actor (ClutterContainer *container, ClutterActor *actor) { ClutterContainerIface *iface; ClutterActor *parent; g_return_if_fail (CLUTTER_IS_CONTAINER (container)); g_return_if_fail (CLUTTER_IS_ACTOR (actor)); iface = CLUTTER_CONTAINER_GET_IFACE (container); if (!iface->remove) { CLUTTER_CONTAINER_WARN_NOT_IMPLEMENTED (container, "remove"); return; } 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); iface->remove (container, actor); }
/** * clutter_container_foreach_with_internals: * @container: a #ClutterContainer * @callback: (scope call): a function to be called for each child * @user_data: data to be passed to the function, or %NULL * * Calls @callback for each child of @container, including "internal" * children built in to the container itself that were never added * by the application. * * This function calls the #ClutterContainerIface.foreach_with_internals() * virtual function, which has been deprecated. * * Since: 1.0 * * Deprecated: 1.10: See clutter_container_foreach(). */ void clutter_container_foreach_with_internals (ClutterContainer *container, ClutterCallback callback, gpointer user_data) { ClutterContainerIface *iface; g_return_if_fail (CLUTTER_IS_CONTAINER (container)); g_return_if_fail (callback != NULL); iface = CLUTTER_CONTAINER_GET_IFACE (container); #ifdef CLUTTER_ENABLE_DEBUG if (G_UNLIKELY (_clutter_diagnostic_enabled ())) { if (iface->foreach_with_internals != NULL) _clutter_diagnostic_message ("The ClutterContainer::foreach_with_internals() " "virtual function has been deprecated " "and it should not be overridden by " "newly written code"); } #endif /* CLUTTER_ENABLE_DEBUG */ if (iface->foreach_with_internals != NULL) iface->foreach_with_internals (container, callback, user_data); else iface->foreach (container, callback, user_data); }
/** * clutter_container_add_actor: * @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. * * Since: 0.4 */ void clutter_container_add_actor (ClutterContainer *container, ClutterActor *actor) { ClutterContainerIface *iface; ClutterActor *parent; g_return_if_fail (CLUTTER_IS_CONTAINER (container)); g_return_if_fail (CLUTTER_IS_ACTOR (actor)); iface = CLUTTER_CONTAINER_GET_IFACE (container); if (!iface->add) { CLUTTER_CONTAINER_WARN_NOT_IMPLEMENTED (container, "add"); return; } parent = clutter_actor_get_parent (actor); if (parent) { 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); iface->add (container, actor); }
/** * clutter_container_sort_depth_order: * @container: a #ClutterContainer * * Sorts a container's children using their depth. This function should not * be normally used by applications. * * Since: 0.6 */ void clutter_container_sort_depth_order (ClutterContainer *container) { ClutterContainerIface *iface; g_return_if_fail (CLUTTER_IS_CONTAINER (container)); iface = CLUTTER_CONTAINER_GET_IFACE (container); if (iface->sort_depth_order) iface->sort_depth_order (container); else CLUTTER_CONTAINER_NOTE_NOT_IMPLEMENTED (container, "sort_depth_order"); }
/** * clutter_container_lower_child: (virtual lower) * @container: a #ClutterContainer * @actor: the actor to raise * @sibling: (allow-none): the sibling to lower to, or %NULL to lower * to the bottom * * Lowers @actor to @sibling level, in the depth ordering. * * This function calls the #ClutterContainerIface.lower() virtual function, * which has been deprecated. The default implementation will call * clutter_actor_set_child_below_sibling(). * * Since: 0.6 * * Deprecated: 1.10: Use clutter_actor_set_child_below_sibling() instead. */ void clutter_container_lower_child (ClutterContainer *container, ClutterActor *actor, ClutterActor *sibling) { ClutterContainerIface *iface; ClutterActor *self; g_return_if_fail (CLUTTER_IS_CONTAINER (container)); g_return_if_fail (CLUTTER_IS_ACTOR (actor)); g_return_if_fail (sibling == NULL || CLUTTER_IS_ACTOR (sibling)); if (actor == sibling) return; self = CLUTTER_ACTOR (container); if (clutter_actor_get_parent (actor) != self) { g_warning ("Actor of type '%s' is not a child of the container " "of type '%s'", g_type_name (G_OBJECT_TYPE (actor)), g_type_name (G_OBJECT_TYPE (container))); return; } if (sibling != NULL&& clutter_actor_get_parent (sibling) != self) { g_warning ("Actor of type '%s' is not a child of the container " "of type '%s'", g_type_name (G_OBJECT_TYPE (sibling)), g_type_name (G_OBJECT_TYPE (container))); return; } iface = CLUTTER_CONTAINER_GET_IFACE (container); #ifdef CLUTTER_ENABLE_DEBUG if (G_UNLIKELY (_clutter_diagnostic_enabled ())) { if (iface->lower != container_real_lower) _clutter_diagnostic_message ("The ClutterContainer::lower() " "virtual function has been deprecated " "and it should not be overridden by " "newly written code"); } #endif /* CLUTTER_ENABLE_DEBUG */ iface->lower (container, actor, sibling); }
/** * 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 specifiec actor does not exist or the * container is not configured to provide #ClutterChildMeta<!-- -->s * * Since: 0.8 */ 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; }
static inline void container_set_child_property (ClutterContainer *container, ClutterActor *actor, const GValue *value, GParamSpec *pspec) { ClutterChildMeta *data; ClutterContainerIface *iface; data = clutter_container_get_child_meta (container, actor); g_object_set_property (G_OBJECT (data), pspec->name, value); iface = CLUTTER_CONTAINER_GET_IFACE (container); if (G_LIKELY (iface->child_notify)) iface->child_notify (container, actor, pspec); }
/** * 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. * * Since: 1.2 */ 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_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. * * Since: 1.2 */ 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_foreach: * @container: a #ClutterContainer * @callback: a function to be called for each child * @user_data: data to be passed to the function, or %NULL * * Calls @callback for each child of @container that was added * by the application (with clutter_container_add_actor()). Does * not iterate over "internal" children that are part of the * container's own implementation, if any. * * Since: 0.4 */ void clutter_container_foreach (ClutterContainer *container, ClutterCallback callback, gpointer user_data) { ClutterContainerIface *iface; g_return_if_fail (CLUTTER_IS_CONTAINER (container)); g_return_if_fail (callback != NULL); iface = CLUTTER_CONTAINER_GET_IFACE (container); if (!iface->foreach) { CLUTTER_CONTAINER_WARN_NOT_IMPLEMENTED (container, "foreach"); return; } iface->foreach (container, callback, user_data); }
/** * clutter_container_lower_child: * @container: a #ClutterContainer * @actor: the actor to raise * @sibling: the sibling to lower to, or %NULL to lower to the bottom * * Lowers @actor to @sibling level, in the depth ordering. * * Since: 0.6 */ void clutter_container_lower_child (ClutterContainer *container, ClutterActor *actor, ClutterActor *sibling) { ClutterContainerIface *iface; g_return_if_fail (CLUTTER_IS_CONTAINER (container)); g_return_if_fail (CLUTTER_IS_ACTOR (actor)); g_return_if_fail (sibling == NULL || CLUTTER_IS_ACTOR (sibling)); iface = CLUTTER_CONTAINER_GET_IFACE (container); if (!iface->lower) { CLUTTER_CONTAINER_NOTE_NOT_IMPLEMENTED (container, "lower"); return; } if (actor == sibling) return; if (clutter_actor_get_parent (actor) != CLUTTER_ACTOR (container)) { g_warning ("Actor of type '%s' is not a child of the container " "of type '%s'", g_type_name (G_OBJECT_TYPE (actor)), g_type_name (G_OBJECT_TYPE (container))); return; } if (sibling && clutter_actor_get_parent (sibling) != CLUTTER_ACTOR (container)) { g_warning ("Actor of type '%s' is not a child of the container " "of type '%s'", g_type_name (G_OBJECT_TYPE (sibling)), g_type_name (G_OBJECT_TYPE (container))); return; } iface->lower (container, actor, sibling); }
/** * clutter_container_sort_depth_order: * @container: a #ClutterContainer * * Sorts a container's children using their depth. This function should not * be normally used by applications. * * Since: 0.6 * * Deprecated: 1.10: The #ClutterContainerIface.sort_depth_order() virtual * function should not be used any more; the default implementation in * #ClutterContainer does not do anything. */ void clutter_container_sort_depth_order (ClutterContainer *container) { ClutterContainerIface *iface; g_return_if_fail (CLUTTER_IS_CONTAINER (container)); iface = CLUTTER_CONTAINER_GET_IFACE (container); #ifdef CLUTTER_ENABLE_DEBUG if (G_UNLIKELY (_clutter_diagnostic_enabled ())) { if (iface->sort_depth_order != container_real_sort_depth_order) _clutter_diagnostic_message ("The ClutterContainer::sort_depth_order() " "virtual function has been deprecated " "and it should not be overridden by " "newly written code"); } #endif /* CLUTTER_ENABLE_DEBUG */ iface->sort_depth_order (container); }