1.81 <AdwWrapLayout>

Class: <AdwWrapLayout>

It derives from <GtkLayoutManager>.

A box-like layout that can wrap into multiple lines.

<AdwWrapLayout> is similar to <GtkBoxLayout>, but can wrap lines when the widgets cannot fit otherwise. Unlike <GtkFlowBox>, 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:

  • WrapLayout:child-spacing between children in the same line;
  • WrapLayout:line-spacing between lines.

::: note Unlike <GtkBoxLayout>, <AdwWrapLayout> cannot follow the CSS border-spacing property.

Use the WrapLayout:natural-line-length property to determine the layout’s natural size, e.g. when using it in a <GtkPopover>.

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 WrapLayout:pack-direction and WrapLayout:wrap-reverse properties. Additionally, the alignment of each line can be controlled with the WrapLayout:align property.

Lines can be justified using the WrapLayout:justify property, filling the entire line by either increasing child size or spacing depending on the value. Set 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 WrapLayout:wrap-policy to 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 WrapLayout:line-homogeneous to TRUE.

Spacing and natural line length can scale with the text scale factor, use the WrapLayout:child-spacing-unit, WrapLayout:line-spacing-unit and/or WrapLayout:natural-line-length-unit properties to enable that behavior.

See WrapBox.

Properties

Property: wrap-layout:align self

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 WrapLayout:justify is set to Adw.JustifyMode.none, or on the last line when the WrapLayout:justify-last-line is FALSE.

Its value is a real number.

Set it with (set! (wrap-layout:align self) value).

Property: wrap-layout:child-spacing self

The spacing between widgets on the same line.

See WrapLayout:child-spacing-unit.

Its value is a 32-bit integer.

Set it with (set! (wrap-layout:child-spacing self) value).

Property: wrap-layout:child-spacing-unit self

The length unit for child spacing.

Allows the spacing to vary depending on the text scale factor.

See WrapLayout:child-spacing.

Its value is a <AdwLengthUnit> (or, to set it, one of its symbols).

Set it with (set! (wrap-layout:child-spacing-unit self) value).

Property: wrap-layout:justify self

Determines whether and how each complete line should be stretched to fill the entire widget.

If set to Adw.JustifyMode.fill, each widget in the line will be stretched, keeping consistent spacing, so that the line fills the entire widget.

If set to Adw.JustifyMode.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.JustifyMode.none, the line will not be stretched and the children will be placed together within the line, according to WrapLayout:align.

By default this doesn’t affect the last line, as it will be incomplete. Use WrapLayout:justify-last-line to justify it as well.

Its value is a <AdwJustifyMode> (or, to set it, one of its symbols).

Set it with (set! (wrap-layout:justify self) value).

Property: wrap-layout:justify-last-line self

Whether the last line should be stretched to fill the entire widget.

See WrapLayout:justify.

Its value is a boolean.

Set it with (set! (wrap-layout:justify-last-line self) value).

Property: wrap-layout:line-homogeneous self

Whether all lines should take the same amount of space.

Its value is a boolean.

Set it with (set! (wrap-layout:line-homogeneous self) value).

Property: wrap-layout:line-spacing self

The spacing between lines.

See WrapLayout:line-spacing-unit.

Its value is a 32-bit integer.

Set it with (set! (wrap-layout:line-spacing self) value).

Property: wrap-layout:line-spacing-unit self

The length unit for line spacing.

Allows the spacing to vary depending on the text scale factor.

See WrapLayout:line-spacing.

Its value is a <AdwLengthUnit> (or, to set it, one of its symbols).

Set it with (set! (wrap-layout:line-spacing-unit self) value).

Property: wrap-layout:natural-line-length self

Determines the natural size for each line.

It should be used to limit the line lengths, for example when used in popovers.

See WrapLayout:natural-line-length-unit.

Its value is a 32-bit integer.

Set it with (set! (wrap-layout:natural-line-length self) value).

Property: wrap-layout:natural-line-length-unit self

The length unit for natural line length.

Allows the length to vary depending on the text scale factor.

See WrapLayout:natural-line-length.

Its value is a <AdwLengthUnit> (or, to set it, one of its symbols).

Set it with (set! (wrap-layout:natural-line-length-unit self) value).

Property: wrap-layout:pack-direction self

The direction children are packed in each line.

Its value is a <AdwPackDirection> (or, to set it, one of its symbols).

Set it with (set! (wrap-layout:pack-direction self) value).

Property: wrap-layout:wrap-policy self

