1.107 <GtkLayoutManager>

Class: <GtkLayoutManager>

It derives from <GObject>.

Handles the preferred size and allocation for children of a widget.

You typically subclass <GtkLayoutManager> 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 <GtkWidget> can only have a <GtkLayoutManager> instance associated to it at any given time; it is possible, though, to replace the layout manager instance using widget:set-layout-manager.

Layout properties

A layout manager can expose properties for controlling the layout of each child, by creating an object type derived from <GtkLayoutChild> and installing the properties on it as normal <GObject> properties.

Each <GtkLayoutChild> instance storing the layout properties for a specific child is created through the layout-manager:get-layout-child method; a <GtkLayoutManager> controls the creation of its <GtkLayoutChild> instances 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-child:layout-manager and layout-child:child-widget properties on the newly created <GtkLayoutChild> instance are mandatory. The <GtkLayoutManager> will cache the newly created <GtkLayoutChild> instance until the widget is removed from its parent, or the parent removes the layout manager.

Each <GtkLayoutManager> instance creating a <GtkLayoutChild> should use layout-manager:get-layout-child every time it needs to query the layout properties; each <GtkLayoutChild> instance should call layout-manager:layout-changed every time a property is updated, in order to queue a new size measuring and allocation.

Fields

parent-instance

Procedures

Method: layout-manager:allocate self widget width height baseline
Method: allocate self widget width height baseline

Assigns the given width, height, and baseline to a widget, and computes the position and sizes of the children of the widget using the layout management policy of self.

self

Passed: a <GtkLayoutManager>.

a <GtkLayoutManager>

widget

Passed: a <GtkWidget>.

the <GtkWidget> using self

width

Passed: a 32-bit integer.

the new width of the widget

height

Passed: a 32-bit integer.

the new height of the widget

baseline

Passed: a 32-bit integer.

the baseline position of the widget, or -1

Method: layout-manager:get-layout-child self child ⇒ %return
Method: get-layout-child self child ⇒ %return

Retrieves a <GtkLayoutChild> instance for the <GtkLayoutManager>, creating one if necessary.

The child widget must be a child of the widget using self.

The <GtkLayoutChild> instance is owned by the <GtkLayoutManager>, and is guaranteed to exist as long as child is a child of the <GtkWidget> using the given <GtkLayoutManager>.

self

Passed: a <GtkLayoutManager>.

a <GtkLayoutManager>

child

Passed: a <GtkWidget>.

a <GtkWidget>

%return

Returned: a <GtkLayoutChild>.

a <GtkLayoutChild>

Method: layout-manager:get-request-mode self ⇒ %return
Method: get-request-mode self ⇒ %return

Retrieves the request mode of self.

self

Passed: a <GtkLayoutManager>.

a <GtkLayoutManager>

%return

Returned: a <GtkSizeRequestMode>.

a <GtkSizeRequestMode>

Method: layout-manager:get-widget self ⇒ %return
Method: get-widget self ⇒ %return

Retrieves the <GtkWidget> using the given <GtkLayoutManager>.

self

Passed: a <GtkLayoutManager>.

a <GtkLayoutManager>

%return

Returned: a <GtkWidget>, or #f.

a <GtkWidget>

Method: layout-manager:layout-changed self
Method: layout-changed self

Queues a resize on the <GtkWidget> using self, if any.

This function should be called by subclasses of <GtkLayoutManager> in response to changes to their layout management policies.

self

Passed: a <GtkLayoutManager>.

a <GtkLayoutManager>

Method: layout-manager:measure self widget orientation for-size ⇒ minimum natural minimum-baseline natural-baseline
Method: measure self widget orientation for-size ⇒ minimum natural minimum-baseline natural-baseline

Measures the size of the widget using self, for the given orientation and size.

See the <GtkWidget> documentation on layout management for more details.

self

Passed: a <GtkLayoutManager>.

a <GtkLayoutManager>

widget

Passed: a <GtkWidget>.

the <GtkWidget> using self

orientation

Passed: a <GtkOrientation>, or one of its symbols.

the orientation to measure

for-size

Passed: a 32-bit integer.

Size for the opposite of orientation; for instance, if the orientation is horizontal, this is the height of the widget; if the orientation is vertical, this is the width of the widget. This allows to measure the height for the given width, and the width for the given height. Use -1 if the size is not known

minimum

Returned: a 32-bit integer.

the minimum size for the given size and orientation

natural

Returned: a 32-bit integer.

