Class GridLayout
- All Implemented Interfaces:
Proxy
GtkGridLayout
is a layout manager which 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
Modifier and TypeClassDescriptionstatic class
GridLayout.Builder<B extends GridLayout.Builder<B>>
Inner class implementing a builder pattern to construct a GObject with properties.static class
Nested classes/interfaces inherited from class org.gnome.gtk.LayoutManager
LayoutManager.LayoutManagerClass, LayoutManager.LayoutManagerImpl
Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
-
Constructor Summary
ConstructorDescriptionCreates a newGtkGridLayout
.GridLayout
(MemorySegment address) Create a GridLayout proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected GridLayout
asParent()
Returns this instance as if it were its parent type.static GridLayout.Builder
<? extends GridLayout.Builder> builder()
AGridLayout.Builder
object constructs aGridLayout
with the specified properties.int
Retrieves the row set with gtk_grid_layout_set_baseline_row().boolean
Checks whether all columns of this GridLayout should have the same width.int
Retrieves the spacing set with gtk_grid_layout_set_column_spacing().getRowBaselinePosition
(int row) Returns the baseline position ofrow
.boolean
Checks whether all rows of this GridLayout should have the same height.int
Retrieves the spacing set with gtk_grid_layout_set_row_spacing().static Type
getType()
Get the GType of the GridLayout classvoid
setBaselineRow
(int row) Sets which row defines the global baseline for the entire grid.void
setColumnHomogeneous
(boolean homogeneous) Sets whether all columns of this GridLayout should have the same width.void
setColumnSpacing
(int spacing) Sets the amount of space to insert between consecutive columns.void
setRowBaselinePosition
(int row, BaselinePosition pos) Sets how the baseline should be positioned onrow
of the grid, in case that row is assigned more space than is requested.void
setRowHomogeneous
(boolean homogeneous) Sets whether all rows of this GridLayout should have the same height.void
setRowSpacing
(int spacing) Sets the amount of space to insert between consecutive rows.Methods inherited from class org.gnome.gtk.LayoutManager
allocate, createLayoutChild, getLayoutChild, getMemoryLayout, getRequestMode, getRequestMode, getWidget, layoutChanged, measure, root, unroot
Methods inherited from class org.gnome.gobject.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, 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, withProperties
Methods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, getPrivate, readGClass, writeGClass
Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
GridLayout
Create a GridLayout proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
GridLayout
public GridLayout()Creates a newGtkGridLayout
.
-
-
Method Details
-
getType
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuper
keyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()
doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName()
. This will call the native function pointer of this virtual method in the typeclass of the parent type.- Overrides:
asParent
in classLayoutManager
-
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:
true
if the columns are homogeneous, andfalse
otherwise
-
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 ofrow
.If no value has been set with
setRowBaselinePosition(int, org.gnome.gtk.BaselinePosition)
, the default value ofBaselinePosition.CENTER
is 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:
true
if the rows are homogeneous, andfalse
otherwise
-
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 this GridLayout.
- 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
-true
to 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 onrow
of 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
-true
to 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.Builder
object constructs aGridLayout
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withGridLayout.Builder.build()
.
-