The policy for line wrapping.

If set to Adw.WrapPolicy.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.WrapPolicy.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.

Its value is a <AdwWrapPolicy> (or, to set it, one of its symbols).

Set it with (set! (wrap-layout:wrap-policy self) value).

Property: wrap-layout:wrap-reverse self

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.

Its value is a boolean.

Set it with (set! (wrap-layout:wrap-reverse self) value).

Procedures

Method: wrap-layout:get-align self ⇒ %return
Method: get-align self ⇒ %return

Gets the alignment of the children within each line.

self

Passed: a <AdwWrapLayout>.

a wrap layout

%return

Returned: a real number.

the child alignment

Method: wrap-layout:get-child-spacing self ⇒ %return
Method: get-child-spacing self ⇒ %return

Gets spacing between widgets on the same line.

self

Passed: a <AdwWrapLayout>.

a wrap layout

%return

Returned: a 32-bit integer.

spacing between widgets on the same line

Method: wrap-layout:get-child-spacing-unit self ⇒ %return
Method: get-child-spacing-unit self ⇒ %return

Gets the length unit for child spacing.

self

Passed: a <AdwWrapLayout>.

a wrap layout

%return

Returned: a <AdwLengthUnit>.

the length unit

Method: wrap-layout:get-justify self ⇒ %return
Method: get-justify self ⇒ %return

Gets whether and how each complete line is stretched to fill the entire widget.

self

Passed: a <AdwWrapLayout>.

a wrap layout

%return

Returned: a <AdwJustifyMode>.

the justify mode

Method: wrap-layout:get-justify-last-line? self ⇒ %return
Method: get-justify-last-line? self ⇒ %return

Gets whether the last line should be stretched to fill the entire widget.

self

Passed: a <AdwWrapLayout>.

a wrap layout

%return

Returned: a boolean.

whether the last line is justified

Method: wrap-layout:get-line-homogeneous? self ⇒ %return
Method: get-line-homogeneous? self ⇒ %return

Gets whether all lines should take the same amount of space.

self

Passed: a <AdwWrapLayout>.

a wrap layout

%return

Returned: a boolean.

whether lines should be homogeneous

Method: wrap-layout:get-line-spacing self ⇒ %return
Method: get-line-spacing self ⇒ %return

Gets the spacing between lines.

self

Passed: a <AdwWrapLayout>.

a wrap layout

%return

Returned: a 32-bit integer.

the line spacing

Method: wrap-layout:get-line-spacing-unit self ⇒ %return
Method: get-line-spacing-unit self ⇒ %return

Gets the length unit for line spacing.

self

Passed: a <AdwWrapLayout>.

a wrap layout

%return

Returned: a <AdwLengthUnit>.

the length unit

Method: wrap-layout:get-natural-line-length self ⇒ %return
Method: get-natural-line-length self ⇒ %return

Gets the natural size for each line.

self

Passed: a <AdwWrapLayout>.

a wrap layout

%return

Returned: a 32-bit integer.

the natural length

Method: wrap-layout:get-natural-line-length-unit self ⇒ %return
Method: get-natural-line-length-unit self ⇒ %return

Gets the length unit for line spacing.

self

Passed: a <AdwWrapLayout>.

a wrap layout

%return

Returned: a <AdwLengthUnit>.

the length unit

Method: wrap-layout:get-pack-direction self ⇒ %return
Method: get-pack-direction self ⇒ %return

Gets the direction children are packed in each line.

self

Passed: a <AdwWrapLayout>.

a wrap layout

%return

Returned: a <AdwPackDirection>.

the line direction

Method: wrap-layout:get-wrap-policy self ⇒ %return
Method: get-wrap-policy self ⇒ %return

Gets the policy for line wrapping.

self

Passed: a <AdwWrapLayout>.

a wrap layout

%return

Returned: a <AdwWrapPolicy>.

the wrap policy

Method: wrap-layout:get-wrap-reverse? self ⇒ %return
Method: get-wrap-reverse? self ⇒ %return

Gets whether wrap direction is reversed.

self

Passed: a <AdwWrapLayout>.

a wrap layout

%return

Returned: a boolean.

whether wrap direction is reversed

Procedure: wrap-layout:new ⇒ %return

Creates a new <AdwWrapLayout>.

%return

Returned: a <GtkLayoutManager>.

the newly created <AdwWrapLayout>

Method: wrap-layout:set-align self align
Method: set-align self 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 WrapLayout:justify is set to Adw.JustifyMode.none, or on the last line when the WrapLayout:justify-last-line is FALSE.

