1.33 <AdwMultiLayoutView>

Class: <AdwMultiLayoutView>

It derives from <GtkWidget>.

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 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 MultiLayoutView:layout or MultiLayoutView:layout-name properties. For example, it can be done via a <AdwBreakpoint> setter to change layouts depending on the window size.

AdwMultiLayoutView as GtkBuildable

The <AdwMultiLayoutView> implementation of the <GtkBuildable> 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.

<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.

Properties

Property: multi-layout-view:layout self

The currently used layout.

Its value is a <AdwLayout>, or #f.

Set it with (set! (multi-layout-view:layout self) value).

Property: multi-layout-view:layout-name self

The name of the currently used layout.

See Layout:name.

Its value is a string, or #f.

Set it with (set! (multi-layout-view:layout-name self) value).

Procedures

Method: multi-layout-view:add-layout self layout
Method: add-layout self layout

Adds layout to self.

self

Passed: a <AdwMultiLayoutView>.

a multi-layout view

layout

Passed: a <AdwLayout>.

the layout to add

Method: multi-layout-view:get-child self id ⇒ %return
Method: get-child self id ⇒ %return

Gets the child for id to self.

self

Passed: a <AdwMultiLayoutView>.

a multi-layout view

id

Passed: a string.

the id of the child

%return

Returned: a <GtkWidget>, or #f.

the child for id

Method: multi-layout-view:get-layout self ⇒ %return
Method: get-layout self ⇒ %return

Gets the currently used layout of self.

self

Passed: a <AdwMultiLayoutView>.

a multi-layout view

%return

Returned: a <AdwLayout>, or #f.

the current layout

Method: multi-layout-view:get-layout-by-name self name ⇒ %return
Method: get-layout-by-name self name ⇒ %return

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

See Layout:name.

self

Passed: a <AdwMultiLayoutView>.

a multi-layout view

name

Passed: a string.

the name of the layout

%return

Returned: a <AdwLayout>, or #f.

the layout with name

Method: multi-layout-view:get-layout-name self ⇒ %return
Method: get-layout-name self ⇒ %return

Returns the name of the currently used layout of self.

self

Passed: a <AdwMultiLayoutView>.

a multi-layout view

%return

Returned: a string, or #f.

the name of the current layout

Procedure: multi-layout-view:new ⇒ %return

Creates a new <AdwMultiLayoutView>.

%return

Returned: a <GtkWidget>.

the newly created <AdwMultiLayoutView>

Method: multi-layout-view:remove-layout self layout
Method: remove-layout self layout

Removes layout from self.

self

Passed: a <AdwMultiLayoutView>.

a multi-layout view

layout

Passed: a <AdwLayout>.

the layout to add

Method: multi-layout-view:set-child self id child
Method: set-child self id child

Sets child as the child for id in self.

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

self

Passed: a <AdwMultiLayoutView>.

a multi-layout view

id

Passed: a string.

the id of the child

child

Passed: a <GtkWidget>.

the child to set

Method: multi-layout-view:set-layout self layout
Method: set-layout self layout

Makes layout the current layout of self.

self

Passed: a <AdwMultiLayoutView>.

a multi-layout view

layout

Passed: a <AdwLayout>.

a layout in self

Method: multi-layout-view:set-layout-name self name
Method: set-layout-name self name

Makes the layout with name the current layout of self.

See Layout:name.

self

Passed: a <AdwMultiLayoutView>.

a multi-layout view

name

Passed: a string.

the name of the layout