LayoutManagerRef
public struct LayoutManagerRef : LayoutManagerProtocol, GWeakCapturing
Layout managers are delegate classes that handle the preferred size and the allocation 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 [methodGtk.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 [classGtk.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 [methodGtk.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:
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 [propertyGtk.LayoutChild:layout-manager
] and
[propertyGtk.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
[methodGtk.LayoutManager.get_layout_child
] every time it needs to query
the layout properties; each GtkLayoutChild
instance should call
[methodGtk.LayoutManager.layout_changed
] every time a property is
updated, in order to queue a new size measuring and allocation.
The LayoutManagerRef
type acts as a lightweight Swift reference to an underlying GtkLayoutManager
instance.
It exposes methods that can operate on this data type through LayoutManagerProtocol
conformance.
Use LayoutManagerRef
only as an unowned
reference to an existing GtkLayoutManager
instance.
-
Untyped pointer to the underlying `GtkLayoutManager` instance.
For type-safe access, use the generated, typed pointer
layout_manager_ptr
property instead.Declaration
Swift
public let ptr: UnsafeMutableRawPointer!
-
Designated initialiser from the underlying
C
data typeDeclaration
Swift
@inlinable init(_ p: UnsafeMutablePointer<GtkLayoutManager>)
-
Designated initialiser from a constant pointer to the underlying
C
data typeDeclaration
Swift
@inlinable init(_ p: UnsafePointer<GtkLayoutManager>)
-
Conditional initialiser from an optional pointer to the underlying
C
data typeDeclaration
Swift
@inlinable init!(_ maybePointer: UnsafeMutablePointer<GtkLayoutManager>?)
-
Conditional initialiser from an optional, non-mutable pointer to the underlying
C
data typeDeclaration
Swift
@inlinable init!(_ maybePointer: UnsafePointer<GtkLayoutManager>?)
-
Conditional initialiser from an optional
gpointer
Declaration
Swift
@inlinable init!(gpointer g: gpointer?)
-
Conditional initialiser from an optional, non-mutable
gconstpointer
Declaration
Swift
@inlinable init!(gconstpointer g: gconstpointer?)
-
Reference intialiser for a related type that implements
LayoutManagerProtocol
Declaration
Swift
@inlinable init<T>(_ other: T) where T : LayoutManagerProtocol
-
This factory is syntactic sugar for setting weak pointers wrapped in
GWeak<T>
Declaration
Swift
@inlinable static func unowned<T>(_ other: T) -> LayoutManagerRef where T : LayoutManagerProtocol
-
Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
LayoutManagerProtocol
.Declaration
Swift
@inlinable init<T>(cPointer: UnsafeMutablePointer<T>)
-
Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
LayoutManagerProtocol
.Declaration
Swift
@inlinable init<T>(constPointer: UnsafePointer<T>)
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
LayoutManagerProtocol
.Declaration
Swift
@inlinable init(mutating raw: UnsafeRawPointer)
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
LayoutManagerProtocol
.Declaration
Swift
@inlinable init(raw: UnsafeMutableRawPointer)
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
LayoutManagerProtocol
.Declaration
Swift
@inlinable init(opaquePointer: OpaquePointer)