GridProtocol
public protocol GridProtocol : ContainerProtocol, OrientableProtocol
GtkGrid is a container which arranges its child widgets in rows and columns, with arbitrary positions and horizontal/vertical spans.
Children are added using gtk_grid_attach(). They can span multiple
rows or columns. It is also possible to add a child next to an
existing child, using gtk_grid_attach_next_to(). The behaviour of
GtkGrid when several children occupy the same grid cell is undefined.
GtkGrid can be used like a GtkBox by just using gtk_container_add(),
which will place children next to each other in the direction determined
by the GtkOrientable:orientation property. However, if all you want is a
single row or column, then GtkBox is the preferred widget.
CSS nodes
GtkGrid uses a single CSS node with name grid.
The GridProtocol protocol exposes the methods and properties of an underlying GtkGrid 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 Grid.
Alternatively, use GridRef as a lighweight, unowned reference if you already have an instance you just want to use.
-
Untyped pointer to the underlying
GtkGridinstance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get } -
grid_ptrDefault implementationTyped pointer to the underlying
GtkGridinstance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkGridinstance.Declaration
Swift
var grid_ptr: UnsafeMutablePointer<GtkGrid>! { get } -
Required Initialiser for types conforming to
GridProtocolDeclaration
Swift
init(raw: UnsafeMutableRawPointer)
-
bind(property:Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
GridPropertyNamesource property to a given target object.Declaration
Swift
@discardableResult @inlinable func bind<Q, T>(property source_property: GridPropertyName, 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 Grid property
Declaration
Swift
@inlinable func get(property: GridPropertyName) -> 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 Grid property. Note that this will only have an effect on properties that are writable and not construct-only!
Declaration
Swift
@inlinable func set(property: GridPropertyName, value v: GLibObject.Value)Parameters
propertythe property to get the value for
Return Value
the value of the named property
-
attach(child:Extension methodleft: top: width: height: ) Adds a widget to the grid.
The position of
childis determined byleftandtop. The number of “cells” thatchildwill occupy is determined bywidthandheight.Declaration
Swift
@inlinable func attach<WidgetT>(child: WidgetT, left: Int, top: Int, width: Int, height: Int) where WidgetT : WidgetProtocol -
attachNextTo(child:Extension methodsibling: side: width: height: ) Adds a widget to the grid.
The widget is placed next to
sibling, on the side determined byside. Whensiblingisnil, the widget is placed in row (for left or right placement) or column 0 (for top or bottom placement), at the end indicated byside.Attaching widgets labeled [1], [2], [3] with
sibling==nilandside==GTK_POS_LEFTyields a layout of 3(#1).Declaration
Swift
@inlinable func attachNextTo<WidgetT>(child: WidgetT, sibling: WidgetT?, side: GtkPositionType, width: Int, height: Int) where WidgetT : WidgetProtocol -
getBaselineRow()Extension methodReturns which row defines the global baseline of
grid.Declaration
Swift
@inlinable func getBaselineRow() -> Int -
getChildAt(left:Extension methodtop: ) Gets the child of
gridwhose area covers the grid cell whose upper left corner is atleft,top.Declaration
Swift
@inlinable func getChildAt(left: Int, top: Int) -> WidgetRef! -
getColumnHomogeneous()Extension methodReturns whether all columns of
gridhave the same width.Declaration
Swift
@inlinable func getColumnHomogeneous() -> Bool -
getColumnSpacing()Extension methodReturns the amount of space between the columns of
grid.Declaration
Swift
@inlinable func getColumnSpacing() -> Int -
getRowBaselinePosition(row:Extension method) Returns the baseline position of
rowas set bygtk_grid_set_row_baseline_position()or the default valueGTK_BASELINE_POSITION_CENTER.Declaration
Swift
@inlinable func getRowBaselinePosition(row: Int) -> GtkBaselinePosition -
getRowHomogeneous()Extension methodReturns whether all rows of
gridhave the same height.Declaration
Swift
@inlinable func getRowHomogeneous() -> Bool -
getRowSpacing()Extension methodReturns the amount of space between the rows of
grid.Declaration
Swift
@inlinable func getRowSpacing() -> Int -
insertColumn(position:Extension method) Inserts a column at the specified position.
Children which are attached at or to the right of this position are moved one column to the right. Children which span across this position are grown to span the new column.
Declaration
Swift
@inlinable func insertColumn(position: Int) -
insertNextTo(sibling:Extension methodside: ) Inserts a row or column at the specified position.
The new row or column is placed next to
sibling, on the side determined byside. IfsideisGTK_POS_TOPorGTK_POS_BOTTOM, a row is inserted. IfsideisGTK_POS_LEFTofGTK_POS_RIGHT, a column is inserted.Declaration
Swift
@inlinable func insertNextTo<WidgetT>(sibling: WidgetT, side: GtkPositionType) where WidgetT : WidgetProtocol -
insertRow(position:Extension method) Inserts a row at the specified position.
Children which are attached at or below this position are moved one row down. Children which span across this position are grown to span the new row.
Declaration
Swift
@inlinable func insertRow(position: Int) -
removeColumn(position:Extension method) Removes a column from the grid.
Children that are placed in this column are removed, spanning children that overlap this column have their width reduced by one, and children after the column are moved to the left.
Declaration
Swift
@inlinable func removeColumn(position: Int) -
removeRow(position:Extension method) Removes a row from the grid.
Children that are placed in this row are removed, spanning children that overlap this row have their height reduced by one, and children below the row are moved up.
Declaration
Swift
@inlinable func removeRow(position: Int) -
setBaseline(row:Extension method) Sets which row defines the global baseline for the entire grid. Each row in the grid can have its own local baseline, but only one of those is global, meaning it will be the baseline in the parent of the
grid.Declaration
Swift
@inlinable func setBaseline(row: Int) -
setColumn(homogeneous:Extension method) Sets whether all columns of
gridwill have the same width.Declaration
Swift
@inlinable func setColumn(homogeneous: Bool) -
setColumn(spacing:Extension method) Sets the amount of space between columns of
grid.Declaration
Swift
@inlinable func setColumn(spacing: Int) -
setRowBaselinePosition(row:Extension methodpos: ) Sets how the baseline should be positioned on
rowof the grid, in case that row is assigned more space than is requested.Declaration
Swift
@inlinable func setRowBaselinePosition(row: Int, pos: GtkBaselinePosition) -
setRow(homogeneous:Extension method) Sets whether all rows of
gridwill have the same height.Declaration
Swift
@inlinable func setRow(homogeneous: Bool) -
setRow(spacing:Extension method) Sets the amount of space between rows of
grid.Declaration
Swift
@inlinable func setRow(spacing: Int) -
baselineRowExtension methodReturns which row defines the global baseline of
grid.Declaration
Swift
@inlinable var baselineRow: Int { get nonmutating set } -
columnHomogeneousExtension methodReturns whether all columns of
gridhave the same width.Declaration
Swift
@inlinable var columnHomogeneous: Bool { get nonmutating set } -
columnSpacingExtension methodReturns the amount of space between the columns of
grid.Declaration
Swift
@inlinable var columnSpacing: Int { get nonmutating set } -
rowHomogeneousExtension methodReturns whether all rows of
gridhave the same height.Declaration
Swift
@inlinable var rowHomogeneous: Bool { get nonmutating set } -
rowSpacingExtension methodReturns the amount of space between the rows of
grid.Declaration
Swift
@inlinable var rowSpacing: Int { get nonmutating set }
View on GitHub
Install in Dash
GridProtocol Protocol Reference