self

Passed: a <AdwWrapLayout>.

a wrap layout

align

Passed: a real number.

the child alignment

Method: wrap-layout:set-child-spacing self child-spacing
Method: set-child-spacing self child-spacing

Sets the spacing between widgets on the same line.

See WrapLayout:child-spacing-unit.

self

Passed: a <AdwWrapLayout>.

a wrap layout

child-spacing

Passed: a 32-bit integer.

the child spacing

Method: wrap-layout:set-child-spacing-unit self unit
Method: set-child-spacing-unit self unit

Sets the length unit for child spacing.

Allows the spacing to vary depending on the text scale factor.

See WrapLayout:child-spacing.

self

Passed: a <AdwWrapLayout>.

a wrap layout

unit

Passed: a <AdwLengthUnit>, or one of its symbols.

the length unit

Method: wrap-layout:set-justify self justify
Method: set-justify self justify

Sets whether and how each complete line should be stretched to fill the entire widget.

If set to Adw.JustifyMode.fill, each widget in the line will be stretched, keeping consistent spacing, so that the line fills the entire widget.

If set to Adw.JustifyMode.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.JustifyMode.none, the line will not be stretched and the children will be placed together within the line, according to WrapLayout:align.

By default this doesn’t affect the last line, as it will be incomplete. Use WrapLayout:justify-last-line to justify it as well.

self

Passed: a <AdwWrapLayout>.

a wrap layout

justify

Passed: a <AdwJustifyMode>, or one of its symbols.

the justify mode

Method: wrap-layout:set-justify-last-line self justify-last-line
Method: set-justify-last-line self justify-last-line

Sets whether the last line should be stretched to fill the entire widget.

See WrapLayout:justify.

self

Passed: a <AdwWrapLayout>.

a wrap layout

justify-last-line

Passed: a boolean.

whether to justify the last line

Method: wrap-layout:set-line-homogeneous self homogeneous
Method: set-line-homogeneous self homogeneous

Sets whether all lines should take the same amount of space.

self

Passed: a <AdwWrapLayout>.

a wrap layout

homogeneous

Passed: a boolean.

whether lines should be homogeneous

Method: wrap-layout:set-line-spacing self line-spacing
Method: set-line-spacing self line-spacing

Sets the spacing between lines.

See WrapLayout:line-spacing-unit.

self

Passed: a <AdwWrapLayout>.

a wrap layout

line-spacing

Passed: a 32-bit integer.

the line spacing

Method: wrap-layout:set-line-spacing-unit self unit
Method: set-line-spacing-unit self unit

Sets the length unit for line spacing.

Allows the spacing to vary depending on the text scale factor.

See WrapLayout:line-spacing.

self

Passed: a <AdwWrapLayout>.

a wrap layout

unit

Passed: a <AdwLengthUnit>, or one of its symbols.

the length unit

Method: wrap-layout:set-natural-line-length self natural-line-length
Method: set-natural-line-length self 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 WrapLayout:natural-line-length-unit.

self

Passed: a <AdwWrapLayout>.

a wrap layout

natural-line-length

Passed: a 32-bit integer.

the natural length

Method: wrap-layout:set-natural-line-length-unit self unit
Method: set-natural-line-length-unit self unit

Sets the length unit for natural line length.

Allows the length to vary depending on the text scale factor.

See WrapLayout:natural-line-length.

self

Passed: a <AdwWrapLayout>.

a wrap layout

unit

Passed: a <AdwLengthUnit>, or one of its symbols.

the length unit

Method: wrap-layout:set-pack-direction self pack-direction
Method: set-pack-direction self pack-direction

Sets the direction children are packed in each line.

self

Passed: a <AdwWrapLayout>.

a wrap layout

pack-direction

Passed: a <AdwPackDirection>, or one of its symbols.

the new line direction

Method: wrap-layout:set-wrap-policy self wrap-policy
Method: set-wrap-policy self wrap-policy

Sets the policy for line wrapping.

If set to Adw.WrapPolicy.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.WrapPolicy.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.

self

Passed: a <AdwWrapLayout>.

a wrap layout

wrap-policy

Passed: a <AdwWrapPolicy>, or one of its symbols.

the new wrap policy

Method: wrap-layout:set-wrap-reverse self wrap-reverse
Method: set-wrap-reverse self 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.

self

Passed: a <AdwWrapLayout>.

a wrap layout

wrap-reverse

Passed: a boolean.

whether to reverse wrap direction