Class
ClutterLayoutManager
since: 13
Description [src]
abstract class Clutter.LayoutManager : GObject.InitiallyUnowned
{
/* No available fields */
}
Layout managers base class
ClutterLayoutManager is a base abstract class for layout managers. A
layout manager implements the layouting policy for a composite or a
container actor: it controls the preferred size of the actor to which
it has been paired, and it controls the allocation of its children.
Any composite or container ClutterActor subclass can delegate the
layouting of its children to a ClutterLayoutManager.
Clutter provides some simple ClutterLayoutManager sub-classes, like
ClutterFlowLayout and ClutterBinLayout.
Implementing a ClutterLayoutManager
The implementation of a layout manager does not differ from the
implementation of the size requisition and allocation bits of
ClutterActor, so you should read the relative documentation
for subclassing ClutterActor.
The layout manager implementation can hold a back pointer to the
ClutterContainer by implementing the ClutterLayoutManagerClass.set_container()
virtual function. The layout manager should not hold a real reference (i.e.
call g_object_ref()) on the container actor, to avoid reference cycles.
If a layout manager has properties affecting the layout policies then it should
emit the ClutterLayoutManager::layout-changed signal on itself by using the
clutter_layout_manager_layout_changed() function whenever one of these properties changes.
Layout Properties
If a layout manager has layout properties, that is properties that
should exist only as the result of the presence of a specific (layout
manager, container actor, child actor) combination, and it wishes to store
those properties inside a ClutterLayoutMeta, then it should override the
ClutterLayoutManagerClass.get_child_meta_type() virtual function to return
the GType of the ClutterLayoutMeta sub-class used to store the layout
properties; optionally, the ClutterLayoutManager sub-class might also
override the ClutterLayoutManagerClass.create_child_meta() virtual function
to control how the ClutterLayoutMeta instance is created, otherwise the
default implementation will be equivalent to:
ClutterLayoutManagerClass *klass;
GType meta_type;
klass = CLUTTER_LAYOUT_MANAGER_GET_CLASS (manager);
meta_type = klass->get_child_meta_type (manager);
return g_object_new (meta_type,
"manager", manager,
"container", container,
"actor", actor,
NULL);
Where manager is the ClutterLayoutManager, container is the
ClutterContainer using the ClutterLayoutManager, and actor is
the ClutterActor child of the ClutterContainer.
Using ClutterLayoutManager with ClutterScript
ClutterLayoutManager instances can be created in the same way
as other objects in ClutterScript; properties can be set using the
common syntax.
Layout properties can be set on children of a container with
a ClutterLayoutManager using the layout:: modifier on the property
name, for instance:
{
"type" : "ClutterActor",
"layout-manager" : { "type" : "ClutterGridLayout" },
"children" : [
{
"type" : "ClutterText",
"text" : "Some text",
"layout::row" : 0,
"layout::column" : 0,
"layout::x-align" : "left",
"layout::y-align" : "center",
"layout::x-expand" : true,
"layout::y-expand" : true
},
{
"type" : "ClutterText",
"text" : "Some more text",
"layout::row" : 0,
"layout::column" : 1,
"layout::x-align" : "right",
"layout::y-align" : "center",
"layout::x-expand" : true,
"layout::y-expand" : true
}
]
}
Available since: 13
Instance methods
clutter_layout_manager_child_get
Retrieves the values for a list of properties out of the
ClutterLayoutMeta created by manager and attached to the
child of a container.
since: 13
clutter_layout_manager_child_get_property
Gets a property on the ClutterLayoutMeta created by manager and
attached to a child of container.
since: 13
clutter_layout_manager_child_set
Sets a list of properties and their values on the ClutterLayoutMeta
associated by manager to a child of container.
since: 13
clutter_layout_manager_child_set_property
Sets a property on the ClutterLayoutMeta created by manager and
attached to a child of container.
since: 13
clutter_layout_manager_find_child_property
Retrieves the GParamSpec for the layout property name inside
the ClutterLayoutMeta sub-class used by manager.
since: 13
clutter_layout_manager_get_child_meta
Retrieves the ClutterLayoutMeta that the layout manager associated
to the actor child of container, eventually by creating one if the
ClutterLayoutManager supports layout properties.
since: 13
clutter_layout_manager_get_preferred_height
Computes the minimum and natural heights of the container according
to manager.
since: 13
clutter_layout_manager_get_preferred_width
Computes the minimum and natural widths of the container according
to manager.
since: 13
clutter_layout_manager_layout_changed
Emits the ClutterLayoutManager::layout-changed signal on manager.
since: 13
clutter_layout_manager_list_child_properties
Retrieves all the GParamSpecs for the layout properties
stored inside the ClutterLayoutMeta sub-class used by manager.
since: 13
clutter_layout_manager_set_container
If the ClutterLayoutManager sub-class allows it, allow
adding a weak reference of the container using manager
from within the layout manager.
since: 13
Signals
Clutter.LayoutManager::layout-changed
The signal is emitted each time a layout manager
has been changed. Every ClutterActor using the manager instance
as a layout manager should connect a handler to the
ClutterLayoutManager::layout-changed
signal and queue a relayout on themselves:
since: 13
Signals inherited from GObject (1)
GObject::notify
The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.
since: 2.0
Class structure
struct ClutterLayoutManagerClass {
void (* get_preferred_width) (
ClutterLayoutManager* manager,
ClutterContainer* container,
gfloat for_height,
gfloat* min_width_p,
gfloat* nat_width_p
);
void (* get_preferred_height) (
ClutterLayoutManager* manager,
ClutterContainer* container,
gfloat for_width,
gfloat* min_height_p,
gfloat* nat_height_p
);
void (* allocate) (
ClutterLayoutManager* manager,
ClutterContainer* container,
const ClutterActorBox* allocation
);
void (* set_container) (
ClutterLayoutManager* manager,
ClutterContainer* container
);
GType (* get_child_meta_type) (
ClutterLayoutManager* manager
);
ClutterLayoutMeta* (* create_child_meta) (
ClutterLayoutManager* manager,
ClutterContainer* container,
ClutterActor* actor
);
void (* layout_changed) (
ClutterLayoutManager* manager
);
}
The ClutterLayoutManagerClass structure contains only private
data and should be accessed using the provided API.
Class members
get_preferred_width: void (* get_preferred_width) ( ClutterLayoutManager* manager, ClutterContainer* container, gfloat for_height, gfloat* min_width_p, gfloat* nat_width_p )- No description available.
get_preferred_height: void (* get_preferred_height) ( ClutterLayoutManager* manager, ClutterContainer* container, gfloat for_width, gfloat* min_height_p, gfloat* nat_height_p )- No description available.
allocate: void (* allocate) ( ClutterLayoutManager* manager, ClutterContainer* container, const ClutterActorBox* allocation )- No description available.
set_container: void (* set_container) ( ClutterLayoutManager* manager, ClutterContainer* container )- No description available.
get_child_meta_type: GType (* get_child_meta_type) ( ClutterLayoutManager* manager )- No description available.
create_child_meta: ClutterLayoutMeta* (* create_child_meta) ( ClutterLayoutManager* manager, ClutterContainer* container, ClutterActor* actor )- No description available.
layout_changed: void (* layout_changed) ( ClutterLayoutManager* manager )- No description available.
Virtual methods
Clutter.LayoutManagerClass.get_preferred_height
Computes the minimum and natural heights of the container according
to manager.
since: 13
Clutter.LayoutManagerClass.get_preferred_width
Computes the minimum and natural widths of the container according
to manager.
since: 13
Clutter.LayoutManagerClass.layout_changed
Emits the ClutterLayoutManager::layout-changed signal on manager.
since: 13
Clutter.LayoutManagerClass.set_container
If the ClutterLayoutManager sub-class allows it, allow
adding a weak reference of the container using manager
from within the layout manager.
since: 13