It derives from <GtkWidget>.
A view container for ViewSwitcher.
<AdwViewStack> is a container which only shows
one page at a time. It is typically used to hold an application’s main
views.
It doesn’t provide a way to transition between pages. Instead, a
separate widget such as ViewSwitcher, InlineViewSwitcher
or ViewSwitcherSidebar can be used with
<AdwViewStack> to provide this functionality.
<AdwViewStack> pages can have a title, an icon,
an attention request, and a numbered badge that ViewSwitcher will
use to let users identify which page is which. Set them using the
ViewStackPage:title, ViewStackPage:icon-name,
ViewStackPage:needs-attention, and
ViewStackPage:badge-number properties.
<AdwViewStack> pages can also be grouped into
sections, using the ViewStackPage:starts-section and
ViewStackPage:section-title properties. Currently, only
ViewSwitcherSidebar displays groups.
Unlike <GtkStack>, transitions between views can
only be animated via a crossfade and size changes are always
interpolated. Animations are disabled by default. Use
ViewStack:enable-transitions to enable them.
<AdwViewStack> maintains a ViewStackPage
object for each added child, which holds additional per-child
properties. You obtain the ViewStackPage for a child with
ViewStack.get_page and you can obtain a
<GtkSelectionModel> containing all the
pages with ViewStack.get_pages.
To set child-specific properties in a .ui file, create
ViewStackPage objects explicitly, and set the child widget as a
property on it:
<object class="AdwViewStack" id="stack">
<child>
<object class="AdwViewStackPage">
<property name="name">overview</property>
<property name="title">Overview</property>
<property name="child">
<object class="AdwStatusPage">
<property name="title">Welcome!</property>
</object>
</property>
</object>
</child>
</object>
<AdwViewStack> has a single CSS node named
stack.
<AdwViewStack> uses the
Gtk.AccessibleRole.tab-panel for the stack pages which are the
accessible parent objects of the child widgets.
Whether the stack uses a crossfade transition between pages.
Use ViewStack:transition-duration to control the duration, and
ViewStack:transition-running to know when the transition is
running.
Its value is a boolean.
Set it with (set! (view-stack:enable-transitions self) value).
Whether the stack is horizontally homogeneous.
If the stack is horizontally homogeneous, it allocates the same width for all children.
If it’s FALSE, the stack may change width when a different child
becomes visible.
Its value is a boolean.
Set it with (set! (view-stack:hhomogeneous self) value).
A selection model with the stack’s pages.
This can be used to keep an up-to-date view.
The model implements <GtkSectionModel>
and creates sections based on ViewStackPage:starts-section
values.
The model also implements
<GtkSelectionModel> and can be used to
track and change the visible page.
Its value is a <GtkSelectionModel>, or
#f.
It is read only.
The transition animation duration, in milliseconds.
Only used when ViewStack:enable-transitions is set to
TRUE.
Its value is an unsigned 32-bit integer.
Set it with (set! (view-stack:transition-duration self) value).
Whether a transition is currently running.
If a transition is impossible, the property value will be set to
TRUE and then immediately to FALSE, so it’s possible to
rely on its notifications to know that a transition has happened.
Its value is a boolean.
It is read only.
Whether the stack is vertically homogeneous.
If the stack is vertically homogeneous, it allocates the same height for all children.
If it’s FALSE, the stack may change height when a different child
becomes visible.
Its value is a boolean.
Set it with (set! (view-stack:vhomogeneous self) value).
The widget currently visible in the stack.
Its value is a <GtkWidget>, or #f.
Set it with (set! (view-stack:visible-child self) value).
The name of the widget currently visible in the stack.
See ViewStack:visible-child.
Its value is a string, or #f.
Set it with (set! (view-stack:visible-child-name self) value).
Adds a child to self.
Passed: a <AdwViewStack>.
a view stack
Passed: a <GtkWidget>.
the widget to add
Returned: a <AdwViewStackPage>.
the ViewStackPage for child
Adds a child to self.
The child is identified by the name.
Passed: a <AdwViewStack>.
a view stack
Passed: a <GtkWidget>.
the widget to add
Passed, or left out: a string, or #f.
the name for child
Returned: a <AdwViewStackPage>.
the <AdwViewStackPage> for child
Adds a child to self.
The child is identified by the name. The title will be used
by ViewSwitcher to represent child, so it should be short.
Passed: a <AdwViewStack>.
a view stack
Passed: a <GtkWidget>.
the widget to add
Passed: a string, or #f.
the name for child
Passed: a string.
a human-readable title for child
Returned: a <AdwViewStackPage>.
the <AdwViewStackPage> for child
Adds a child to self.
The child is identified by the name. The title and
icon-name will be used by ViewSwitcher to represent
child.
Passed: a <AdwViewStack>.
a view stack
Passed: a <GtkWidget>.
the widget to add
Passed: a string, or #f.
the name for child
Passed: a string.
a human-readable title for child
Passed: a string.
an icon name for child
Returned: a <AdwViewStackPage>.
the <AdwViewStackPage> for child
Finds the child with name in self.
Passed: a <AdwViewStack>.
a view stack
Passed: a string.
the name of the child to find
Returned: a <GtkWidget>, or #f.
the requested child
Gets whether self uses a crossfade transition between pages.
Use ViewStack:transition-duration to control the duration, and
ViewStack:transition-running to know when the transition is
running.
Passed: a <AdwViewStack>.
a view stack
Returned: a boolean.
whether to enable page transitions
Gets whether self is horizontally homogeneous.
Passed: a <AdwViewStack>.
a view stack
Returned: a boolean.
whether self is horizontally homogeneous
Gets the ViewStackPage object for child.
Passed: a <AdwViewStack>.
a view stack
Passed: a <GtkWidget>.
a child of self
Returned: a <AdwViewStackPage>.
the page object for child
Returns a <GListModel> that contains the
pages of the stack.
This can be used to keep an up-to-date view.
The model implements <GtkSectionModel>
and creates sections based on ViewStackPage:starts-section
values.
The model also implements
<GtkSelectionModel> and can be used to
track and change the visible page.
Passed: a <AdwViewStack>.
a view stack
Returned: a <GtkSelectionModel>.
a <GtkSelectionModel> for the stack’s
children
Gets the transition animation duration for self.
Passed: a <AdwViewStack>.
a view stack
Returned: an unsigned 32-bit integer.
the transition duration, in milliseconds
Gets whether a transition is currently running for self.
If a transition is impossible, the property value will be set to
TRUE and then immediately to FALSE, so it’s possible to
rely on its notifications to know that a transition has happened.
Passed: a <AdwViewStack>.
a view stack
Returned: a boolean.
whether a transition is currently running
Gets whether self is vertically homogeneous.
Passed: a <AdwViewStack>.
a view stack
Returned: a boolean.
whether self is vertically homogeneous
Gets the currently visible child of self.
Passed: a <AdwViewStack>.
a view stack
Returned: a <GtkWidget>, or #f.
the visible child
Returns the name of the currently visible child of self.
Passed: a <AdwViewStack>.
a view stack
Returned: a string, or #f.
the name of the visible child
Creates a new <AdwViewStack>.
Returned: a <GtkWidget>.
the newly created <AdwViewStack>
Removes a child widget from self.
Passed: a <AdwViewStack>.
a view stack
Passed: a <GtkWidget>.
the child to remove
Sets whether self uses a crossfade transition between pages.
Passed: a <AdwViewStack>.
a view stack
Passed: a boolean.
whether to enable page transitions
Sets self to be horizontally homogeneous or not.
If the stack is horizontally homogeneous, it allocates the same width for all children.
If it’s FALSE, the stack may change width when a different child
becomes visible.
Passed: a <AdwViewStack>.
a view stack
Passed: a boolean.
whether to make self horizontally homogeneous
Sets the transition animation duration for self.
Only used when ViewStack:enable-transitions is set to
TRUE.
Passed: a <AdwViewStack>.
a view stack
Passed: an unsigned 32-bit integer.
the new duration, in milliseconds
Sets self to be vertically homogeneous or not.
If the stack is vertically homogeneous, it allocates the same height for all children.
If it’s FALSE, the stack may change height when a different child
becomes visible.
Passed: a <AdwViewStack>.
a view stack
Passed: a boolean.
whether to make self vertically homogeneous
Makes child the visible child of self.
Passed: a <AdwViewStack>.
a view stack
Passed: a <GtkWidget>.
a child of self
Makes the child with name visible.
See ViewStack:visible-child.
Passed: a <AdwViewStack>.
a view stack
Passed: a string.
the name of the child