Adw.MultiLayoutView

g Adw.MultiLayoutView Adw.MultiLayoutView GObject.GInterface GObject.GInterface Gtk.Accessible Gtk.Accessible GObject.GInterface->Gtk.Accessible Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable Gtk.ConstraintTarget Gtk.ConstraintTarget GObject.GInterface->Gtk.ConstraintTarget GObject.InitiallyUnowned GObject.InitiallyUnowned Gtk.Widget Gtk.Widget GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.Accessible->Gtk.Widget Gtk.Buildable->Gtk.Widget Gtk.ConstraintTarget->Gtk.Widget Gtk.Widget->Adw.MultiLayoutView

Subclasses:

None

Methods

Inherited:

Gtk.Widget (183), GObject.Object (37), Gtk.Accessible (17), Gtk.Buildable (1)

Structs:

Gtk.WidgetClass (18), GObject.ObjectClass (5)

class

new ()

add_layout (layout)

get_child (id)

get_layout ()

get_layout_by_name (name)

get_layout_name ()

remove_layout (layout)

set_child (id, child)

set_layout (layout)

set_layout_name (name)

Virtual Methods

Inherited:

Gtk.Widget (25), GObject.Object (7), Gtk.Accessible (6), Gtk.Buildable (9)

Properties

Inherited:

Gtk.Widget (35), Gtk.Accessible (1)

Name

Type

Flags

Short Description

layout

Adw.Layout

r/w/en

layout-name

str

r/w/en

Signals

Inherited:

Gtk.Widget (13), GObject.Object (1)

Fields

Inherited:

Gtk.Widget (13), GObject.Object (1)

Class Details

class Adw.MultiLayoutView(**kwargs)
Bases:

Gtk.Widget

Abstract:

No

Structure:

Adw.MultiLayoutViewClass

A widget for switching between different layouts.

AdwMultiLayoutView contains layouts and children. Each child has an ID, each layout has slots inside it, each slot also has an ID. When switching layouts, children are inserted into slots with matching IDs. The [property`Gtk`.Widget:visible] property of each slot is updated to match that of the inserted child.

This can be useful for rearranging children when it’s difficult to do so otherwise, for example to move a child from a sidebar to a bottom bar.

The currently used layout can be switched using the [property`MultiLayoutView`:py:data::layout<Adw.MultiLayoutView.props.layout>] or [property`MultiLayoutView`:py:data::layout-name<Adw.MultiLayoutView.props.layout_name>] properties. For example, it can be done via a [class`Adw`.Breakpoint] setter to change layouts depending on the window size.

Adw.MultiLayoutView as Gtk.Buildable

The AdwMultiLayoutView implementation of the [iface`Gtk`.Buildable] interface supports adding layouts via <child> element with the type attribute omitted.

It also supports setting children via <child type="ID">.

Example of an AdwMultiLayoutView UI definition that can display a secondary child as either a sidebar or a bottom sheet.

``xml <object class=”AdwMultiLayoutView”>

<child>
<object class=”AdwLayout”>

<property name=”name”>sidebar</property> <property name=”content”>

<object class=”AdwOverlaySplitView”>
<property name=”sidebar”>
<object class=”AdwLayoutSlot”>

<property name=”id”>secondary</property>

</object>

</property> <property name=”content”>

<object class=”AdwLayoutSlot”>

<property name=”id”>primary</property>

</object>

</property>

</object>

</property>

</object>

</child> <child>

<object class=”AdwLayout”>

<property name=”name”>bottom-sheet</property> <property name=”content”>

<object class=”AdwBottomSheet”>

<property name=”open”>True</property> <property name=”content”>

<object class=”AdwLayoutSlot”>

<property name=”id”>primary</property>

</object>

</property> <property name=”sheet”>

<object class=”AdwLayoutSlot”>

<property name=”id”>secondary</property>

</object>

</property>

</object>

</property>

</object>

</child> <child type=”primary”>

<!– … –>

</child> <child type=”secondary”>

<!– … –>

</child>

</object> ``

CSS nodes

AdwMultiLayoutView has a single CSS node with name multi-layout-view.

New in version 1.6.

classmethod new()
Returns:

the newly created AdwMultiLayoutView

Return type:

Gtk.Widget

Creates a new AdwMultiLayoutView.

New in version 1.6.

add_layout(layout)
Parameters:

layout (Adw.Layout) – the layout to add

Adds layout to self.

New in version 1.6.

get_child(id)
Parameters:

id (str) – the id of the child

Returns:

the child for id

Return type:

Gtk.Widget or None

Gets the child for id to self.

New in version 1.6.

get_layout()
Returns:

the current layout

Return type:

Adw.Layout or None

Gets the currently used layout of self.

New in version 1.6.

get_layout_by_name(name)
Parameters:

name (str) – the name of the layout

Returns:

the layout with name

Return type:

Adw.Layout or None

Gets layout with the name name from self, or NULL if it doesn’t exist.

See [property`Layout`:py:data::name<Adw.MultiLayoutView.props.name>].

New in version 1.6.

get_layout_name()
Returns:

the name of the current layout

Return type:

str or None

Returns the name of the currently used layout of self.

New in version 1.6.

remove_layout(layout)
Parameters:

layout (Adw.Layout) – the layout to add

Removes layout from self.

New in version 1.6.

set_child(id, child)
Parameters:
  • id (str) – the id of the child

  • child (Gtk.Widget) – the child to set

Sets child as the child for id in self.

When changing layouts, it will be inserted into the slot with id.

New in version 1.6.

set_layout(layout)
Parameters:

layout (Adw.Layout) – a layout in self

Makes layout the current layout of self.

New in version 1.6.

set_layout_name(name)
Parameters:

name (str) – the name of the layout

Makes the layout with name the current layout of self.

See [property`Layout`:py:data::name<Adw.MultiLayoutView.props.name>].

New in version 1.6.

Property Details

Adw.MultiLayoutView.props.layout
Name:

layout

Type:

Adw.Layout

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The currently used layout.

New in version 1.6.

Adw.MultiLayoutView.props.layout_name
Name:

layout-name

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The name of the currently used layout.

See [property`Layout`:py:data::name<Adw.MultiLayoutView.props.name>].

New in version 1.6.