BoxProtocol
public protocol BoxProtocol : ContainerProtocol, OrientableProtocol
The GtkBox widget arranges child widgets into a single row or column,
depending upon the value of its GtkOrientable:orientation property. Within
the other dimension, all children are allocated the same size. Of course,
the GtkWidget:halign and GtkWidget:valign properties can be used on
the children to influence their allocation.
GtkBox uses a notion of packing. Packing refers
to adding widgets with reference to a particular position in a
GtkContainer. For a GtkBox, there are two reference positions: the
start and the end of the box.
For a vertical GtkBox, the start is defined as the top of the box and
the end is defined as the bottom. For a horizontal GtkBox the start
is defined as the left side and the end is defined as the right side.
Use repeated calls to gtk_box_pack_start() to pack widgets into a
GtkBox from start to end. Use gtk_box_pack_end() to add widgets from
end to start. You may intersperse these calls and add widgets from
both ends of the same GtkBox.
Because GtkBox is a GtkContainer, you may also use gtk_container_add()
to insert widgets into the box, and they will be packed with the default
values for expand and fill child properties. Use gtk_container_remove()
to remove widgets from the GtkBox.
Use gtk_box_set_homogeneous() to specify whether or not all children
of the GtkBox are forced to get the same amount of space.
Use gtk_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, while
padding added by gtk_box_pack_start() or gtk_box_pack_end() is added
on either side of the widget it belongs to.
Use gtk_box_reorder_child() to move a GtkBox child to a different
place in the box.
Use gtk_box_set_child_packing() to reset the expand,
fill and padding child properties.
Use gtk_box_query_child_packing() to query these fields.
CSS nodes
GtkBox uses a single CSS node with name box.
In horizontal orientation, the nodes of the children are always arranged from left to right. So :first-child will always select the leftmost child, regardless of text direction.
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) -
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
-
set(child:Extension methodproperties: ) Set the property of a child widget of this box
Declaration
Swift
@inlinable func set<W>(child widget: W, properties: [(BoxPropertyName, Any)]) where W : WidgetProtocolParameters
childwidget to set property for
propertyname of the property
valuevalue to set
-
set(child:Extension methodproperties: ) Set up a child widget of this box with the given list of properties
Declaration
Swift
@inlinable func set<W>(child widget: W, properties ps: (BoxPropertyName, Any)...) where W : WidgetProtocolParameters
widgetchild widget to set properties for
propertiesPropertyName/ value pairs to set -
add(_:Extension methodproperties: ) Add a child widget to this box with a given list of properties
Declaration
Swift
@inlinable func add<W>(_ widget: W, properties ps: (BoxPropertyName, Any)...) where W : WidgetProtocolParameters
widgetchild widget to add
propertiesPropertyName/ value pairs of properties to set -
add(_:Extension methodproperty: value: ) Add a child widget to this box with a given property
Declaration
Swift
@inlinable func add<W, V>(_ widget: W, property p: BoxPropertyName, value v: V) where W : WidgetProtocolParameters
widgetchild widget to add
propertyname of the property to set
valuevalue of the property to set
-
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
-
getBaselinePosition()Extension methodGets the value set by
gtk_box_set_baseline_position().Declaration
Swift
@inlinable func getBaselinePosition() -> GtkBaselinePosition -
getCenterWidget()Extension methodRetrieves the center widget of the box.
Declaration
Swift
@inlinable func getCenterWidget() -> WidgetRef! -
getHomogeneous()Extension methodReturns whether the box is homogeneous (all children are the same size). See
gtk_box_set_homogeneous().Declaration
Swift
@inlinable func getHomogeneous() -> Bool -
getSpacing()Extension methodGets the value set by
gtk_box_set_spacing().Declaration
Swift
@inlinable func getSpacing() -> Int -
packEnd(child:Extension methodexpand: fill: padding: ) Adds
childtobox, packed with reference to the end ofbox. Thechildis packed after (away from end of) any other child packed with reference to the end ofbox.Declaration
Swift
@inlinable func packEnd<WidgetT>(child: WidgetT, expand: Bool, fill: Bool, padding: Int) where WidgetT : WidgetProtocol -
packStart(child:Extension methodexpand: fill: padding: ) Adds
childtobox, packed with reference to the start ofbox. Thechildis packed after any other child packed with reference to the start ofbox.Declaration
Swift
@inlinable func packStart<WidgetT>(child: WidgetT, expand: Bool, fill: Bool, padding: Int) where WidgetT : WidgetProtocol -
queryChildPacking(child:Extension methodexpand: fill: padding: packType: ) Obtains information about how
childis packed intobox.Declaration
Swift
@inlinable func queryChildPacking<WidgetT>(child: WidgetT, expand: UnsafeMutablePointer<gboolean>!, fill: UnsafeMutablePointer<gboolean>!, padding: UnsafeMutablePointer<guint>!, packType: UnsafeMutablePointer<GtkPackType>!) where WidgetT : WidgetProtocol -
reorder(child:Extension methodposition: ) Moves
childto a newpositionin the list ofboxchildren. The list contains widgets packedGTK_PACK_STARTas well as widgets packedGTK_PACK_END, in the order that these widgets were added tobox.A widget’s position in the
boxchildren list determines where the widget is packed intobox. A child widget at some position in the list will be packed just after all other widgets of the same packing type that appear earlier in the list.Declaration
Swift
@inlinable func reorder<WidgetT>(child: WidgetT, position: Int) 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 wrt the extra space available.Declaration
Swift
@inlinable func setBaseline(position: GtkBaselinePosition) -
setCenter(widget:Extension method) Sets a center widget; that is a child widget that will be centered with respect to the full width of the box, even if the children at either side take up different amounts of space.
Declaration
Swift
@inlinable func setCenter(widget: WidgetRef? = nil) -
setCenter(widget:Extension method) Sets a center widget; that is a child widget that will be centered with respect to the full width of the box, even if the children at either side take up different amounts of space.
Declaration
Swift
@inlinable func setCenter<WidgetT>(widget: WidgetT?) where WidgetT : WidgetProtocol -
setChildPacking(child:Extension methodexpand: fill: padding: packType: ) Sets the way
childis packed intobox.Declaration
Swift
@inlinable func setChildPacking<WidgetT>(child: WidgetT, expand: Bool, fill: Bool, padding: Int, packType: GtkPackType) where WidgetT : WidgetProtocol -
set(homogeneous:Extension method) Sets the
GtkBox:homogeneousproperty ofbox, controlling whether or not all children ofboxare given equal space in the box.Declaration
Swift
@inlinable func set(homogeneous: Bool) -
set(spacing:Extension method) Sets the
GtkBox:spacingproperty ofbox, which is the number of pixels to place between children ofbox.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 } -
centerWidgetExtension methodRetrieves the center widget of the box.
Declaration
Swift
@inlinable var centerWidget: WidgetRef! { get nonmutating set } -
homogeneousExtension methodUndocumented
Declaration
Swift
@inlinable var homogeneous: Bool { get nonmutating set } -
spacingExtension methodUndocumented
Declaration
Swift
@inlinable var spacing: Int { get nonmutating set } -
containerExtension methodUndocumented
Declaration
Swift
@inlinable var container: GtkContainer { get }
View on GitHub
Install in Dash
BoxProtocol Protocol Reference