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.

Hierarchy

hierarchy this ClutterLayoutManager ancestor_0 GInitiallyUnowned ancestor_0--this ancestor_1 GObject ancestor_1--ancestor_0

Instance methods

clutter_layout_manager_allocate

Allocates the children of container given an area.

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.

Methods inherited from GObject (43)

Please see GObject for a full list of methods.

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 )

No description available.

get_preferred_height: void (* get_preferred_height) ( ClutterLayoutManager* manager, ClutterActor* container, gfloat for_width, gfloat* min_height_p, gfloat* nat_height_p )

No description available.

allocate: void (* allocate) ( ClutterLayoutManager* manager, ClutterActor* container, const ClutterActorBox* allocation )

No description available.

set_container: void (* set_container) ( ClutterLayoutManager* manager, ClutterActor* 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, ClutterActor* container, ClutterActor* actor )

No description available.

layout_changed: void (* layout_changed) ( ClutterLayoutManager* manager )

No description available.

Virtual methods

Clutter.LayoutManagerClass.allocate

Allocates the children of container given an area.

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.