mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 01:50:42 -05:00
layout: Add layout properties introspection
In order to know if a layout property exists and retrieve its description in form of a GParamSpec, we need a wrapper API inside ClutterLayoutManager. This allows introspecting a LayoutManager sub-class and eventually serialize and deserialize it.
This commit is contained in:
parent
b0c9de2730
commit
c3368c0d15
@ -913,3 +913,79 @@ clutter_layout_manager_child_get_property (ClutterLayoutManager *manager,
|
||||
|
||||
layout_get_property_internal (manager, G_OBJECT (meta), pspec, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_layout_manager_find_child_property:
|
||||
* @manager: a #ClutterLayoutManager
|
||||
* @name: the name of the property
|
||||
*
|
||||
* Retrieves the #GParamSpec for the layout property @name inside
|
||||
* the #ClutterLayoutMeta sub-class used by @manager
|
||||
*
|
||||
* Return value: (transfer none): a #GParamSpec describing the property,
|
||||
* or %NULL if no property with that name exists. The returned
|
||||
* #GParamSpec is owned by the layout manager and should not be
|
||||
* modified or freed
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
GParamSpec *
|
||||
clutter_layout_manager_find_child_property (ClutterLayoutManager *manager,
|
||||
const gchar *name)
|
||||
{
|
||||
ClutterLayoutManagerClass *klass;
|
||||
GObjectClass *meta_klass;
|
||||
GParamSpec *pspec;
|
||||
GType meta_type;
|
||||
|
||||
klass = CLUTTER_LAYOUT_MANAGER_GET_CLASS (manager);
|
||||
meta_type = klass->get_child_meta_type (manager);
|
||||
if (meta_type == G_TYPE_INVALID)
|
||||
return NULL;
|
||||
|
||||
meta_klass = g_type_class_ref (meta_type);
|
||||
|
||||
pspec = g_object_class_find_property (meta_klass, name);
|
||||
|
||||
g_type_class_unref (meta_klass);
|
||||
|
||||
return pspec;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_layout_manager_list_child_properties:
|
||||
* @manager: a #ClutterLayoutManager
|
||||
* @n_pspecs: (out): return location for the number of returned
|
||||
* #GParamSpec<!-- -->s
|
||||
*
|
||||
* Retrieves all the #GParamSpec<!-- -->s for the layout properties
|
||||
* stored inside the #ClutterLayoutMeta sub-class used by @manager
|
||||
*
|
||||
* Return value: (transfer full): the newly-allocated, %NULL-terminated
|
||||
* array of #GParamSpec<!-- -->s. Use g_free() to free the resources
|
||||
* allocated for the array
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
GParamSpec **
|
||||
clutter_layout_manager_list_child_properties (ClutterLayoutManager *manager,
|
||||
guint *n_pspecs)
|
||||
{
|
||||
ClutterLayoutManagerClass *klass;
|
||||
GObjectClass *meta_klass;
|
||||
GParamSpec **pspecs;
|
||||
GType meta_type;
|
||||
|
||||
klass = CLUTTER_LAYOUT_MANAGER_GET_CLASS (manager);
|
||||
meta_type = klass->get_child_meta_type (manager);
|
||||
if (meta_type == G_TYPE_INVALID)
|
||||
return NULL;
|
||||
|
||||
meta_klass = g_type_class_ref (meta_type);
|
||||
|
||||
pspecs = g_object_class_list_properties (meta_klass, n_pspecs);
|
||||
|
||||
g_type_class_unref (meta_klass);
|
||||
|
||||
return pspecs;
|
||||
}
|
||||
|
@ -135,55 +135,60 @@ struct _ClutterLayoutManagerClass
|
||||
|
||||
GType clutter_layout_manager_get_type (void) G_GNUC_CONST;
|
||||
|
||||
void clutter_layout_manager_get_preferred_width (ClutterLayoutManager *manager,
|
||||
ClutterContainer *container,
|
||||
gfloat for_height,
|
||||
gfloat *min_width_p,
|
||||
gfloat *nat_width_p);
|
||||
void clutter_layout_manager_get_preferred_height (ClutterLayoutManager *manager,
|
||||
ClutterContainer *container,
|
||||
gfloat for_width,
|
||||
gfloat *min_height_p,
|
||||
gfloat *nat_height_p);
|
||||
void clutter_layout_manager_allocate (ClutterLayoutManager *manager,
|
||||
ClutterContainer *container,
|
||||
const ClutterActorBox *allocation,
|
||||
ClutterAllocationFlags flags);
|
||||
void clutter_layout_manager_get_preferred_width (ClutterLayoutManager *manager,
|
||||
ClutterContainer *container,
|
||||
gfloat for_height,
|
||||
gfloat *min_width_p,
|
||||
gfloat *nat_width_p);
|
||||
void clutter_layout_manager_get_preferred_height (ClutterLayoutManager *manager,
|
||||
ClutterContainer *container,
|
||||
gfloat for_width,
|
||||
gfloat *min_height_p,
|
||||
gfloat *nat_height_p);
|
||||
void clutter_layout_manager_allocate (ClutterLayoutManager *manager,
|
||||
ClutterContainer *container,
|
||||
const ClutterActorBox *allocation,
|
||||
ClutterAllocationFlags flags);
|
||||
|
||||
void clutter_layout_manager_set_container (ClutterLayoutManager *manager,
|
||||
ClutterContainer *container);
|
||||
void clutter_layout_manager_layout_changed (ClutterLayoutManager *manager);
|
||||
void clutter_layout_manager_set_container (ClutterLayoutManager *manager,
|
||||
ClutterContainer *container);
|
||||
void clutter_layout_manager_layout_changed (ClutterLayoutManager *manager);
|
||||
|
||||
ClutterLayoutMeta *clutter_layout_manager_get_child_meta (ClutterLayoutManager *manager,
|
||||
ClutterContainer *container,
|
||||
ClutterActor *actor);
|
||||
void clutter_layout_manager_add_child_meta (ClutterLayoutManager *manager,
|
||||
ClutterContainer *container,
|
||||
ClutterActor *actor);
|
||||
void clutter_layout_manager_remove_child_meta (ClutterLayoutManager *manager,
|
||||
ClutterContainer *container,
|
||||
ClutterActor *actor);
|
||||
GParamSpec * clutter_layout_manager_find_child_property (ClutterLayoutManager *manager,
|
||||
const gchar *name);
|
||||
GParamSpec ** clutter_layout_manager_list_child_properties (ClutterLayoutManager *manager,
|
||||
guint *n_pspecs);
|
||||
|
||||
void clutter_layout_manager_child_set (ClutterLayoutManager *manager,
|
||||
ClutterContainer *container,
|
||||
ClutterActor *actor,
|
||||
const gchar *first_property,
|
||||
...) G_GNUC_NULL_TERMINATED;
|
||||
void clutter_layout_manager_child_get (ClutterLayoutManager *manager,
|
||||
ClutterContainer *container,
|
||||
ClutterActor *actor,
|
||||
const gchar *first_property,
|
||||
...) G_GNUC_NULL_TERMINATED;
|
||||
void clutter_layout_manager_child_set_property (ClutterLayoutManager *manager,
|
||||
ClutterContainer *container,
|
||||
ClutterActor *actor,
|
||||
const gchar *property_name,
|
||||
const GValue *value);
|
||||
void clutter_layout_manager_child_get_property (ClutterLayoutManager *manager,
|
||||
ClutterContainer *container,
|
||||
ClutterActor *actor,
|
||||
const gchar *property_name,
|
||||
GValue *value);
|
||||
ClutterLayoutMeta *clutter_layout_manager_get_child_meta (ClutterLayoutManager *manager,
|
||||
ClutterContainer *container,
|
||||
ClutterActor *actor);
|
||||
void clutter_layout_manager_add_child_meta (ClutterLayoutManager *manager,
|
||||
ClutterContainer *container,
|
||||
ClutterActor *actor);
|
||||
void clutter_layout_manager_remove_child_meta (ClutterLayoutManager *manager,
|
||||
ClutterContainer *container,
|
||||
ClutterActor *actor);
|
||||
|
||||
void clutter_layout_manager_child_set (ClutterLayoutManager *manager,
|
||||
ClutterContainer *container,
|
||||
ClutterActor *actor,
|
||||
const gchar *first_property,
|
||||
...) G_GNUC_NULL_TERMINATED;
|
||||
void clutter_layout_manager_child_get (ClutterLayoutManager *manager,
|
||||
ClutterContainer *container,
|
||||
ClutterActor *actor,
|
||||
const gchar *first_property,
|
||||
...) G_GNUC_NULL_TERMINATED;
|
||||
void clutter_layout_manager_child_set_property (ClutterLayoutManager *manager,
|
||||
ClutterContainer *container,
|
||||
ClutterActor *actor,
|
||||
const gchar *property_name,
|
||||
const GValue *value);
|
||||
void clutter_layout_manager_child_get_property (ClutterLayoutManager *manager,
|
||||
ClutterContainer *container,
|
||||
ClutterActor *actor,
|
||||
const gchar *property_name,
|
||||
GValue *value);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user