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
GtkBox
instance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get }
-
box_ptr
Default implementationTyped pointer to the underlying
GtkBox
instance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkBox
instance.Declaration
Swift
var box_ptr: UnsafeMutablePointer<GtkBox>! { get }
-
Required Initialiser for types conforming to
BoxProtocol
Declaration
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 : WidgetProtocol
Parameters
children
sequence of widgets to append
-
set(marginStart:
Extension method) Set the start margin of the box
Declaration
Swift
@inlinable func set(marginStart: Int)
Parameters
marginStart
start margin
-
set(marginEnd:
Extension method) Set the end margin of the box
Declaration
Swift
@inlinable func set(marginEnd: Int)
Parameters
marginEnd
end margin
-
bind(property:
Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
BoxPropertyName
source 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 : ObjectProtocol
Parameters
source_property
the source property to bind
target
the target object to bind to
target_property
the target property to bind to
flags
the flags to pass to the
Binding
transform_from
ValueTransformer
to use for forward transformationtransform_to
ValueTransformer
to use for backwards transformationReturn Value
binding reference or
nil
in case of an error -
get(property:
Extension method) Get the value of a Box property
Declaration
Swift
@inlinable func get(property: BoxPropertyName) -> GLibObject.Value
Parameters
property
the 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
property
the property to get the value for
Return Value
the value of the named property
-
append(child:
Extension method) Adds
child
as 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
child
in the position aftersibling
in the list ofbox
children.If
sibling
isnil
, insertchild
at the first position.Declaration
Swift
@inlinable func insertChildAfter<WidgetT>(child: WidgetT, sibling: WidgetT?) where WidgetT : WidgetProtocol
-
prepend(child:
Extension method) Adds
child
as 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
child
to the position aftersibling
in the list ofbox
children.If
sibling
isnil
, movechild
to 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
position
is 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
box
are 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)
-
baselinePosition
Extension methodGets the value set by
gtk_box_set_baseline_position()
.Declaration
Swift
@inlinable var baselinePosition: GtkBaselinePosition { get nonmutating set }
-
homogeneous
Extension methodWhether the children should all be the same size.
Declaration
Swift
@inlinable var homogeneous: Bool { get nonmutating set }
-
spacing
Extension methodThe amount of space between children.
Declaration
Swift
@inlinable var spacing: Int { get nonmutating set }
-
parentInstance
Extension methodUndocumented
Declaration
Swift
@inlinable var parentInstance: GtkWidget { get }