Basics
Guides
API Reference
Basics
Guides
API Reference
[40:7] extends: object
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
[method@Gtk.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 [class@Gtk.LayoutChild] 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 [method@Gtk.LayoutManager.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: c 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
[property@Gtk.LayoutChild:layout-manager] and
[property@Gtk.LayoutChild: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
[method@Gtk.LayoutManager.get_layout_child] every time it needs to query the
layout properties; each GtkLayoutChild instance should call
[method@Gtk.LayoutManager.layout_changed] every time a property is updated,
in order to queue a new size measuring and allocation.
LayoutManager (Handle = null)
Creates a new
LayoutManagerby wrapping a native handle or another wrapper.
Handle is the native handle or another wrapper whose handle to adopt.toNativeHandle (Source)
Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from
fn.call(...), another generated wrapper exposinghandle(), or null. Returns null when the argument carries no pointer.
Source is the raw handle, raw buffer, wrapper, or null.A raw pointer carrier or null when no pointer is present.getLib ()
Returns the opened native library for this generated wrapper.
The opened native library.handle ()
Returns the wrapped NativeHandle.
The wrapped NativeHandle.isNull ()
Returns true when the wrapped handle is null.
A bool.describe ()
Returns a small string for debugging generated wrappers.
A string.asObject ()
Wraps this handle as
Object.
A Object object.allocate (object widget, int width, int height, int 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 @manager.
widget is the GtkWidget using @manager.width is the new width of the @widget.height is the new height of the @widget.baseline is the baseline position of the @widget, or -1.None.get_layout_child (object child)
Retrieves a
GtkLayoutChildinstance for theGtkLayoutManager, creating one if necessary. The @child widget must be a child of the widget using @manager. TheGtkLayoutChildinstance is owned by theGtkLayoutManager, and is guaranteed to exist as long as @child is a child of theGtkWidgetusing the givenGtkLayoutManager.
child is a GtkWidget.get_request_mode ()
Retrieves the request mode of @manager.
get_widget ()
Retrieves the
GtkWidgetusing the givenGtkLayoutManager.
layout_changed ()
Queues a resize on the
GtkWidgetusing @manager, if any. This function should be called by subclasses ofGtkLayoutManagerin response to changes to their layout management policies.
None.
Aussom
Write once. Embed everywhere.
Copyright 2026 Austin Lehman. All rights reserved.