mirror of
https://github.com/brl/mutter.git
synced 2024-11-23 00:20:42 -05:00
clutter/layout-meta: Become one with ClutterChildMeta
Now ClutterContainer is gone there is no reason for this split to exist, simply merge the two types together Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3384>
This commit is contained in:
parent
db4bbf6899
commit
4bc73ba9f4
@ -38,7 +38,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBlurEffect, g_object_unref)
|
|||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBoxLayout, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBoxLayout, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBrightnessContrastEffect, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBrightnessContrastEffect, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterCanvas, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterCanvas, g_object_unref)
|
||||||
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)
|
||||||
@ -51,7 +50,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterGridLayout, g_object_unref)
|
|||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterInputDevice, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterInputDevice, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterInterval, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterInterval, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterKeyframeTransition, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterKeyframeTransition, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterLayoutMeta, g_object_unref)
|
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterOffscreenEffect, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterOffscreenEffect, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPageTurnEffect, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPageTurnEffect, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPanAction, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPanAction, g_object_unref)
|
||||||
|
@ -49,7 +49,6 @@
|
|||||||
#include "clutter/clutter-actor-private.h"
|
#include "clutter/clutter-actor-private.h"
|
||||||
#include "clutter/clutter-animatable.h"
|
#include "clutter/clutter-animatable.h"
|
||||||
#include "clutter/clutter-bin-layout.h"
|
#include "clutter/clutter-bin-layout.h"
|
||||||
#include "clutter/clutter-child-meta.h"
|
|
||||||
#include "clutter/clutter-debug.h"
|
#include "clutter/clutter-debug.h"
|
||||||
#include "clutter/clutter-enum-types.h"
|
#include "clutter/clutter-enum-types.h"
|
||||||
#include "clutter/clutter-layout-meta.h"
|
#include "clutter/clutter-layout-meta.h"
|
||||||
|
@ -1,206 +0,0 @@
|
|||||||
/*
|
|
||||||
* Clutter.
|
|
||||||
*
|
|
||||||
* An OpenGL based 'interactive canvas' library.
|
|
||||||
*
|
|
||||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
|
||||||
* Jorn Baayen <jorn@openedhand.com>
|
|
||||||
* Emmanuele Bassi <ebassi@openedhand.com>
|
|
||||||
* Tomas Frydrych <tf@openedhand.com>
|
|
||||||
* Øyvind Kolås <ok@openedhand.com>
|
|
||||||
*
|
|
||||||
* Copyright (C) 2008 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/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ClutterChildMeta:
|
|
||||||
*
|
|
||||||
* Base interface for container specific state for child actors.
|
|
||||||
*
|
|
||||||
* A child data is meant to be used when you need to keep track
|
|
||||||
* of information about each individual child added to a container.
|
|
||||||
*
|
|
||||||
* In order to use it you should create your own subclass of
|
|
||||||
* #ClutterChildMeta and set the #ClutterContainerIface child_meta_type
|
|
||||||
* interface member to your subclass type, like:
|
|
||||||
*
|
|
||||||
* ```c
|
|
||||||
* static void
|
|
||||||
* my_container_iface_init (ClutterContainerIface *iface)
|
|
||||||
* {
|
|
||||||
* // set the rest of the #ClutterContainer vtable
|
|
||||||
*
|
|
||||||
* container_iface->child_meta_type = MY_TYPE_CHILD_META;
|
|
||||||
* }
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* This will automatically create a #ClutterChildMeta of type
|
|
||||||
* `MY_TYPE_CHILD_META` for every actor that is added to the container.
|
|
||||||
*
|
|
||||||
* The child data for an actor can be retrieved using the
|
|
||||||
* clutter_container_get_child_meta() function.
|
|
||||||
*
|
|
||||||
* The properties of the data and your subclass can be manipulated with
|
|
||||||
* clutter_container_child_set() and clutter_container_child_get() which
|
|
||||||
* act like g_object_set() and g_object_get().
|
|
||||||
*
|
|
||||||
* You can provide hooks for your own storage as well as control the
|
|
||||||
* instantiation by overriding the #ClutterContainerIface virtual functions
|
|
||||||
* #ClutterContainerIface.create_child_meta(), #ClutterContainerIface.destroy_child_meta(),
|
|
||||||
* and #ClutterContainerIface.get_child_meta().
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "clutter/clutter-build-config.h"
|
|
||||||
|
|
||||||
#include "clutter/clutter-child-meta.h"
|
|
||||||
#include "clutter/clutter-container.h"
|
|
||||||
#include "clutter/clutter-debug.h"
|
|
||||||
#include "clutter/clutter-private.h"
|
|
||||||
|
|
||||||
G_DEFINE_ABSTRACT_TYPE (ClutterChildMeta, clutter_child_meta, G_TYPE_OBJECT);
|
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
PROP_0,
|
|
||||||
|
|
||||||
PROP_CONTAINER,
|
|
||||||
PROP_ACTOR,
|
|
||||||
|
|
||||||
PROP_LAST
|
|
||||||
};
|
|
||||||
|
|
||||||
static GParamSpec *obj_props[PROP_LAST];
|
|
||||||
|
|
||||||
static void
|
|
||||||
clutter_child_meta_set_property (GObject *object,
|
|
||||||
guint prop_id,
|
|
||||||
const GValue *value,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
{
|
|
||||||
ClutterChildMeta *child_meta = CLUTTER_CHILD_META (object);
|
|
||||||
|
|
||||||
switch (prop_id)
|
|
||||||
{
|
|
||||||
case PROP_CONTAINER:
|
|
||||||
child_meta->container = g_value_get_object (value);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PROP_ACTOR:
|
|
||||||
child_meta->actor = g_value_get_object (value);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
clutter_child_meta_get_property (GObject *object,
|
|
||||||
guint prop_id,
|
|
||||||
GValue *value,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
{
|
|
||||||
ClutterChildMeta *child_meta = CLUTTER_CHILD_META (object);
|
|
||||||
|
|
||||||
switch (prop_id)
|
|
||||||
{
|
|
||||||
case PROP_CONTAINER:
|
|
||||||
g_value_set_object (value, child_meta->container);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PROP_ACTOR:
|
|
||||||
g_value_set_object (value, child_meta->actor);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
clutter_child_meta_class_init (ClutterChildMetaClass *klass)
|
|
||||||
{
|
|
||||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
|
||||||
|
|
||||||
gobject_class->set_property = clutter_child_meta_set_property;
|
|
||||||
gobject_class->get_property = clutter_child_meta_get_property;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ClutterChildMeta:container:
|
|
||||||
*
|
|
||||||
* The #ClutterContainer that created this #ClutterChildMeta.
|
|
||||||
*/
|
|
||||||
obj_props[PROP_CONTAINER] =
|
|
||||||
g_param_spec_object ("container", NULL, NULL,
|
|
||||||
CLUTTER_TYPE_ACTOR,
|
|
||||||
G_PARAM_CONSTRUCT_ONLY |
|
|
||||||
CLUTTER_PARAM_READWRITE);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ClutterChildMeta:actor:
|
|
||||||
*
|
|
||||||
* The #ClutterActor being wrapped by this #ClutterChildMeta
|
|
||||||
*/
|
|
||||||
obj_props[PROP_ACTOR] =
|
|
||||||
g_param_spec_object ("actor", NULL, NULL,
|
|
||||||
CLUTTER_TYPE_ACTOR,
|
|
||||||
G_PARAM_CONSTRUCT_ONLY |
|
|
||||||
CLUTTER_PARAM_READWRITE);
|
|
||||||
|
|
||||||
g_object_class_install_properties (gobject_class,
|
|
||||||
PROP_LAST,
|
|
||||||
obj_props);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
clutter_child_meta_init (ClutterChildMeta *self)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* clutter_child_meta_get_container:
|
|
||||||
* @data: a #ClutterChildMeta
|
|
||||||
*
|
|
||||||
* Retrieves the container using @data
|
|
||||||
*
|
|
||||||
* Return value: (transfer none): a #ClutterActor
|
|
||||||
*/
|
|
||||||
ClutterActor *
|
|
||||||
clutter_child_meta_get_container (ClutterChildMeta *data)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_CHILD_META (data), NULL);
|
|
||||||
|
|
||||||
return data->container;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* clutter_child_meta_get_actor:
|
|
||||||
* @data: a #ClutterChildMeta
|
|
||||||
*
|
|
||||||
* Retrieves the actor wrapped by @data
|
|
||||||
*
|
|
||||||
* Return value: (transfer none): a #ClutterActor
|
|
||||||
*/
|
|
||||||
ClutterActor *
|
|
||||||
clutter_child_meta_get_actor (ClutterChildMeta *data)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_CHILD_META (data), NULL);
|
|
||||||
|
|
||||||
return data->actor;
|
|
||||||
}
|
|
@ -1,78 +0,0 @@
|
|||||||
/*
|
|
||||||
* Clutter.
|
|
||||||
*
|
|
||||||
* An OpenGL based 'interactive canvas' library.
|
|
||||||
*
|
|
||||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
|
||||||
* Jorn Baayen <jorn@openedhand.com>
|
|
||||||
* Emmanuele Bassi <ebassi@openedhand.com>
|
|
||||||
* Tomas Frydrych <tf@openedhand.com>
|
|
||||||
* Øyvind Kolås <ok@openedhand.com>
|
|
||||||
*
|
|
||||||
* Copyright (C) 2008 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/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
|
||||||
#error "Only <clutter/clutter.h> can be included directly."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <glib-object.h>
|
|
||||||
|
|
||||||
#include "clutter/clutter-types.h"
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define CLUTTER_TYPE_CHILD_META (clutter_child_meta_get_type ())
|
|
||||||
#define CLUTTER_CHILD_META(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_CHILD_META, ClutterChildMeta))
|
|
||||||
#define CLUTTER_CHILD_META_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_CHILD_META, ClutterChildMetaClass))
|
|
||||||
#define CLUTTER_IS_CHILD_META(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_CHILD_META))
|
|
||||||
#define CLUTTER_IS_CHILD_META_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_CHILD_META))
|
|
||||||
#define CLUTTER_CHILD_META_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_CHILD_META, ClutterChildMetaClass))
|
|
||||||
|
|
||||||
typedef struct _ClutterChildMetaClass ClutterChildMetaClass;
|
|
||||||
|
|
||||||
struct _ClutterChildMeta
|
|
||||||
{
|
|
||||||
/*< private >*/
|
|
||||||
GObject parent_instance;
|
|
||||||
|
|
||||||
/*< public >*/
|
|
||||||
ClutterActor *container;
|
|
||||||
ClutterActor *actor;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ClutterChildMetaClass:
|
|
||||||
*
|
|
||||||
* The #ClutterChildMetaClass contains only private data
|
|
||||||
*/
|
|
||||||
struct _ClutterChildMetaClass
|
|
||||||
{
|
|
||||||
/*< private >*/
|
|
||||||
GObjectClass parent_class;
|
|
||||||
};
|
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
GType clutter_child_meta_get_type (void) G_GNUC_CONST;
|
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
ClutterActor * clutter_child_meta_get_container (ClutterChildMeta *data);
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
ClutterActor * clutter_child_meta_get_actor (ClutterChildMeta *data);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
@ -57,7 +57,6 @@
|
|||||||
|
|
||||||
#include "clutter/clutter-actor.h"
|
#include "clutter/clutter-actor.h"
|
||||||
#include "clutter/clutter-animatable.h"
|
#include "clutter/clutter-animatable.h"
|
||||||
#include "clutter/clutter-child-meta.h"
|
|
||||||
#include "clutter/clutter-debug.h"
|
#include "clutter/clutter-debug.h"
|
||||||
#include "clutter/clutter-enum-types.h"
|
#include "clutter/clutter-enum-types.h"
|
||||||
#include "clutter/clutter-flow-layout.h"
|
#include "clutter/clutter-flow-layout.h"
|
||||||
|
@ -531,11 +531,7 @@ get_child_meta (ClutterLayoutManager *manager,
|
|||||||
layout = g_object_get_qdata (G_OBJECT (actor), quark_layout_meta);
|
layout = g_object_get_qdata (G_OBJECT (actor), quark_layout_meta);
|
||||||
if (layout != NULL)
|
if (layout != NULL)
|
||||||
{
|
{
|
||||||
ClutterChildMeta *child = CLUTTER_CHILD_META (layout);
|
if (clutter_layout_meta_is_for (layout, manager, container, actor))
|
||||||
|
|
||||||
if (layout->manager == manager &&
|
|
||||||
CLUTTER_ACTOR (child->container) == container &&
|
|
||||||
child->actor == actor)
|
|
||||||
return layout;
|
return layout;
|
||||||
|
|
||||||
/* if the LayoutMeta referenced is not attached to the
|
/* if the LayoutMeta referenced is not attached to the
|
||||||
|
@ -27,11 +27,12 @@
|
|||||||
*
|
*
|
||||||
* Wrapper for actors inside a layout manager
|
* Wrapper for actors inside a layout manager
|
||||||
*
|
*
|
||||||
* #ClutterLayoutMeta is a wrapper object created by [class@LayoutManager]
|
* [type@Clutter.LayoutMeta] is a wrapper object created by
|
||||||
* implementations in order to store child-specific data and properties.
|
* [class@LayoutManager] implementations in order to store child-specific data
|
||||||
|
* and properties.
|
||||||
*
|
*
|
||||||
* A #ClutterLayoutMeta wraps a [class@Actor] inside a [iface@Container]
|
* A [type@Clutter.LayoutMeta] wraps a [class@Actor] inside a container
|
||||||
* using a [class@LayoutManager].
|
* [class@Actor] using a [class@LayoutManager].
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "clutter/clutter-build-config.h"
|
#include "clutter/clutter-build-config.h"
|
||||||
@ -40,21 +41,45 @@
|
|||||||
#include "clutter/clutter-debug.h"
|
#include "clutter/clutter-debug.h"
|
||||||
#include "clutter/clutter-private.h"
|
#include "clutter/clutter-private.h"
|
||||||
|
|
||||||
G_DEFINE_ABSTRACT_TYPE (ClutterLayoutMeta,
|
typedef struct _ClutterLayoutMetaPrivate ClutterLayoutMetaPrivate;
|
||||||
|
struct _ClutterLayoutMetaPrivate
|
||||||
|
{
|
||||||
|
ClutterLayoutManager *manager;
|
||||||
|
ClutterActor *container;
|
||||||
|
ClutterActor *actor;
|
||||||
|
};
|
||||||
|
|
||||||
|
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ClutterLayoutMeta,
|
||||||
clutter_layout_meta,
|
clutter_layout_meta,
|
||||||
CLUTTER_TYPE_CHILD_META);
|
G_TYPE_OBJECT);
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
PROP_0,
|
PROP_0,
|
||||||
|
|
||||||
PROP_MANAGER,
|
PROP_MANAGER,
|
||||||
|
PROP_CONTAINER,
|
||||||
|
PROP_ACTOR,
|
||||||
|
|
||||||
PROP_LAST
|
PROP_LAST
|
||||||
};
|
};
|
||||||
|
|
||||||
static GParamSpec *obj_props[PROP_LAST];
|
static GParamSpec *obj_props[PROP_LAST];
|
||||||
|
|
||||||
|
static void
|
||||||
|
clutter_layout_meta_dispose (GObject *object)
|
||||||
|
{
|
||||||
|
ClutterLayoutMeta *layout_meta = CLUTTER_LAYOUT_META (object);
|
||||||
|
ClutterLayoutMetaPrivate *priv =
|
||||||
|
clutter_layout_meta_get_instance_private (layout_meta);
|
||||||
|
|
||||||
|
g_clear_weak_pointer (&priv->manager);
|
||||||
|
g_clear_weak_pointer (&priv->container);
|
||||||
|
g_clear_weak_pointer (&priv->actor);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (clutter_layout_meta_parent_class)->dispose (object);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_layout_meta_set_property (GObject *object,
|
clutter_layout_meta_set_property (GObject *object,
|
||||||
guint prop_id,
|
guint prop_id,
|
||||||
@ -62,11 +87,21 @@ clutter_layout_meta_set_property (GObject *object,
|
|||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
ClutterLayoutMeta *layout_meta = CLUTTER_LAYOUT_META (object);
|
ClutterLayoutMeta *layout_meta = CLUTTER_LAYOUT_META (object);
|
||||||
|
ClutterLayoutMetaPrivate *priv =
|
||||||
|
clutter_layout_meta_get_instance_private (layout_meta);
|
||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
case PROP_MANAGER:
|
case PROP_MANAGER:
|
||||||
layout_meta->manager = g_value_get_object (value);
|
g_set_weak_pointer (&priv->manager, g_value_get_object (value));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PROP_CONTAINER:
|
||||||
|
g_set_weak_pointer (&priv->container, g_value_get_object (value));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PROP_ACTOR:
|
||||||
|
g_set_weak_pointer (&priv->actor, g_value_get_object (value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -82,11 +117,21 @@ clutter_layout_meta_get_property (GObject *object,
|
|||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
ClutterLayoutMeta *layout_meta = CLUTTER_LAYOUT_META (object);
|
ClutterLayoutMeta *layout_meta = CLUTTER_LAYOUT_META (object);
|
||||||
|
ClutterLayoutMetaPrivate *priv =
|
||||||
|
clutter_layout_meta_get_instance_private (layout_meta);
|
||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
case PROP_MANAGER:
|
case PROP_MANAGER:
|
||||||
g_value_set_object (value, layout_meta->manager);
|
g_value_set_object (value, priv->manager);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PROP_CONTAINER:
|
||||||
|
g_value_set_object (value, priv->container);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PROP_ACTOR:
|
||||||
|
g_value_set_object (value, priv->actor);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -99,22 +144,45 @@ static void
|
|||||||
clutter_layout_meta_class_init (ClutterLayoutMetaClass *klass)
|
clutter_layout_meta_class_init (ClutterLayoutMetaClass *klass)
|
||||||
{
|
{
|
||||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||||
GParamSpec *pspec;
|
|
||||||
|
|
||||||
|
gobject_class->dispose = clutter_layout_meta_dispose;
|
||||||
gobject_class->set_property = clutter_layout_meta_set_property;
|
gobject_class->set_property = clutter_layout_meta_set_property;
|
||||||
gobject_class->get_property = clutter_layout_meta_get_property;
|
gobject_class->get_property = clutter_layout_meta_get_property;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClutterLayoutMeta:manager:
|
* ClutterLayoutMeta:manager:
|
||||||
*
|
*
|
||||||
* The [class@LayoutManager] that created this #ClutterLayoutMeta.
|
* The [class@LayoutManager] that created this [type@Clutter.LayoutMeta].
|
||||||
*/
|
*/
|
||||||
pspec = g_param_spec_object ("manager", NULL, NULL,
|
obj_props[PROP_MANAGER] =
|
||||||
|
g_param_spec_object ("manager", NULL, NULL,
|
||||||
CLUTTER_TYPE_LAYOUT_MANAGER,
|
CLUTTER_TYPE_LAYOUT_MANAGER,
|
||||||
G_PARAM_CONSTRUCT_ONLY |
|
G_PARAM_CONSTRUCT_ONLY |
|
||||||
CLUTTER_PARAM_READWRITE);
|
CLUTTER_PARAM_READWRITE);
|
||||||
obj_props[PROP_MANAGER] = pspec;
|
|
||||||
g_object_class_install_property (gobject_class, PROP_MANAGER, pspec);
|
/**
|
||||||
|
* ClutterLayoutMeta:container:
|
||||||
|
*
|
||||||
|
* The [type@Clutter.Actor] containing [property@Clutter.LayoutMeta:actor]
|
||||||
|
*/
|
||||||
|
obj_props[PROP_CONTAINER] =
|
||||||
|
g_param_spec_object ("container", NULL, NULL,
|
||||||
|
CLUTTER_TYPE_ACTOR,
|
||||||
|
G_PARAM_CONSTRUCT_ONLY |
|
||||||
|
CLUTTER_PARAM_READWRITE);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ClutterLayoutMeta:actor:
|
||||||
|
*
|
||||||
|
* The [type@Clutter.Actor] being wrapped by this [type@Clutter.LayoutMeta]
|
||||||
|
*/
|
||||||
|
obj_props[PROP_ACTOR] =
|
||||||
|
g_param_spec_object ("actor", NULL, NULL,
|
||||||
|
CLUTTER_TYPE_ACTOR,
|
||||||
|
G_PARAM_CONSTRUCT_ONLY |
|
||||||
|
CLUTTER_PARAM_READWRITE);
|
||||||
|
|
||||||
|
g_object_class_install_properties (gobject_class, PROP_LAST, obj_props);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -128,12 +196,72 @@ clutter_layout_meta_init (ClutterLayoutMeta *self)
|
|||||||
*
|
*
|
||||||
* Retrieves the actor wrapped by @data
|
* Retrieves the actor wrapped by @data
|
||||||
*
|
*
|
||||||
* Return value: (transfer none): a #ClutterLayoutManager
|
* Return value: (transfer none): a [type@Clutter.LayoutManager]
|
||||||
*/
|
*/
|
||||||
ClutterLayoutManager *
|
ClutterLayoutManager *
|
||||||
clutter_layout_meta_get_manager (ClutterLayoutMeta *data)
|
clutter_layout_meta_get_manager (ClutterLayoutMeta *data)
|
||||||
{
|
{
|
||||||
|
ClutterLayoutMetaPrivate *priv;
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_LAYOUT_META (data), NULL);
|
g_return_val_if_fail (CLUTTER_IS_LAYOUT_META (data), NULL);
|
||||||
|
|
||||||
return data->manager;
|
priv = clutter_layout_meta_get_instance_private (data);
|
||||||
|
|
||||||
|
return priv->manager;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_layout_meta_get_container:
|
||||||
|
* @data: a #ClutterLayoutMeta
|
||||||
|
*
|
||||||
|
* Retrieves the container using @data
|
||||||
|
*
|
||||||
|
* Return value: (transfer none): a [type@Clutter.Actor]
|
||||||
|
*/
|
||||||
|
ClutterActor *
|
||||||
|
clutter_layout_meta_get_container (ClutterLayoutMeta *data)
|
||||||
|
{
|
||||||
|
ClutterLayoutMetaPrivate *priv;
|
||||||
|
|
||||||
|
g_return_val_if_fail (CLUTTER_IS_LAYOUT_META (data), NULL);
|
||||||
|
|
||||||
|
priv = clutter_layout_meta_get_instance_private (data);
|
||||||
|
|
||||||
|
return priv->container;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_layout_meta_get_actor:
|
||||||
|
* @data: a #ClutterLayoutMeta
|
||||||
|
*
|
||||||
|
* Retrieves the actor wrapped by @data
|
||||||
|
*
|
||||||
|
* Return value: (transfer none): a [type@Clutter.Actor]
|
||||||
|
*/
|
||||||
|
ClutterActor *
|
||||||
|
clutter_layout_meta_get_actor (ClutterLayoutMeta *data)
|
||||||
|
{
|
||||||
|
ClutterLayoutMetaPrivate *priv;
|
||||||
|
|
||||||
|
g_return_val_if_fail (CLUTTER_IS_LAYOUT_META (data), NULL);
|
||||||
|
|
||||||
|
priv = clutter_layout_meta_get_instance_private (data);
|
||||||
|
|
||||||
|
return priv->actor;
|
||||||
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
clutter_layout_meta_is_for (ClutterLayoutMeta *data,
|
||||||
|
ClutterLayoutManager *manager,
|
||||||
|
ClutterActor *container,
|
||||||
|
ClutterActor *actor)
|
||||||
|
{
|
||||||
|
ClutterLayoutMetaPrivate *priv;
|
||||||
|
|
||||||
|
g_return_val_if_fail (CLUTTER_IS_LAYOUT_META (data), FALSE);
|
||||||
|
|
||||||
|
priv = clutter_layout_meta_get_instance_private (data);
|
||||||
|
|
||||||
|
return priv->manager == manager &&
|
||||||
|
priv->container == container && priv->actor == actor;
|
||||||
}
|
}
|
||||||
|
@ -29,47 +29,30 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "clutter/clutter-types.h"
|
#include "clutter/clutter-types.h"
|
||||||
#include "clutter/clutter-child-meta.h"
|
|
||||||
#include "clutter/clutter-layout-manager.h"
|
#include "clutter/clutter-layout-manager.h"
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define CLUTTER_TYPE_LAYOUT_META (clutter_layout_meta_get_type ())
|
#define CLUTTER_TYPE_LAYOUT_META (clutter_layout_meta_get_type ())
|
||||||
#define CLUTTER_LAYOUT_META(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_LAYOUT_META, ClutterLayoutMeta))
|
|
||||||
#define CLUTTER_IS_LAYOUT_META(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_LAYOUT_META))
|
|
||||||
#define CLUTTER_LAYOUT_META_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_LAYOUT_META, ClutterLayoutMetaClass))
|
|
||||||
#define CLUTTER_IS_LAYOUT_META_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_LAYOUT_META))
|
|
||||||
#define CLUTTER_LAYOUT_META_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_LAYOUT_META, ClutterLayoutMetaClass))
|
|
||||||
|
|
||||||
/* ClutterLayoutMeta is defined in clutter-types.h */
|
CLUTTER_EXPORT
|
||||||
|
G_DECLARE_DERIVABLE_TYPE (ClutterLayoutMeta, clutter_layout_meta, CLUTTER, LAYOUT_META, GObject)
|
||||||
|
|
||||||
typedef struct _ClutterLayoutMetaClass ClutterLayoutMetaClass;
|
|
||||||
|
|
||||||
struct _ClutterLayoutMeta
|
|
||||||
{
|
|
||||||
/*< private >*/
|
|
||||||
ClutterChildMeta parent_instance;
|
|
||||||
|
|
||||||
/*< public >*/
|
|
||||||
ClutterLayoutManager *manager;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ClutterLayoutMetaClass:
|
|
||||||
*
|
|
||||||
* The #ClutterLayoutMetaClass contains only private data and
|
|
||||||
* should never be accessed directly
|
|
||||||
*/
|
|
||||||
struct _ClutterLayoutMetaClass
|
struct _ClutterLayoutMetaClass
|
||||||
{
|
{
|
||||||
/*< private >*/
|
GObjectClass parent_class;
|
||||||
ClutterChildMetaClass parent_class;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
GType clutter_layout_meta_get_type (void) G_GNUC_CONST;
|
ClutterActor *clutter_layout_meta_get_container (ClutterLayoutMeta *data);
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
ClutterActor *clutter_layout_meta_get_actor (ClutterLayoutMeta *data);
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
ClutterLayoutManager *clutter_layout_meta_get_manager (ClutterLayoutMeta *data);
|
ClutterLayoutManager *clutter_layout_meta_get_manager (ClutterLayoutMeta *data);
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
gboolean clutter_layout_meta_is_for (ClutterLayoutMeta *data,
|
||||||
|
ClutterLayoutManager *manager,
|
||||||
|
ClutterActor *container,
|
||||||
|
ClutterActor *actor);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
@ -42,7 +42,6 @@
|
|||||||
#include "clutter/clutter-box-layout.h"
|
#include "clutter/clutter-box-layout.h"
|
||||||
#include "clutter/clutter-brightness-contrast-effect.h"
|
#include "clutter/clutter-brightness-contrast-effect.h"
|
||||||
#include "clutter/clutter-canvas.h"
|
#include "clutter/clutter-canvas.h"
|
||||||
#include "clutter/clutter-child-meta.h"
|
|
||||||
#include "clutter/clutter-click-action.h"
|
#include "clutter/clutter-click-action.h"
|
||||||
#include "clutter/clutter-clone.h"
|
#include "clutter/clutter-clone.h"
|
||||||
#include "clutter/clutter-color.h"
|
#include "clutter/clutter-color.h"
|
||||||
|
@ -17,7 +17,6 @@ clutter_headers = [
|
|||||||
'clutter-box-layout.h',
|
'clutter-box-layout.h',
|
||||||
'clutter-brightness-contrast-effect.h',
|
'clutter-brightness-contrast-effect.h',
|
||||||
'clutter-canvas.h',
|
'clutter-canvas.h',
|
||||||
'clutter-child-meta.h',
|
|
||||||
'clutter-click-action.h',
|
'clutter-click-action.h',
|
||||||
'clutter-clone.h',
|
'clutter-clone.h',
|
||||||
'clutter-color-state.h',
|
'clutter-color-state.h',
|
||||||
@ -108,7 +107,6 @@ clutter_sources = [
|
|||||||
'clutter-box-layout.c',
|
'clutter-box-layout.c',
|
||||||
'clutter-brightness-contrast-effect.c',
|
'clutter-brightness-contrast-effect.c',
|
||||||
'clutter-canvas.c',
|
'clutter-canvas.c',
|
||||||
'clutter-child-meta.c',
|
|
||||||
'clutter-click-action.c',
|
'clutter-click-action.c',
|
||||||
'clutter-clone.c',
|
'clutter-clone.c',
|
||||||
'clutter-color.c',
|
'clutter-color.c',
|
||||||
|
Loading…
Reference in New Issue
Block a user