Package: gtk

Class gtk:layout-manager

Superclasses

gobject:object, common-lisp:standard-object, common-lisp:t

Documented Subclasses

Direct Slots

None

Details

Layout managers are delegate classes that handle the preferred size and the allocation of a container widget. You typically subclass the gtk:layout-manager class if you want to implement a layout policy for the children of a widget, or if you want to determine the size of a widget depending on its contents.

Each gtk:widget object can only have one gtk:layout-manager object associated to it at any given time. It is possible, though, to replace the layout manager object using the gtk:widget-layout-manager function.

Layout properties
A layout manager can expose properties for controlling the layout of each child, by creating an object type derived from the gtk:layout-child class and installing the properties on it as normal g:object properties.

Each gtk:layout-child object storing the layout properties for a specific child widget is created through the gtk:layout-manager-layout-child function. A layout manager controls the creation of its gtk:layout-child objects by overriding the GtkLayoutManagerClass.create_layout_child() virtual function. The typical implementation should look like:
static GtkLayoutChild *
create_layout_child (GtkLayoutManager *manager,
                     GtkWidget        *container,
                     GtkWidget        *child)
{
  return g_object_new (your_layout_child_get_type (),
                       "layout-manager", manager,
                       "child-widget", child,
                       NULL);
}  
The layout-manager and child-widget properties on the newly created gtk:layout-child object are mandatory. The gtk:layout-manager object will cache the newly created gtk:layout-child object until the widget is removed from its parent, or the parent removes the layout manager.

Each gtk:layout-manager object creating a gtk:layout-child object should use the gtk:layout-manager-layout-child function every time it needs to query the layout properties. Each gtk:layout-child object should call the gtk:layout-manager-layout-changed function every time a property is updated, in order to queue a new size measuring and allocation.
 

Inherited Slot Access Functions

See also

2024-10-14