Package ch.bailu.gtk.adw
Klasse WrapLayout
- Alle implementierten Schnittstellen:
PointerInterface
A box-like layout that can wrap into multiple lines.
<picture>
<source srcset="wrap-box-dark.png" media="(prefers-color-scheme: dark)">
<img src="wrap-box.png" alt="wrap-box">
</picture>
`AdwWrapLayout` is similar to [class@Gtk.BoxLayout], but can wrap lines when
the widgets cannot fit otherwise. Unlike [class@Gtk.FlowBox], the children
aren't arranged into a grid and behave more like words in a wrapping label.
Like `GtkBoxLayout`, `AdwWrapLayout` is orientable and has spacing:
- [property@WrapLayout:child-spacing] between children in the same line;
- [property@WrapLayout:line-spacing] between lines.
::: note
Unlike `GtkBoxLayout`, `AdwWrapLayout` cannot follow the CSS
`border-spacing` property.
Use the [property@WrapLayout:natural-line-length] property to determine the
layout's natural size, e.g. when using it in a [class@Gtk.Popover].
Normally, a horizontal `AdwWrapLayout` wraps left to right and top to bottom
for left-to-right languages. Both of these directions can be reversed, using
the [property@WrapLayout:pack-direction] and
[property@WrapLayout:wrap-reverse] properties. Additionally, the alignment
of each line can be controlled with the [property@WrapLayout:align] property.
Lines can be justified using the [property@WrapLayout:justify] property,
filling the entire line by either increasing child size or spacing depending
on the value. Set [property@WrapLayout:justify-last-line] to justify the last
line as well.
By default, `AdwWrapLayout` wraps as soon as the previous line cannot fit
any more children without shrinking them past their natural size. Set
[property@WrapLayout:wrap-policy] to [enum@Adw.WrapPolicy.MINIMUM] to only
wrap once all the children in the previous line have been shrunk to their
minimum size.
To make each line take the same amount of space, set
[property@WrapLayout:line-homogeneous] to `TRUE`.
Spacing and natural line length can scale with the text scale factor, use the
[property@WrapLayout:child-spacing-unit],
[property@WrapLayout:line-spacing-unit] and/or
[property@WrapLayout:natural-line-length-unit] properties to enable that
behavior.
See [class@WrapBox].
<picture>
<source srcset="wrap-box-dark.png" media="(prefers-color-scheme: dark)">
<img src="wrap-box.png" alt="wrap-box">
</picture>
`AdwWrapLayout` is similar to [class@Gtk.BoxLayout], but can wrap lines when
the widgets cannot fit otherwise. Unlike [class@Gtk.FlowBox], the children
aren't arranged into a grid and behave more like words in a wrapping label.
Like `GtkBoxLayout`, `AdwWrapLayout` is orientable and has spacing:
- [property@WrapLayout:child-spacing] between children in the same line;
- [property@WrapLayout:line-spacing] between lines.
::: note
Unlike `GtkBoxLayout`, `AdwWrapLayout` cannot follow the CSS
`border-spacing` property.
Use the [property@WrapLayout:natural-line-length] property to determine the
layout's natural size, e.g. when using it in a [class@Gtk.Popover].
Normally, a horizontal `AdwWrapLayout` wraps left to right and top to bottom
for left-to-right languages. Both of these directions can be reversed, using
the [property@WrapLayout:pack-direction] and
[property@WrapLayout:wrap-reverse] properties. Additionally, the alignment
of each line can be controlled with the [property@WrapLayout:align] property.
Lines can be justified using the [property@WrapLayout:justify] property,
filling the entire line by either increasing child size or spacing depending
on the value. Set [property@WrapLayout:justify-last-line] to justify the last
line as well.
By default, `AdwWrapLayout` wraps as soon as the previous line cannot fit
any more children without shrinking them past their natural size. Set
[property@WrapLayout:wrap-policy] to [enum@Adw.WrapPolicy.MINIMUM] to only
wrap once all the children in the previous line have been shrunk to their
minimum size.
To make each line take the same amount of space, set
[property@WrapLayout:line-homogeneous] to `TRUE`.
Spacing and natural line length can scale with the text scale factor, use the
[property@WrapLayout:child-spacing-unit],
[property@WrapLayout:line-spacing-unit] and/or
[property@WrapLayout:natural-line-length-unit] properties to enable that
behavior.
See [class@WrapBox].
https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.WrapLayout.html
-
Verschachtelte Klassen - Übersicht
Von Klasse geerbte verschachtelte Klassen/Schnittstellen ch.bailu.gtk.gobject.Object
Object.OnBindingTransformFunc, Object.OnDestroyNotify, Object.OnDuplicateFunc, Object.OnNotify, Object.OnToggleNotify, Object.OnWeakNotify
-
Feldübersicht
Von Klasse geerbte Felder ch.bailu.gtk.gobject.Object
SIGNAL_ON_NOTIFY
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungImplements interfaceOrientable
.float
getAlign()
Gets the alignment of the children within each line.int
Gets spacing between widgets on the same line.int
Gets the length unit for child spacing.static ClassHandler
static int
int
Gets whether and how each complete line is stretched to fill the entire widget.boolean
Gets whether the last line should be stretched to fill the entire widget.boolean
Gets whether all lines should take the same amount of space.int
Gets the spacing between lines.int
Gets the length unit for line spacing.int
Gets the natural size for each line.int
Gets the length unit for line spacing.int
Gets the direction children are packed in each line.static long
static TypeSystem.TypeSize
static long
static TypeSystem.TypeSize
int
Gets the policy for line wrapping.boolean
Gets whether wrap direction is reversed.void
setAlign
(float align) Sets the alignment of the children within each line.void
setChildSpacing
(int child_spacing) Sets the spacing between widgets on the same line.void
setChildSpacingUnit
(int unit) Sets the length unit for child spacing.void
setJustify
(int justify) Sets whether and how each complete line should be stretched to fill the
entire widget.void
setJustifyLastLine
(boolean justify_last_line) Sets whether the last line should be stretched to fill the entire widget.void
setLineHomogeneous
(boolean homogeneous) Sets whether all lines should take the same amount of space.void
setLineSpacing
(int line_spacing) Sets the spacing between lines.void
setLineSpacingUnit
(int unit) Sets the length unit for line spacing.void
setNaturalLineLength
(int natural_line_length) Sets the natural size for each line.void
setNaturalLineLengthUnit
(int unit) Sets the length unit for natural line length.void
setPackDirection
(int pack_direction) Sets the direction children are packed in each line.void
setWrapPolicy
(int wrap_policy) Sets the policy for line wrapping.void
setWrapReverse
(boolean wrap_reverse) Sets whether wrap direction should be reversed.Von Klasse geerbte Methoden ch.bailu.gtk.gtk.LayoutManager
allocate, getLayoutChild, getRequestMode, getWidget, layoutChanged, measure
Von Klasse geerbte Methoden ch.bailu.gtk.type.PropertyHolder
getBooleanProperty, getIntProperty, getObjectProperty, getStringProperty, getStrProperty, setBooleanProperty, setIntProperty, setObjectProperty, setStringProperty, setStrProperty
Von Klasse geerbte Methoden ch.bailu.gtk.gobject.Object
addToggleRef, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, disconnect, disconnect, dupData, dupData, dupQdata, forceFloating, freezeNotify, get, get, getData, getData, getProperty, getProperty, getQdata, interfaceFindProperty, interfaceInstallProperty, isFloating, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, replaceData, replaceData, replaceQdata, runDispose, set, set, setData, setData, setDataFull, setDataFull, setProperty, setProperty, setQdata, setQdataFull, stealData, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref
Von Klasse geerbte Methoden ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Von Klasse geerbte Methoden ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Von Klasse geerbte Methoden java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Von Schnittstelle geerbte Methoden ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Konstruktordetails
-
WrapLayout
-
WrapLayout
public WrapLayout()Creates a new `AdwWrapLayout`.
-
-
Methodendetails
-
getClassHandler
-
getAlign
public float getAlign()Gets the alignment of the children within each line.- Gibt zurück:
- the child alignment
-
getChildSpacing
public int getChildSpacing()Gets spacing between widgets on the same line.- Gibt zurück:
- spacing between widgets on the same line
-
getChildSpacingUnit
public int getChildSpacingUnit()Gets the length unit for child spacing.- Gibt zurück:
- the length unit
-
getJustify
public int getJustify()Gets whether and how each complete line is stretched to fill the entire widget.- Gibt zurück:
- the justify mode
-
getJustifyLastLine
public boolean getJustifyLastLine()Gets whether the last line should be stretched to fill the entire widget.- Gibt zurück:
- whether the last line is justified
-
getLineHomogeneous
public boolean getLineHomogeneous()Gets whether all lines should take the same amount of space.- Gibt zurück:
- whether lines should be homogeneous
-
getLineSpacing
public int getLineSpacing()Gets the spacing between lines.- Gibt zurück:
- the line spacing
-
getLineSpacingUnit
public int getLineSpacingUnit()Gets the length unit for line spacing.- Gibt zurück:
- the length unit
-
getNaturalLineLength
public int getNaturalLineLength()Gets the natural size for each line.- Gibt zurück:
- the natural length
-
getNaturalLineLengthUnit
public int getNaturalLineLengthUnit()Gets the length unit for line spacing.- Gibt zurück:
- the length unit
-
getPackDirection
public int getPackDirection()Gets the direction children are packed in each line.- Gibt zurück:
- the line direction
-
getWrapPolicy
public int getWrapPolicy()Gets the policy for line wrapping.- Gibt zurück:
- the wrap policy
-
getWrapReverse
public boolean getWrapReverse()Gets whether wrap direction is reversed.- Gibt zurück:
- whether wrap direction is reversed
-
setAlign
public void setAlign(float align) Sets the alignment of the children within each line.
0 means the children are placed at the start of the line, 1 means they are
placed at the end of the line. 0.5 means they are placed in the middle of the
line.
Alignment is only used when [property@WrapLayout:justify] is set to
`ADW_JUSTIFY_NONE`, or on the last line when the
[property@WrapLayout:justify-last-line] is `FALSE`.- Parameter:
align
- the child alignment
-
setChildSpacing
public void setChildSpacing(int child_spacing) Sets the spacing between widgets on the same line.
See [property@WrapLayout:child-spacing-unit].- Parameter:
child_spacing
- the child spacing
-
setChildSpacingUnit
public void setChildSpacingUnit(int unit) Sets the length unit for child spacing.
Allows the spacing to vary depending on the text scale factor.
See [property@WrapLayout:child-spacing].- Parameter:
unit
- the length unit
-
setJustify
public void setJustify(int justify) Sets whether and how each complete line should be stretched to fill the
entire widget.
If set to `ADW_JUSTIFY_FILL`, each widget in the line will be stretched,
keeping consistent spacing, so that the line fills the entire widget.
If set to `ADW_JUSTIFY_SPREAD`, the spacing between widgets will be
increased, keeping widget sizes intact. The first and last widget will be
aligned with the beginning and end of the line. If the line only contains a
single widget, it will be stretched regardless.
If set to `ADW_JUSTIFY_NONE`, the line will not be stretched and the children
will be placed together within the line, according to
[property@WrapLayout:align].
By default this doesn't affect the last line, as it will be incomplete. Use
[property@WrapLayout:justify-last-line] to justify it as well.- Parameter:
justify
- the justify mode
-
setJustifyLastLine
public void setJustifyLastLine(boolean justify_last_line) Sets whether the last line should be stretched to fill the entire widget.
See [property@WrapLayout:justify].- Parameter:
justify_last_line
- whether to justify the last line
-
setLineHomogeneous
public void setLineHomogeneous(boolean homogeneous) Sets whether all lines should take the same amount of space.- Parameter:
homogeneous
- whether lines should be homogeneous
-
setLineSpacing
public void setLineSpacing(int line_spacing) Sets the spacing between lines.
See [property@WrapLayout:line-spacing-unit].- Parameter:
line_spacing
- the line spacing
-
setLineSpacingUnit
public void setLineSpacingUnit(int unit) Sets the length unit for line spacing.
Allows the spacing to vary depending on the text scale factor.
See [property@WrapLayout:line-spacing].- Parameter:
unit
- the length unit
-
setNaturalLineLength
public void setNaturalLineLength(int natural_line_length) Sets the natural size for each line.
It should be used to limit the line lengths, for example when used in
popovers.
See [property@WrapLayout:natural-line-length-unit].- Parameter:
natural_line_length
- the natural length
-
setNaturalLineLengthUnit
public void setNaturalLineLengthUnit(int unit) Sets the length unit for natural line length.
Allows the length to vary depending on the text scale factor.
See [property@WrapLayout:natural-line-length].- Parameter:
unit
- the length unit
-
setPackDirection
public void setPackDirection(int pack_direction) Sets the direction children are packed in each line.- Parameter:
pack_direction
- the new line direction
-
setWrapPolicy
public void setWrapPolicy(int wrap_policy) Sets the policy for line wrapping.
If set to `ADW_WRAP_NATURAL`, the box will wrap to the next line as soon as
the previous line cannot fit any more children without shrinking them past
their natural size.
If set to `ADW_WRAP_MINIMUM`, the box will try to fit as many children into
each line as possible, shrinking them down to their minimum size before
wrapping to the next line.- Parameter:
wrap_policy
- the new wrap policy
-
setWrapReverse
public void setWrapReverse(boolean wrap_reverse) Sets whether wrap direction should be reversed.
By default, lines wrap downwards in a horizontal box, and towards the end
in a vertical box. If set to `TRUE`, they wrap upwards or towards the start
respectively.- Parameter:
wrap_reverse
- whether to reverse wrap direction
-
asOrientable
Implements interfaceOrientable
. Call this to get access to interface functions.- Gibt zurück:
Orientable
-
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-