Adw.MultiLayoutView¶
- Subclasses:
None
Methods¶
- Inherited:
Gtk.Widget (183), GObject.Object (37), Gtk.Accessible (17), Gtk.Buildable (1)
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Gtk.Widget (25), GObject.Object (7), Gtk.Accessible (6), Gtk.Buildable (9)
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/en |
|||
r/w/en |
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class Adw.MultiLayoutView(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
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.
The
AdwMultiLayoutView
implementation of the [iface`Gtk`.Buildable] interface supports adding layouts via<child>
element with thetype
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 namemulti-layout-view
.New in version 1.6.
- classmethod new()¶
- Returns:
the newly created
AdwMultiLayoutView
- Return type:
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
orNone
Gets the child for id to self.
New in version 1.6.
- get_layout()¶
- Returns:
the current layout
- Return type:
Adw.Layout
orNone
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
orNone
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 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 childchild (
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.
Property Details¶
- Adw.MultiLayoutView.props.layout¶
- Name:
layout
- Type:
- Default Value:
- Flags:
The currently used layout.
New in version 1.6.