BoxProtocol
public protocol BoxProtocol : OrientableProtocol, WidgetProtocol
The GtkBox widget arranges child widgets into a single row or column.

Whether it is a row or column depends on the value of its
[propertyGtk.Orientable:orientation] property. Within the other
dimension, all children are allocated the same size. Of course, the
[propertyGtk.Widget:halign] and [propertyGtk.Widget:valign] properties
can be used on the children to influence their allocation.
Use repeated calls to [methodGtk.Box.append] to pack widgets into a
GtkBox from start to end. Use [methodGtk.Box.remove] to remove widgets
from the GtkBox. [methodGtk.Box.insert_child_after] can be used to add
a child at a particular position.
Use [methodGtk.Box.set_homogeneous] to specify whether or not all children
of the GtkBox are forced to get the same amount of space.
Use [methodGtk.Box.set_spacing] to determine how much space will be minimally
placed between all children in the GtkBox. Note that spacing is added
between the children.
Use [methodGtk.Box.reorder_child_after] to move a child to a different
place in the box.
CSS nodes
GtkBox uses a single CSS node with name box.
Accessibility
GtkBox uses the GTK_ACCESSIBLE_ROLE_GROUP role.
The BoxProtocol protocol exposes the methods and properties of an underlying GtkBox instance.
The default implementation of these can be found in the protocol extension below.
For a concrete class that implements these methods and properties, see Box.
Alternatively, use BoxRef as a lighweight, unowned reference if you already have an instance you just want to use.
-
Untyped pointer to the underlying
GtkBoxinstance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get } -
box_ptrDefault implementationTyped pointer to the underlying
GtkBoxinstance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkBoxinstance.Declaration
Swift
var box_ptr: UnsafeMutablePointer<GtkBox>! { get } -
Required Initialiser for types conforming to
BoxProtocolDeclaration
Swift
init(raw: UnsafeMutableRawPointer) -
append(children:Extension method) Append a list of children
Declaration
Swift
@inlinable func append<S>(children: S) where S : Sequence, S.Element : WidgetProtocolParameters
childrensequence of widgets to append
-
set(marginStart:Extension method) Set the start margin of the box
Declaration
Swift
@inlinable func set(marginStart: Int)Parameters
marginStartstart margin
-
set(marginEnd:Extension method) Set the end margin of the box
Declaration
Swift
@inlinable func set(marginEnd: Int)Parameters
marginEndend margin
-
bind(property:Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
BoxPropertyNamesource property to a given target object.Declaration
Swift
@discardableResult @inlinable func bind<Q, T>(property source_property: BoxPropertyName, to target: T, _ target_property: Q, flags f: BindingFlags = .default, transformFrom transform_from: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }, transformTo transform_to: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }) -> BindingRef! where Q : PropertyNameProtocol, T : ObjectProtocolParameters
source_propertythe source property to bind
targetthe target object to bind to
target_propertythe target property to bind to
flagsthe flags to pass to the
Bindingtransform_fromValueTransformerto use for forward transformationtransform_toValueTransformerto use for backwards transformationReturn Value
binding reference or
nilin case of an error -
get(property:Extension method) Get the value of a Box property
Declaration
Swift
@inlinable func get(property: BoxPropertyName) -> GLibObject.ValueParameters
propertythe property to get the value for
Return Value
the value of the named property
-
set(property:Extension methodvalue: ) Set the value of a Box property. Note that this will only have an effect on properties that are writable and not construct-only!
Declaration
Swift
@inlinable func set(property: BoxPropertyName, value v: GLibObject.Value)Parameters
propertythe property to get the value for
Return Value
the value of the named property
-
append(child:Extension method) Adds
childas the last child tobox.Declaration
Swift
@inlinable func append<WidgetT>(child: WidgetT) where WidgetT : WidgetProtocol -
getBaselinePosition()Extension methodGets the value set by
gtk_box_set_baseline_position().Declaration
Swift
@inlinable func getBaselinePosition() -> GtkBaselinePosition -
getHomogeneous()Extension methodReturns whether the box is homogeneous (all children are the same size).
Declaration
Swift
@inlinable func getHomogeneous() -> Bool -
getSpacing()Extension methodGets the value set by
gtk_box_set_spacing().Declaration
Swift
@inlinable func getSpacing() -> Int -
insertChildAfter(child:Extension methodsibling: ) Inserts
childin the position aftersiblingin the list ofboxchildren.If
siblingisnil, insertchildat the first position.Declaration
Swift
@inlinable func insertChildAfter<WidgetT>(child: WidgetT, sibling: WidgetT?) where WidgetT : WidgetProtocol -
prepend(child:Extension method) Adds
childas the first child tobox.Declaration
Swift
@inlinable func prepend<WidgetT>(child: WidgetT) where WidgetT : WidgetProtocol -
remove(child:Extension method) Removes a child widget from
box.The child must have been added before with [method
Gtk.Box.append], [methodGtk.Box.prepend], or [methodGtk.Box.insert_child_after].Declaration
Swift
@inlinable func remove<WidgetT>(child: WidgetT) where WidgetT : WidgetProtocol -
reorderChildAfter(child:Extension methodsibling: ) Moves
childto the position aftersiblingin the list ofboxchildren.If
siblingisnil, movechildto the first position.Declaration
Swift
@inlinable func reorderChildAfter<WidgetT>(child: WidgetT, sibling: WidgetT?) where WidgetT : WidgetProtocol -
setBaseline(position:Extension method) Sets the baseline position of a box.
This affects only horizontal boxes with at least one baseline aligned child. If there is more vertical space available than requested, and the baseline is not allocated by the parent then
positionis used to allocate the baseline with respect to the extra space available.Declaration
Swift
@inlinable func setBaseline(position: GtkBaselinePosition) -
set(homogeneous:Extension method) Sets whether or not all children of
boxare given equal space in the box.Declaration
Swift
@inlinable func set(homogeneous: Bool) -
set(spacing:Extension method) Sets the number of pixels to place between children of
box.Declaration
Swift
@inlinable func set(spacing: Int) -
baselinePositionExtension methodGets the value set by
gtk_box_set_baseline_position().Declaration
Swift
@inlinable var baselinePosition: GtkBaselinePosition { get nonmutating set } -
homogeneousExtension methodWhether the children should all be the same size.
Declaration
Swift
@inlinable var homogeneous: Bool { get nonmutating set } -
spacingExtension methodThe amount of space between children.
Declaration
Swift
@inlinable var spacing: Int { get nonmutating set } -
parentInstanceExtension methodUndocumented
Declaration
Swift
@inlinable var parentInstance: GtkWidget { get }
View on GitHub
Install in Dash
BoxProtocol Protocol Reference