Adw.WrapLayout
Description: Reference for Adw.WrapLayout

### Class

# AdwWrapLayout

since: 1.7

#### Description [src]

    final class Adw.WrapLayout : Gtk.LayoutManager
      implements Gtk.Orientable {
      /* No available fields */
    }

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:

- `AdwWrapLayout:child-spacing` between children in the same line;
- `AdwWrapLayout:line-spacing` between lines.

Note

Unlike `GtkBoxLayout`, `AdwWrapLayout` cannot follow the CSS `border-spacing` property.

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

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

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

See `AdwWrapBox`.

Available since: 1.7

#### Hierarchy

#### Ancestors

- GtkLayoutManager
- GObject

#### Implements

- GtkOrientable

#### Constructors

###### adw_wrap_layout_new

Creates a new `AdwWrapLayout`.

since: 1.7

#### Instance methods

###### adw_wrap_layout_get_align

Gets the alignment of the children within each line.

since: 1.7

###### adw_wrap_layout_get_child_spacing

Gets spacing between widgets on the same line.

since: 1.7

###### adw_wrap_layout_get_child_spacing_unit

Gets the length unit for child spacing.

since: 1.7

###### adw_wrap_layout_get_justify

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

since: 1.7

###### adw_wrap_layout_get_justify_last_line

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

since: 1.7

###### adw_wrap_layout_get_line_homogeneous

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

since: 1.7

###### adw_wrap_layout_get_line_spacing

Gets the spacing between lines.

since: 1.7

###### adw_wrap_layout_get_line_spacing_unit

Gets the length unit for line spacing.

since: 1.7

###### adw_wrap_layout_get_natural_line_length

Gets the natural size for each line.

since: 1.7

###### adw_wrap_layout_get_natural_line_length_unit

Gets the length unit for line spacing.

since: 1.7

###### adw_wrap_layout_get_pack_direction

Gets the direction children are packed in each line.

since: 1.7

###### adw_wrap_layout_get_wrap_policy

Gets the policy for line wrapping.

since: 1.7

###### adw_wrap_layout_get_wrap_reverse

Gets whether wrap direction is reversed.

since: 1.7

###### adw_wrap_layout_set_align

Sets the alignment of the children within each line.

since: 1.7

###### adw_wrap_layout_set_child_spacing

Sets the spacing between widgets on the same line.

since: 1.7

###### adw_wrap_layout_set_child_spacing_unit

Sets the length unit for child spacing.

since: 1.7

###### adw_wrap_layout_set_justify

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

since: 1.7

###### adw_wrap_layout_set_justify_last_line

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

since: 1.7

###### adw_wrap_layout_set_line_homogeneous

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

since: 1.7

###### adw_wrap_layout_set_line_spacing

Sets the spacing between lines.

since: 1.7

###### adw_wrap_layout_set_line_spacing_unit

Sets the length unit for line spacing.

since: 1.7

###### adw_wrap_layout_set_natural_line_length

Sets the natural size for each line.

since: 1.7

###### adw_wrap_layout_set_natural_line_length_unit

Sets the length unit for natural line length.

since: 1.7

###### adw_wrap_layout_set_pack_direction

Sets the direction children are packed in each line.

since: 1.7

###### adw_wrap_layout_set_wrap_policy

Sets the policy for line wrapping.

since: 1.7

###### adw_wrap_layout_set_wrap_reverse

Sets whether wrap direction should be reversed.

since: 1.7

##### Methods inherited from GtkLayoutManager (6)

###### gtk_layout_manager_allocate

Assigns the given `width`, `height`, and `baseline` to a `widget`, and computes the position and sizes of the children of the `widget` using the layout management policy of `manager`.

###### gtk_layout_manager_get_layout_child

Retrieves a `GtkLayoutChild` instance for the `GtkLayoutManager`, creating one if necessary.

###### gtk_layout_manager_get_request_mode

Retrieves the request mode of `manager`.

###### gtk_layout_manager_get_widget

Retrieves the `GtkWidget` using the given `GtkLayoutManager`.

###### gtk_layout_manager_layout_changed

Queues a resize on the `GtkWidget` using `manager`, if any.

###### gtk_layout_manager_measure

Measures the size of the `widget` using `manager`, for the given `orientation` and size.

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

##### Methods inherited from GtkOrientable (2)

###### gtk_orientable_get_orientation

Retrieves the orientation of the `orientable`.

###### gtk_orientable_set_orientation

Sets the orientation of the `orientable`.

#### Properties

###### Adw.WrapLayout:align

The alignment of the children within each line.

since: 1.7

###### Adw.WrapLayout:child-spacing

The spacing between widgets on the same line.

since: 1.7

###### Adw.WrapLayout:child-spacing-unit

The length unit for child spacing.

since: 1.7

###### Adw.WrapLayout:justify

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

since: 1.7

###### Adw.WrapLayout:justify-last-line

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

since: 1.7

###### Adw.WrapLayout:line-homogeneous

Whether all lines should take the same amount of space.

since: 1.7

###### Adw.WrapLayout:line-spacing

The spacing between lines.

since: 1.7

###### Adw.WrapLayout:line-spacing-unit

The length unit for line spacing.

since: 1.7

###### Adw.WrapLayout:natural-line-length

Determines the natural size for each line.

since: 1.7

###### Adw.WrapLayout:natural-line-length-unit

The length unit for natural line length.

since: 1.7

###### Adw.WrapLayout:pack-direction

The direction children are packed in each line.

since: 1.7

###### Adw.WrapLayout:wrap-policy

The policy for line wrapping.

since: 1.7

###### Adw.WrapLayout:wrap-reverse

Whether wrap direction should be reversed.

since: 1.7

##### Properties inherited from GtkOrientable (1)

###### Gtk.Orientable:orientation

The orientation of the orientable.

#### Signals

##### Signals inherited from GObject (1)

###### GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

#### Class structure

    struct AdwWrapLayoutClass {
      GtkLayoutManagerClass parent_class;

    }

No description available.

###### Class members

`parent_class: GtkLayoutManagerClass`

  No description available.