Class
ClutterLayoutManager
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 container
ClutterActor by implementing the
Clutter.LayoutManagerClass.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
Clutter.LayoutManagerClass.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 Clutter.LayoutManagerClass.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
ClutterActor using the ClutterLayoutManager, and actor is
the ClutterActor child of the ClutterActor.
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.
clutter_layout_manager_child_get_property
Gets a property on the ClutterLayoutMeta created by manager and
attached to a child of container.
clutter_layout_manager_child_set
Sets a list of properties and their values on the ClutterLayoutMeta
associated by manager to a child of container.
clutter_layout_manager_child_set_property
Sets a property on the ClutterLayoutMeta created by manager and
attached to a child of container.
clutter_layout_manager_find_child_property
Retrieves the GParamSpec for the layout property name inside the ClutterLayoutMeta sub-class used by manager.
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.
clutter_layout_manager_get_preferred_height
Computes the minimum and natural heights of the container according to manager.
clutter_layout_manager_get_preferred_width
Computes the minimum and natural widths of the container according to manager.
clutter_layout_manager_layout_changed
Emits the ClutterLayoutManager::layout-changed signal on manager.
clutter_layout_manager_list_child_properties
Retrieves all the GParamSpecs for the layout properties
stored inside the ClutterLayoutMeta sub-class used by manager.
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.
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:.
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.
Class structure
struct ClutterLayoutManagerClass {
void (* get_preferred_width) (
ClutterLayoutManager* manager,
ClutterActor* container,
gfloat for_height,
gfloat* min_width_p,
gfloat* nat_width_p
);
void (* get_preferred_height) (
ClutterLayoutManager* manager,
ClutterActor* container,
gfloat for_width,
gfloat* min_height_p,
gfloat* nat_height_p
);
void (* allocate) (
ClutterLayoutManager* manager,
ClutterActor* container,
const ClutterActorBox* allocation
);
void (* set_container) (
ClutterLayoutManager* manager,
ClutterActor* container
);
GType (* get_child_meta_type) (
ClutterLayoutManager* manager
);
ClutterLayoutMeta* (* create_child_meta) (
ClutterLayoutManager* manager,
ClutterActor* 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, ClutterActor* container, gfloat for_height, gfloat* min_width_p, gfloat* nat_width_p )Virtual function; override to provide a preferred width for the layout manager. See also the
get_preferred_width()virtual function inClutterActor.get_preferred_height: void (* get_preferred_height) ( ClutterLayoutManager* manager, ClutterActor* container, gfloat for_width, gfloat* min_height_p, gfloat* nat_height_p )Virtual function; override to provide a preferred height for the layout manager. See also the
get_preferred_height()virtual function inClutterActor.allocate: void (* allocate) ( ClutterLayoutManager* manager, ClutterActor* container, const ClutterActorBox* allocation )Virtual function; override to allocate the children of the layout manager. See also the
allocate()virtual function inClutterActor.set_container: void (* set_container) ( ClutterLayoutManager* manager, ClutterActor* container )Virtual function; override to set a back pointer on the
ClutterActorusing the layout manager. The implementation should not take a reference on the container, but just take a weak reference, to avoid potential leaks due to reference cycles.get_child_meta_type: GType (* get_child_meta_type) ( ClutterLayoutManager* manager )Virtual function; override to return the
GTypeof theClutterLayoutMetasub-class used by theClutterLayoutManager.create_child_meta: ClutterLayoutMeta* (* create_child_meta) ( ClutterLayoutManager* manager, ClutterActor* container, ClutterActor* actor )Virtual function; override to create a
ClutterLayoutMetainstance associated to a containerClutterActorand a childClutterActor, used to maintain layout manager specific properties.layout_changed: void (* layout_changed) ( ClutterLayoutManager* manager )Class handler for the
ClutterLayoutManager::layout-changedsignal.
Virtual methods
Clutter.LayoutManagerClass.create_child_meta
Virtual function; override to create a
ClutterLayoutMeta instance associated to a container
ClutterActor and a child ClutterActor, used to maintain
layout manager specific properties.
Clutter.LayoutManagerClass.get_child_meta_type
Virtual function; override to return the GType
of the ClutterLayoutMeta sub-class used by the ClutterLayoutManager.
Clutter.LayoutManagerClass.get_preferred_height
Computes the minimum and natural heights of the container according to manager.
Clutter.LayoutManagerClass.get_preferred_width
Computes the minimum and natural widths of the container according to manager.
Clutter.LayoutManagerClass.layout_changed
Emits the ClutterLayoutManager::layout-changed signal on manager.
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.