Class GridLayout
- All Implemented Interfaces:
Proxy
Arranges child widgets in rows and columns.
Children have an "attach point" defined by the horizontal and vertical
index of the cell they occupy; children can span multiple rows or columns.
The layout properties for setting the attach points and spans are set
using the GridLayoutChild associated to each child widget.
The behaviour of GtkGridLayout when several children occupy the same
grid cell is undefined.
GtkGridLayout can be used like a GtkBoxLayout if all children are
attached to the same row or column; however, if you only ever need a
single row or column, you should consider using GtkBoxLayout.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classGridLayout.Builder<B extends GridLayout.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static classNested classes/interfaces inherited from class LayoutManager
LayoutManager.LayoutManager$Impl, LayoutManager.LayoutManagerClassNested classes/interfaces inherited from class GObject
GObject.NotifyCallback, GObject.ObjectClass -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new GridLayout.GridLayout(MemorySegment address) Create a GridLayout instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected GridLayoutasParent()Return this instance as if it were its parent type.static GridLayout.Builder<? extends GridLayout.Builder> builder()AGridLayout.Builderobject constructs aGridLayoutwith the specified properties.intRetrieves the row set with gtk_grid_layout_set_baseline_row().booleanChecks whether all columns of this GridLayout should have the same width.intRetrieves the spacing set with gtk_grid_layout_set_column_spacing().static MemoryLayoutThe memory layout of the native struct.getRowBaselinePosition(int row) Returns the baseline position ofrow.booleanChecks whether all rows of this GridLayout should have the same height.intRetrieves the spacing set with gtk_grid_layout_set_row_spacing().static @Nullable TypegetType()Get the GType of the GridLayout class.voidsetBaselineRow(int row) Sets which row defines the global baseline for the entire grid.voidsetColumnHomogeneous(boolean homogeneous) Sets whether all columns of this GridLayout should have the same width.voidsetColumnSpacing(int spacing) Sets the amount of space to insert between consecutive columns.voidsetRowBaselinePosition(int row, BaselinePosition pos) Sets how the baseline should be positioned onrowof the grid, in case that row is assigned more space than is requested.voidsetRowHomogeneous(boolean homogeneous) Sets whether all rows of this GridLayout should have the same height.voidsetRowSpacing(int spacing) Sets the amount of space to insert between consecutive rows.Methods inherited from class LayoutManager
allocate, createLayoutChild, getLayoutChild, getRequestMode, getRequestMode, getWidget, layoutChanged, measure, root, unrootMethods inherited from class GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newv, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withPropertiesMethods inherited from class TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
GridLayout
Create a GridLayout instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
GridLayout
public GridLayout()Create a new GridLayout.
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
asParent
Return this instance as if it were its parent type. Comparable to the Javasuperkeyword, but ensures the parent typeclass is also used in native code.- Overrides:
asParentin classLayoutManager- Returns:
- the instance as if it were its parent type
-
getBaselineRow
public int getBaselineRow()Retrieves the row set with gtk_grid_layout_set_baseline_row().- Returns:
- the global baseline row
-
getColumnHomogeneous
public boolean getColumnHomogeneous()Checks whether all columns of this GridLayout should have the same width.- Returns:
trueif the columns are homogeneous, andfalseotherwise
-
getColumnSpacing
public int getColumnSpacing()Retrieves the spacing set with gtk_grid_layout_set_column_spacing().- Returns:
- the spacing between consecutive columns
-
getRowBaselinePosition
Returns the baseline position of
row.If no value has been set with
setRowBaselinePosition(int, BaselinePosition), the default value ofBaselinePosition.CENTERis returned.- Parameters:
row- a row index- Returns:
- the baseline position of
row
-
getRowHomogeneous
public boolean getRowHomogeneous()Checks whether all rows of this GridLayout should have the same height.- Returns:
trueif the rows are homogeneous, andfalseotherwise
-
getRowSpacing
public int getRowSpacing()Retrieves the spacing set with gtk_grid_layout_set_row_spacing().- Returns:
- the spacing between consecutive rows
-
setBaselineRow
public void setBaselineRow(int row) 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.- Parameters:
row- the row index
-
setColumnHomogeneous
public void setColumnHomogeneous(boolean homogeneous) Sets whether all columns of this GridLayout should have the same width.- Parameters:
homogeneous-trueto make columns homogeneous
-
setColumnSpacing
public void setColumnSpacing(int spacing) Sets the amount of space to insert between consecutive columns.- Parameters:
spacing- the amount of space between columns, in pixels
-
setRowBaselinePosition
Sets how the baseline should be positioned onrowof the grid, in case that row is assigned more space than is requested.- Parameters:
row- a row indexpos- aGtkBaselinePosition
-
setRowHomogeneous
public void setRowHomogeneous(boolean homogeneous) Sets whether all rows of this GridLayout should have the same height.- Parameters:
homogeneous-trueto make rows homogeneous
-
setRowSpacing
public void setRowSpacing(int spacing) Sets the amount of space to insert between consecutive rows.- Parameters:
spacing- the amount of space between rows, in pixels
-
builder
AGridLayout.Builderobject constructs aGridLayoutwith the specified properties. Use the variousset...()methods to set properties, and finish construction withGridLayout.Builder.build().- Returns:
- the builder object
-