the natural, or preferred size for the given size and orientation

minimum-baseline

Returned: a 32-bit integer.

the baseline position for the minimum size

natural-baseline

Returned: a 32-bit integer.

the baseline position for the natural size

Virtual methods

Virtual method: layout-manager:do-allocate implementor self widget width height baseline

Assigns the given width, height, and baseline to a widget, and computes the position and sizes of the children of the widget using the layout management policy of self.

To override it in a new class, give register-type #:vfuncs `((allocate . ,procedure)). The procedure is called as (procedure self widget width height baseline).

implementor

Passed: the class whose implementation to call: <GtkLayoutManager>, or a class that derives from it, or its GType number.

self

Passed: a <GtkLayoutManager>.

a <GtkLayoutManager>

widget

Passed: a <GtkWidget>.

the <GtkWidget> using self

width

Passed: a 32-bit integer.

the new width of the widget

height

Passed: a 32-bit integer.

the new height of the widget

baseline

Passed: a 32-bit integer.

the baseline position of the widget, or -1

Virtual method: layout-manager:do-create-layout-child implementor self widget for-child ⇒ %return

Create a <GtkLayoutChild> instance for the given for-child widget.

To override it in a new class, give register-type #:vfuncs `((create-layout-child . ,procedure)). The procedure is called as (procedure self widget for-child) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GtkLayoutManager>, or a class that derives from it, or its GType number.

self

Passed: a <GtkLayoutManager>.

the <GtkLayoutManager>

widget

Passed: a <GtkWidget>.

the widget using the self

for-child

Passed: a <GtkWidget>.

the child of widget

%return

Returned: a <GtkLayoutChild>.

a <GtkLayoutChild>

Virtual method: layout-manager:do-get-request-mode implementor self widget ⇒ %return

a virtual function, used to return the preferred request mode for the layout manager; for instance, "width for height" or "height for width"; see <GtkSizeRequestMode>

To override it in a new class, give register-type #:vfuncs `((get-request-mode . ,procedure)). The procedure is called as (procedure self widget) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GtkLayoutManager>, or a class that derives from it, or its GType number.

self

Passed: a <GtkLayoutManager>.

widget

Passed: a <GtkWidget>.

%return

Returned: a <GtkSizeRequestMode>.

Virtual method: layout-manager:do-measure implementor self widget orientation for-size ⇒ minimum natural minimum-baseline natural-baseline

Measures the size of the widget using self, for the given orientation and size.

See the <GtkWidget> documentation on layout management for more details.

To override it in a new class, give register-type #:vfuncs `((measure . ,procedure)). The procedure is called as (procedure self widget orientation for-size) ⇒ minimum natural minimum-baseline natural-baseline.

implementor

Passed: the class whose implementation to call: <GtkLayoutManager>, or a class that derives from it, or its GType number.

self

Passed: a <GtkLayoutManager>.

a <GtkLayoutManager>

widget

Passed: a <GtkWidget>.

the <GtkWidget> using self

orientation

Passed: a <GtkOrientation>, or one of its symbols.

the orientation to measure

for-size

Passed: a 32-bit integer.

Size for the opposite of orientation; for instance, if the orientation is horizontal, this is the height of the widget; if the orientation is vertical, this is the width of the widget. This allows to measure the height for the given width, and the width for the given height. Use -1 if the size is not known

minimum

Returned: a 32-bit integer.

the minimum size for the given size and orientation

natural

Returned: a 32-bit integer.

the natural, or preferred size for the given size and orientation

minimum-baseline

Returned: a 32-bit integer.

the baseline position for the minimum size

natural-baseline

Returned: a 32-bit integer.

the baseline position for the natural size

Virtual method: layout-manager:do-root implementor self

a virtual function, called when the widget using the layout manager is attached to a <GtkRoot>

To override it in a new class, give register-type #:vfuncs `((root . ,procedure)). The procedure is called as (procedure self).

implementor

Passed: the class whose implementation to call: <GtkLayoutManager>, or a class that derives from it, or its GType number.

self

Passed: a <GtkLayoutManager>.

Virtual method: layout-manager:do-unroot implementor self

a virtual function, called when the widget using the layout manager is detached from a <GtkRoot>

To override it in a new class, give register-type #:vfuncs `((unroot . ,procedure)). The procedure is called as (procedure self).

implementor

Passed: the class whose implementation to call: <GtkLayoutManager>, or a class that derives from it, or its GType number.

self

Passed: a <GtkLayoutManager>.