From 156aa3dd998f01c2bf4ef115876e416f5a51a919 Mon Sep 17 00:00:00 2001 From: Niels De Graef Date: Sat, 17 Nov 2018 15:27:01 +0100 Subject: [PATCH] Clutter: remove deprecated ClutterBox --- clutter/clutter/Makefile.am | 2 - clutter/clutter/clutter-deprecated.h | 1 - clutter/clutter/deprecated/clutter-box.c | 745 ------------------ clutter/clutter/deprecated/clutter-box.h | 143 ---- clutter/clutter/meson.build | 2 - clutter/tests/conform/script-parser.c | 17 +- .../scripts/test-script-layout-property.json | 2 +- .../scripts/test-script-named-object.json | 9 +- .../scripts/test-script-object-property.json | 4 +- clutter/tests/interactive/test-swipe-action.c | 32 +- .../tests/interactive/test-texture-material.c | 3 +- 11 files changed, 29 insertions(+), 931 deletions(-) delete mode 100644 clutter/clutter/deprecated/clutter-box.c delete mode 100644 clutter/clutter/deprecated/clutter-box.h diff --git a/clutter/clutter/Makefile.am b/clutter/clutter/Makefile.am index 25b06acaf..6d96a4a1c 100644 --- a/clutter/clutter/Makefile.am +++ b/clutter/clutter/Makefile.am @@ -267,7 +267,6 @@ deprecated_h = \ deprecated/clutter-behaviour-rotate.h \ deprecated/clutter-behaviour-scale.h \ deprecated/clutter-bin-layout.h \ - deprecated/clutter-box.h \ deprecated/clutter-cairo-texture.h \ deprecated/clutter-container.h \ deprecated/clutter-input-device.h \ @@ -295,7 +294,6 @@ deprecated_c = \ deprecated/clutter-behaviour-path.c \ deprecated/clutter-behaviour-rotate.c \ deprecated/clutter-behaviour-scale.c \ - deprecated/clutter-box.c \ deprecated/clutter-cairo-texture.c \ deprecated/clutter-input-device-deprecated.c \ deprecated/clutter-layout-manager-deprecated.c \ diff --git a/clutter/clutter/clutter-deprecated.h b/clutter/clutter/clutter-deprecated.h index 23e5a1ae7..558617ff5 100644 --- a/clutter/clutter/clutter-deprecated.h +++ b/clutter/clutter/clutter-deprecated.h @@ -17,7 +17,6 @@ #include "deprecated/clutter-behaviour-rotate.h" #include "deprecated/clutter-behaviour-scale.h" #include "deprecated/clutter-bin-layout.h" -#include "deprecated/clutter-box.h" #include "deprecated/clutter-cairo-texture.h" #include "deprecated/clutter-container.h" #include "deprecated/clutter-input-device.h" diff --git a/clutter/clutter/deprecated/clutter-box.c b/clutter/clutter/deprecated/clutter-box.c deleted file mode 100644 index b60f35fe5..000000000 --- a/clutter/clutter/deprecated/clutter-box.c +++ /dev/null @@ -1,745 +0,0 @@ -/* - * Clutter. - * - * An OpenGL based 'interactive canvas' library. - * - * Copyright (C) 2009,2010 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 . - * - * Author: - * Emmanuele Bassi - */ - -/** - * SECTION:clutter-box - * @short_description: A Generic layout container - * - * #ClutterBox is a #ClutterActor sub-class implementing the #ClutterContainer - * interface. A Box delegates the whole size requisition and size allocation to - * a #ClutterLayoutManager instance. - * - * #ClutterBox is available since Clutter 1.2 - * - * #ClutterBox is deprecated since Clutter 1.10; all its relevant API is provided - * by #ClutterActor, via the #ClutterActor:layout-manager property. - * - * ## Using ClutterBox - * - * The following code shows how to create a #ClutterBox with - * a #ClutterLayoutManager sub-class, and how to add children to - * it via clutter_box_pack(). - * - * |[ - * ClutterActor *box; - * ClutterLayoutManager *layout; - * - * // Create the layout manager first - * layout = clutter_box_layout_new (); - * clutter_box_layout_set_homogeneous (CLUTTER_BOX_LAYOUT (layout), TRUE); - * clutter_box_layout_set_spacing (CLUTTER_BOX_LAYOUT (layout), 12); - * - * // Then create the ClutterBox actor. The Box will take - * // ownership of the ClutterLayoutManager instance by sinking - * // its floating reference - * box = clutter_box_new (layout); - * - * // Now add children to the Box using the variadic arguments - * // function clutter_box_pack() to set layout properties - * clutter_box_pack (CLUTTER_BOX (box), actor, - * "x-align", CLUTTER_BOX_ALIGNMENT_CENTER, - * "y-align", CLUTTER_BOX_ALIGNMENT_END, - * "expand", TRUE, - * NULL); - * ]| - * - * #ClutterBox's clutter_box_pack() wraps the generic - * clutter_container_add_actor() function, but it also allows setting - * layout properties while adding the new child to the box. - */ - -#include "clutter-build-config.h" - -#include -#include - -#define CLUTTER_DISABLE_DEPRECATION_WARNINGS -#include "deprecated/clutter-container.h" - -#include "clutter-box.h" - -#include "clutter-actor-private.h" -#include "clutter-color.h" -#include "clutter-debug.h" -#include "clutter-enum-types.h" -#include "clutter-marshal.h" -#include "clutter-private.h" - -struct _ClutterBoxPrivate -{ - ClutterLayoutManager *manager; - - guint changed_id; -}; - -enum -{ - PROP_0, - - PROP_COLOR, - PROP_COLOR_SET, - - PROP_LAST -}; - -static GParamSpec *obj_props[PROP_LAST] = { NULL, }; - -static const ClutterColor default_box_color = { 255, 255, 255, 255 }; - -G_DEFINE_TYPE_WITH_PRIVATE (ClutterBox, clutter_box, CLUTTER_TYPE_ACTOR) - -static inline void -clutter_box_set_color_internal (ClutterBox *box, - const ClutterColor *color) -{ - clutter_actor_set_background_color (CLUTTER_ACTOR (box), color); - - g_object_notify_by_pspec (G_OBJECT (box), obj_props[PROP_COLOR_SET]); - g_object_notify_by_pspec (G_OBJECT (box), obj_props[PROP_COLOR]); -} - -static gboolean -clutter_box_real_get_paint_volume (ClutterActor *actor, - ClutterPaintVolume *volume) -{ - gboolean retval = FALSE; - ClutterActorIter iter; - ClutterActor *child; - - /* if we have a background color, and an allocation, then we need to - * set it as the base of our paint volume - */ - retval = clutter_paint_volume_set_from_allocation (volume, actor); - - /* bail out early if we don't have any child */ - if (clutter_actor_get_n_children (actor) == 0) - return retval; - - retval = TRUE; - - /* otherwise, union the paint volumes of our children, in case - * any one of them decides to paint outside the parent's allocation - */ - clutter_actor_iter_init (&iter, actor); - while (clutter_actor_iter_next (&iter, &child)) - { - const ClutterPaintVolume *child_volume; - - /* This gets the paint volume of the child transformed into the - * group's coordinate space... */ - child_volume = clutter_actor_get_transformed_paint_volume (child, actor); - if (!child_volume) - return FALSE; - - clutter_paint_volume_union (volume, child_volume); - } - - return retval; -} - -static void -clutter_box_set_property (GObject *gobject, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - ClutterBox *self = CLUTTER_BOX (gobject); - - switch (prop_id) - { - case PROP_COLOR: - clutter_box_set_color_internal (self, clutter_value_get_color (value)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); - break; - } -} - -static void -clutter_box_get_property (GObject *gobject, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - switch (prop_id) - { - case PROP_COLOR: - { - ClutterColor color; - - clutter_actor_get_background_color (CLUTTER_ACTOR (gobject), - &color); - clutter_value_set_color (value, &color); - } - break; - - case PROP_COLOR_SET: - { - gboolean color_set; - - g_object_get (gobject, "background-color-set", &color_set, NULL); - g_value_set_boolean (value, color_set); - } - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); - break; - } -} - -static void -clutter_box_real_destroy (ClutterActor *actor) -{ - ClutterActor *iter; - - iter = clutter_actor_get_first_child (actor); - while (iter != NULL) - { - ClutterActor *next = clutter_actor_get_next_sibling (iter); - - clutter_actor_destroy (iter); - - iter = next; - } -} - -static void -clutter_box_class_init (ClutterBoxClass *klass) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass); - - actor_class->destroy = clutter_box_real_destroy; - actor_class->get_paint_volume = clutter_box_real_get_paint_volume; - - gobject_class->set_property = clutter_box_set_property; - gobject_class->get_property = clutter_box_get_property; - - /** - * ClutterBox:color: - * - * The color to be used to paint the background of the - * #ClutterBox. Setting this property will set the - * #ClutterBox:color-set property as a side effect - * - * This property sets the #ClutterActor:background-color property - * internally. - * - * Since: 1.2 - * - * Deprecated: 1.10: Use the #ClutterActor:background-color property - */ - obj_props[PROP_COLOR] = - clutter_param_spec_color ("color", - P_("Color"), - P_("The background color of the box"), - &default_box_color, - CLUTTER_PARAM_READWRITE); - - /** - * ClutterBox:color-set: - * - * Whether the #ClutterBox:color property has been set. - * - * This property reads the #ClutterActor:background-color-set property - * internally. - * - * Since: 1.2 - * - * Deprecated: 1.10: Use the #ClutterActor:background-color-set property - */ - obj_props[PROP_COLOR_SET] = - g_param_spec_boolean ("color-set", - P_("Color Set"), - P_("Whether the background color is set"), - FALSE, - CLUTTER_PARAM_READWRITE); - - g_object_class_install_properties (gobject_class, PROP_LAST, obj_props); -} - -static void -clutter_box_init (ClutterBox *self) -{ - self->priv = clutter_box_get_instance_private (self); -} - -/** - * clutter_box_new: - * @manager: a #ClutterLayoutManager - * - * Creates a new #ClutterBox. The children of the box will be layed - * out by the passed @manager - * - * Return value: the newly created #ClutterBox actor - * - * Since: 1.2 - * - * Deprecated: 1.10: Use clutter_actor_new() instead. - */ -ClutterActor * -clutter_box_new (ClutterLayoutManager *manager) -{ - g_return_val_if_fail (CLUTTER_IS_LAYOUT_MANAGER (manager), NULL); - - return g_object_new (CLUTTER_TYPE_BOX, - "layout-manager", manager, - NULL); -} - -/** - * clutter_box_set_layout_manager: - * @box: a #ClutterBox - * @manager: a #ClutterLayoutManager - * - * Sets the #ClutterLayoutManager for @box - * - * A #ClutterLayoutManager is a delegate object that controls the - * layout of the children of @box - * - * Since: 1.2 - * - * Deprecated: 1.10: Use clutter_actor_set_layout_manager() instead. - */ -void -clutter_box_set_layout_manager (ClutterBox *box, - ClutterLayoutManager *manager) -{ - clutter_actor_set_layout_manager (CLUTTER_ACTOR (box), manager); -} - -/** - * clutter_box_get_layout_manager: - * @box: a #ClutterBox - * - * Retrieves the #ClutterLayoutManager instance used by @box - * - * Return value: (transfer none): a #ClutterLayoutManager. The returned - * #ClutterLayoutManager is owned by the #ClutterBox and it should not - * be unreferenced - * - * Since: 1.2 - * - * Deprecated: 1.10: Use clutter_actor_get_layout_manager() instead. - */ -ClutterLayoutManager * -clutter_box_get_layout_manager (ClutterBox *box) -{ - return clutter_actor_get_layout_manager (CLUTTER_ACTOR (box)); -} - -/** - * clutter_box_packv: - * @box: a #ClutterBox - * @actor: a #ClutterActor - * @n_properties: the number of properties to set - * @properties: (array length=n_properties) (element-type utf8): a vector - * containing the property names to set - * @values: (array length=n_properties): a vector containing the property - * values to set - * - * Vector-based variant of clutter_box_pack(), intended for language - * bindings to use - * - * Since: 1.2 - * - * Deprecated: 1.10: Use clutter_actor_add_child() instead. To set - * specific layout properties, use clutter_layout_manager_child_set() - */ -void -clutter_box_packv (ClutterBox *box, - ClutterActor *actor, - guint n_properties, - const gchar * const properties[], - const GValue *values) -{ - ClutterLayoutManager *manager; - ClutterContainer *container; - ClutterLayoutMeta *meta; - GObjectClass *klass; - gint i; - - g_return_if_fail (CLUTTER_IS_BOX (box)); - g_return_if_fail (CLUTTER_IS_ACTOR (actor)); - - container = CLUTTER_CONTAINER (box); - clutter_container_add_actor (container, actor); - - manager = clutter_actor_get_layout_manager (CLUTTER_ACTOR (box)); - if (manager == NULL) - return; - - meta = clutter_layout_manager_get_child_meta (manager, - container, - actor); - - if (meta == NULL) - return; - - klass = G_OBJECT_GET_CLASS (meta); - - for (i = 0; i < n_properties; i++) - { - const gchar *pname = properties[i]; - GParamSpec *pspec; - - pspec = g_object_class_find_property (klass, pname); - if (pspec == NULL) - { - g_warning ("%s: the layout property '%s' for managers " - "of type '%s' (meta type '%s') does not exist", - G_STRLOC, - pname, - G_OBJECT_TYPE_NAME (manager), - G_OBJECT_TYPE_NAME (meta)); - break; - } - - if (!(pspec->flags & G_PARAM_WRITABLE)) - { - g_warning ("%s: the layout property '%s' for managers " - "of type '%s' (meta type '%s') is not writable", - G_STRLOC, - pspec->name, - G_OBJECT_TYPE_NAME (manager), - G_OBJECT_TYPE_NAME (meta)); - break; - } - - clutter_layout_manager_child_set_property (manager, - container, actor, - pname, &values[i]); - } -} - -static inline void -clutter_box_set_property_valist (ClutterBox *box, - ClutterActor *actor, - const gchar *first_property, - va_list var_args) -{ - ClutterContainer *container = CLUTTER_CONTAINER (box); - ClutterLayoutManager *manager; - ClutterLayoutMeta *meta; - GObjectClass *klass; - const gchar *pname; - - manager = clutter_actor_get_layout_manager (CLUTTER_ACTOR (box)); - if (manager == NULL) - return; - - meta = clutter_layout_manager_get_child_meta (manager, - container, - actor); - - if (meta == NULL) - return; - - klass = G_OBJECT_GET_CLASS (meta); - - pname = first_property; - while (pname) - { - GValue value = { 0, }; - GParamSpec *pspec; - gchar *error; - - pspec = g_object_class_find_property (klass, pname); - if (pspec == NULL) - { - g_warning ("%s: the layout property '%s' for managers " - "of type '%s' (meta type '%s') does not exist", - G_STRLOC, - pname, - G_OBJECT_TYPE_NAME (manager), - G_OBJECT_TYPE_NAME (meta)); - break; - } - - if (!(pspec->flags & G_PARAM_WRITABLE)) - { - g_warning ("%s: the layout property '%s' for managers " - "of type '%s' (meta type '%s') is not writable", - G_STRLOC, - pspec->name, - G_OBJECT_TYPE_NAME (manager), - G_OBJECT_TYPE_NAME (meta)); - break; - } - - G_VALUE_COLLECT_INIT (&value, G_PARAM_SPEC_VALUE_TYPE (pspec), - var_args, 0, - &error); - - if (error) - { - g_warning ("%s: %s", G_STRLOC, error); - g_free (error); - break; - } - - clutter_layout_manager_child_set_property (manager, - container, actor, - pspec->name, &value); - - g_value_unset (&value); - - pname = va_arg (var_args, gchar*); - } -} - -/** - * clutter_box_pack: - * @box: a #ClutterBox - * @actor: a #ClutterActor - * @first_property: the name of the first property to set, or %NULL - * @...: a list of property name and value pairs, terminated by %NULL - * - * Adds @actor to @box and sets layout properties at the same time, - * if the #ClutterLayoutManager used by @box has them - * - * This function is a wrapper around clutter_container_add_actor() - * and clutter_layout_manager_child_set() - * - * Language bindings should use the vector-based clutter_box_packv() - * variant instead - * - * Since: 1.2 - * - * Deprecated: 1.10: Use clutter_actor_add_child() instead. To set - * specific layout properties, use clutter_layout_manager_child_set() - */ -void -clutter_box_pack (ClutterBox *box, - ClutterActor *actor, - const gchar *first_property, - ...) -{ - va_list var_args; - - g_return_if_fail (CLUTTER_IS_BOX (box)); - g_return_if_fail (CLUTTER_IS_ACTOR (actor)); - - clutter_container_add_actor (CLUTTER_CONTAINER (box), actor); - - if (first_property == NULL || *first_property == '\0') - return; - - va_start (var_args, first_property); - clutter_box_set_property_valist (box, actor, first_property, var_args); - va_end (var_args); -} - -/** - * clutter_box_pack_after: - * @box: a #ClutterBox - * @actor: a #ClutterActor - * @sibling: (allow-none): a #ClutterActor or %NULL - * @first_property: the name of the first property to set, or %NULL - * @...: a list of property name and value pairs, terminated by %NULL - * - * Adds @actor to @box, placing it after @sibling, and sets layout - * properties at the same time, if the #ClutterLayoutManager used by - * @box supports them - * - * If @sibling is %NULL then @actor is placed at the end of the - * list of children, to be allocated and painted after every other child - * - * This function is a wrapper around clutter_container_add_actor(), - * clutter_container_raise_child() and clutter_layout_manager_child_set() - * - * Since: 1.2 - * - * Deprecated: 1.10: Use clutter_actor_insert_child_above() instead. - * To set specific layout properties, use clutter_layout_manager_child_set() - */ -void -clutter_box_pack_after (ClutterBox *box, - ClutterActor *actor, - ClutterActor *sibling, - const gchar *first_property, - ...) -{ - va_list var_args; - - g_return_if_fail (CLUTTER_IS_BOX (box)); - g_return_if_fail (CLUTTER_IS_ACTOR (actor)); - g_return_if_fail (sibling == NULL || CLUTTER_IS_ACTOR (sibling)); - - clutter_container_add_actor (CLUTTER_CONTAINER (box), actor); - clutter_container_raise_child (CLUTTER_CONTAINER (box), actor, sibling); - - if (first_property == NULL || *first_property == '\0') - return; - - va_start (var_args, first_property); - clutter_box_set_property_valist (box, actor, first_property, var_args); - va_end (var_args); -} - -/** - * clutter_box_pack_before: - * @box: a #ClutterBox - * @actor: a #ClutterActor - * @sibling: (allow-none): a #ClutterActor or %NULL - * @first_property: the name of the first property to set, or %NULL - * @...: a list of property name and value pairs, terminated by %NULL - * - * Adds @actor to @box, placing it before @sibling, and sets layout - * properties at the same time, if the #ClutterLayoutManager used by - * @box supports them - * - * If @sibling is %NULL then @actor is placed at the beginning of the - * list of children, to be allocated and painted below every other child - * - * This function is a wrapper around clutter_container_add_actor(), - * clutter_container_lower_child() and clutter_layout_manager_child_set() - * - * Since: 1.2 - * - * Deprecated: 1.10: Use clutter_actor_insert_child_below() instead. - * To set specific layout properties, use clutter_layout_manager_child_set() - */ -void -clutter_box_pack_before (ClutterBox *box, - ClutterActor *actor, - ClutterActor *sibling, - const gchar *first_property, - ...) -{ - va_list var_args; - - g_return_if_fail (CLUTTER_IS_BOX (box)); - g_return_if_fail (CLUTTER_IS_ACTOR (actor)); - g_return_if_fail (sibling == NULL || CLUTTER_IS_ACTOR (sibling)); - - clutter_container_add_actor (CLUTTER_CONTAINER (box), actor); - clutter_container_lower_child (CLUTTER_CONTAINER (box), actor, sibling); - - if (first_property == NULL || *first_property == '\0') - return; - - va_start (var_args, first_property); - clutter_box_set_property_valist (box, actor, first_property, var_args); - va_end (var_args); -} - -/** - * clutter_box_pack_at: - * @box: a #ClutterBox - * @actor: a #ClutterActor - * @position: the position to insert the @actor at - * @first_property: the name of the first property to set, or %NULL - * @...: a list of property name and value pairs, terminated by %NULL - * - * Adds @actor to @box, placing it at @position, and sets layout - * properties at the same time, if the #ClutterLayoutManager used by - * @box supports them - * - * If @position is a negative number, or is larger than the number of - * children of @box, the new child is added at the end of the list of - * children - * - * Since: 1.2 - * - * Deprecated: 1.10: Use clutter_actor_insert_child_at_index() instead. - * To set specific layout properties, use clutter_layout_manager_child_set() - */ -void -clutter_box_pack_at (ClutterBox *box, - ClutterActor *actor, - gint position, - const gchar *first_property, - ...) -{ - va_list var_args; - - g_return_if_fail (CLUTTER_IS_BOX (box)); - g_return_if_fail (CLUTTER_IS_ACTOR (actor)); - - clutter_actor_insert_child_at_index (CLUTTER_ACTOR (box), - actor, - position); - - /* we need to explicitly call this, because we're not going through - * the default code paths provided by clutter_container_add() - */ - clutter_container_create_child_meta (CLUTTER_CONTAINER (box), actor); - - g_signal_emit_by_name (box, "actor-added", actor); - - if (first_property == NULL || *first_property == '\0') - return; - - va_start (var_args, first_property); - clutter_box_set_property_valist (box, actor, first_property, var_args); - va_end (var_args); -} - -/** - * clutter_box_set_color: - * @box: a #ClutterBox - * @color: (allow-none): the background color, or %NULL to unset - * - * Sets (or unsets) the background color for @box - * - * Since: 1.2 - * - * Deprecated: 1.10: Use clutter_actor_set_background_color() instead. - */ -void -clutter_box_set_color (ClutterBox *box, - const ClutterColor *color) -{ - g_return_if_fail (CLUTTER_IS_BOX (box)); - - clutter_box_set_color_internal (box, color); -} - -/** - * clutter_box_get_color: - * @box: a #ClutterBox - * @color: (out caller-allocates): return location for a #ClutterColor - * - * Retrieves the background color of @box - * - * If the #ClutterBox:color-set property is set to %FALSE the - * returned #ClutterColor is undefined - * - * Since: 1.2 - * - * Deprecated: 1.10: Use clutter_actor_get_background_color() instead. - */ -void -clutter_box_get_color (ClutterBox *box, - ClutterColor *color) -{ - g_return_if_fail (CLUTTER_IS_BOX (box)); - g_return_if_fail (color != NULL); - - clutter_actor_get_background_color (CLUTTER_ACTOR (box), color); -} diff --git a/clutter/clutter/deprecated/clutter-box.h b/clutter/clutter/deprecated/clutter-box.h deleted file mode 100644 index 6b6d821fc..000000000 --- a/clutter/clutter/deprecated/clutter-box.h +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Clutter. - * - * An OpenGL based 'interactive canvas' library. - * - * Copyright (C) 2009,2010 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 . - * - * Author: - * Emmanuele Bassi - */ - -#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION) -#error "Only can be included directly." -#endif - -#ifndef __CLUTTER_BOX_H__ -#define __CLUTTER_BOX_H__ - -#include -#include -#include - -G_BEGIN_DECLS - -#define CLUTTER_TYPE_BOX (clutter_box_get_type ()) -#define CLUTTER_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BOX, ClutterBox)) -#define CLUTTER_IS_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BOX)) -#define CLUTTER_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BOX, ClutterBoxClass)) -#define CLUTTER_IS_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_BOX)) -#define CLUTTER_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_BOX, ClutterBoxClass)) - -typedef struct _ClutterBox ClutterBox; -typedef struct _ClutterBoxPrivate ClutterBoxPrivate; -typedef struct _ClutterBoxClass ClutterBoxClass; - -/** - * ClutterBox: - * - * The #ClutterBox structure contains only private data and should - * be accessed using the provided API - * - * Since: 1.2 - */ -struct _ClutterBox -{ - /*< private >*/ - ClutterActor parent_instance; - - ClutterBoxPrivate *priv; -}; - -/** - * ClutterBoxClass: - * - * The #ClutterBoxClass structure contains only private data - * - * Since: 1.2 - */ -struct _ClutterBoxClass -{ - /*< private >*/ - ClutterActorClass parent_class; - - /* padding, for future expansion */ - void (*clutter_padding_1) (void); - void (*clutter_padding_2) (void); - void (*clutter_padding_3) (void); - void (*clutter_padding_4) (void); - void (*clutter_padding_5) (void); - void (*clutter_padding_6) (void); -}; - -CLUTTER_DEPRECATED -GType clutter_box_get_type (void) G_GNUC_CONST; - -CLUTTER_DEPRECATED_FOR(clutter_actor_new) -ClutterActor * clutter_box_new (ClutterLayoutManager *manager); - -CLUTTER_DEPRECATED_FOR(clutter_actor_set_layout_manager) -void clutter_box_set_layout_manager (ClutterBox *box, - ClutterLayoutManager *manager); - -CLUTTER_DEPRECATED_FOR(clutter_actor_get_layout_manager) -ClutterLayoutManager *clutter_box_get_layout_manager (ClutterBox *box); - -CLUTTER_DEPRECATED_FOR(clutter_actor_set_background_color) -void clutter_box_set_color (ClutterBox *box, - const ClutterColor *color); - -CLUTTER_DEPRECATED_FOR(clutter_actor_get_background_color) -void clutter_box_get_color (ClutterBox *box, - ClutterColor *color); - -CLUTTER_DEPRECATED_FOR(clutter_actor_add_child) -void clutter_box_pack (ClutterBox *box, - ClutterActor *actor, - const gchar *first_property, - ...); - -CLUTTER_DEPRECATED_FOR(clutter_actor_add_child) -void clutter_box_packv (ClutterBox *box, - ClutterActor *actor, - guint n_properties, - const gchar * const properties[], - const GValue *values); - -CLUTTER_DEPRECATED_FOR(clutter_actor_insert_child_above) -void clutter_box_pack_after (ClutterBox *box, - ClutterActor *actor, - ClutterActor *sibling, - const gchar *first_property, - ...); - -CLUTTER_DEPRECATED_FOR(clutter_actor_insert_child_below) -void clutter_box_pack_before (ClutterBox *box, - ClutterActor *actor, - ClutterActor *sibling, - const gchar *first_property, - ...); - -CLUTTER_DEPRECATED_FOR(clutter_actor_insert_child_at_index) -void clutter_box_pack_at (ClutterBox *box, - ClutterActor *actor, - gint position, - const gchar *first_property, - ...); - -G_END_DECLS - -#endif /* __CLUTTER_BOX_H__ */ diff --git a/clutter/clutter/meson.build b/clutter/clutter/meson.build index e94efb353..b16e7a231 100644 --- a/clutter/clutter/meson.build +++ b/clutter/clutter/meson.build @@ -227,7 +227,6 @@ clutter_deprecated_headers = [ 'deprecated/clutter-behaviour-rotate.h', 'deprecated/clutter-behaviour-scale.h', 'deprecated/clutter-bin-layout.h', - 'deprecated/clutter-box.h', 'deprecated/clutter-cairo-texture.h', 'deprecated/clutter-container.h', 'deprecated/clutter-input-device.h', @@ -254,7 +253,6 @@ clutter_deprecated_sources = [ 'deprecated/clutter-behaviour-path.c', 'deprecated/clutter-behaviour-rotate.c', 'deprecated/clutter-behaviour-scale.c', - 'deprecated/clutter-box.c', 'deprecated/clutter-cairo-texture.c', 'deprecated/clutter-input-device-deprecated.c', 'deprecated/clutter-layout-manager-deprecated.c', diff --git a/clutter/tests/conform/script-parser.c b/clutter/tests/conform/script-parser.c index c2e2dbd08..4452e3fb1 100644 --- a/clutter/tests/conform/script-parser.c +++ b/clutter/tests/conform/script-parser.c @@ -251,10 +251,10 @@ script_object_property (void) g_assert_no_error (error); actor = clutter_script_get_object (script, "test"); - g_assert (CLUTTER_IS_BOX (actor)); + g_assert (CLUTTER_IS_ACTOR (actor)); - manager = clutter_box_get_layout_manager (CLUTTER_BOX (actor)); - g_assert (CLUTTER_IS_BIN_LAYOUT (manager)); + manager = clutter_actor_get_layout_manager (CLUTTER_ACTOR (actor)); + g_assert (CLUTTER_IS_BOX_LAYOUT (manager)); g_object_unref (script); g_free (test_file); @@ -277,11 +277,14 @@ script_named_object (void) g_assert_no_error (error); actor = clutter_script_get_object (script, "test"); - g_assert (CLUTTER_IS_BOX (actor)); + g_assert (CLUTTER_IS_ACTOR (actor)); - manager = clutter_box_get_layout_manager (CLUTTER_BOX (actor)); - g_assert (CLUTTER_IS_BOX_LAYOUT (manager)); - g_assert (clutter_box_layout_get_vertical (CLUTTER_BOX_LAYOUT (manager))); + manager = clutter_actor_get_layout_manager (CLUTTER_ACTOR (actor)); + g_assert (CLUTTER_IS_GRID_LAYOUT (manager)); + g_assert_cmpuint (clutter_grid_layout_get_row_spacing (CLUTTER_GRID_LAYOUT (manager)), + ==, 6); + g_assert_cmpuint (clutter_grid_layout_get_column_spacing (CLUTTER_GRID_LAYOUT (manager)), + ==, 12); g_object_unref (script); g_free (test_file); diff --git a/clutter/tests/conform/scripts/test-script-layout-property.json b/clutter/tests/conform/scripts/test-script-layout-property.json index 17e9f4882..e16cd6ba6 100644 --- a/clutter/tests/conform/scripts/test-script-layout-property.json +++ b/clutter/tests/conform/scripts/test-script-layout-property.json @@ -2,7 +2,7 @@ { "id" : "manager", "type" : "ClutterBoxLayout" }, { - "id" : "container", "type" : "ClutterBox", + "id" : "container", "type" : "ClutterActor", "layout-manager" : "manager", "children" : [ { diff --git a/clutter/tests/conform/scripts/test-script-named-object.json b/clutter/tests/conform/scripts/test-script-named-object.json index 6611b62a4..edfd5462c 100644 --- a/clutter/tests/conform/scripts/test-script-named-object.json +++ b/clutter/tests/conform/scripts/test-script-named-object.json @@ -1,10 +1,9 @@ [ { "id" : "layout", - "type" : "ClutterBoxLayout", - "orientation" : "vertical", - "spacing" : 12, - "pack-start" : false + "type" : "ClutterGridLayout", + "row-spacing" : 6, + "column-spacing" : 12 }, { "type" : "ClutterStage", @@ -12,7 +11,7 @@ "children" : [ { "id" : "test", - "type" : "ClutterBox", + "type" : "ClutterActor", "layout-manager" : "layout", "children" : [ { diff --git a/clutter/tests/conform/scripts/test-script-object-property.json b/clutter/tests/conform/scripts/test-script-object-property.json index 18a02fb8b..73923b925 100644 --- a/clutter/tests/conform/scripts/test-script-object-property.json +++ b/clutter/tests/conform/scripts/test-script-object-property.json @@ -1,7 +1,7 @@ { "id" : "test", - "type" : "ClutterBox", - "layout-manager" : { "id" : "layout", "type" : "ClutterBinLayout" }, + "type" : "ClutterActor", + "layout-manager" : { "id" : "layout", "type" : "ClutterBoxLayout" }, "children" : [ { "id" : "child-1", diff --git a/clutter/tests/interactive/test-swipe-action.c b/clutter/tests/interactive/test-swipe-action.c index 75b2e75d5..56a7ffacb 100644 --- a/clutter/tests/interactive/test-swipe-action.c +++ b/clutter/tests/interactive/test-swipe-action.c @@ -128,44 +128,32 @@ test_swipe_action_main (int argc, char *argv[]) attach_action (rect, BOTH); { - ClutterLayoutManager *layout = clutter_box_layout_new (); + ClutterLayoutManager *layout = clutter_grid_layout_new (); ClutterActor *box, *label; float offset; - clutter_box_layout_set_vertical (CLUTTER_BOX_LAYOUT (layout), TRUE); - clutter_box_layout_set_spacing (CLUTTER_BOX_LAYOUT (layout), 6); + clutter_grid_layout_set_orientation (CLUTTER_GRID_LAYOUT (layout), + CLUTTER_ORIENTATION_VERTICAL); + clutter_grid_layout_set_row_spacing (CLUTTER_GRID_LAYOUT (layout), 6); + clutter_grid_layout_set_column_spacing (CLUTTER_GRID_LAYOUT (layout), 6); - box = clutter_box_new (layout); + box = clutter_actor_new (); + clutter_actor_set_layout_manager (box, layout); label = clutter_text_new (); clutter_text_set_markup (CLUTTER_TEXT (label), "Red: vertical swipes only"); - clutter_box_layout_pack (CLUTTER_BOX_LAYOUT (layout), - label, - TRUE, - TRUE, TRUE, - CLUTTER_BOX_ALIGNMENT_START, - CLUTTER_BOX_ALIGNMENT_CENTER); + clutter_actor_add_child (box, label); label = clutter_text_new (); clutter_text_set_markup (CLUTTER_TEXT (label), "Blue: horizontal swipes only"); - clutter_box_layout_pack (CLUTTER_BOX_LAYOUT (layout), - label, - TRUE, - TRUE, TRUE, - CLUTTER_BOX_ALIGNMENT_START, - CLUTTER_BOX_ALIGNMENT_CENTER); + clutter_actor_add_child (box, label); label = clutter_text_new (); clutter_text_set_markup (CLUTTER_TEXT (label), "Green: both"); - clutter_box_layout_pack (CLUTTER_BOX_LAYOUT (layout), - label, - TRUE, - TRUE, TRUE, - CLUTTER_BOX_ALIGNMENT_START, - CLUTTER_BOX_ALIGNMENT_CENTER); + clutter_actor_add_child (box, label); offset = clutter_actor_get_height (stage) - clutter_actor_get_height (box) diff --git a/clutter/tests/interactive/test-texture-material.c b/clutter/tests/interactive/test-texture-material.c index 4886ce03a..b54e72899 100644 --- a/clutter/tests/interactive/test-texture-material.c +++ b/clutter/tests/interactive/test-texture-material.c @@ -18,7 +18,8 @@ test_texture_material_main (int argc, char *argv[]) g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); manager = clutter_flow_layout_new (CLUTTER_FLOW_HORIZONTAL); - box = clutter_box_new (manager); + box = clutter_actor_new (); + clutter_actor_set_layout_manager (box, manager); clutter_actor_add_constraint (box, clutter_bind_constraint_new (stage, CLUTTER_BIND_WIDTH, -25.0)); clutter_actor_add_constraint (box, clutter_bind_constraint_new (stage, CLUTTER_BIND_HEIGHT, -25.0)); clutter_actor_set_position (box, 25.0, 25.0);