adw.view_stack
Module for [ViewStack] class
Types 3
A view container for adw.view_switcher.ViewSwitcher.
adw.view_stack.ViewStack 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 adw.view_switcher.ViewSwitcher can be used with adw.view_stack.ViewStack to provide this functionality.
adw.view_stack.ViewStack pages can have a title, an icon, an attention request, and a numbered badge that adw.view_switcher.ViewSwitcher will use to let users identify which page is which. Set them using the adw.view_stack_page.ViewStackPage.title, adw.view_stack_page.ViewStackPage.iconName, adw.view_stack_page.ViewStackPage.needsAttention, and adw.view_stack_page.ViewStackPage.badgeNumber properties.
Unlike gtk.stack.Stack, transitions between views are not animated.
adw.view_stack.ViewStack maintains a adw.view_stack_page.ViewStackPage object for each added child, which holds additional per-child properties. You obtain the adw.view_stack_page.ViewStackPage for a child with adw.view_stack.ViewStack.getPage and you can obtain a gtk.selection_model.SelectionModel containing all the pages with adw.view_stack.ViewStack.getPages.
AdwViewStack as GtkBuildable
To set child-specific properties in a .ui file, create adw.view_stack_page.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>CSS nodes
adw.view_stack.ViewStack has a single CSS node named stack.
Accessibility
adw.view_stack.ViewStack uses the gtk.types.AccessibleRole.TabPanel for the stack pages which are the accessible parent objects of the child widgets.
ViewStackGidBuilder builder() static nothrowGet builder for [adw.view_stack.ViewStack] Returns: New builder objectbool hhomogeneous() @property nothrowGet `hhomogeneous` property. Returns: Whether the stack is horizontally homogeneous.void hhomogeneous(bool propval) @property nothrowSet `hhomogeneous` property. Params: propval = Whether the stack is horizontally homogeneous.gtk.selection_model.SelectionModel pages() @property nothrowGet `pages` property. Returns: A selection model with the stack's pages.bool vhomogeneous() @property nothrowGet `vhomogeneous` property. Returns: Whether the stack is vertically homogeneous.void vhomogeneous(bool propval) @property nothrowSet `vhomogeneous` property. Params: propval = Whether the stack is vertically homogeneous.gtk.widget.Widget visibleChild() @property nothrowGet `visibleChild` property. Returns: The widget currently visible in the stack.void visibleChild(gtk.widget.Widget propval) @property nothrowSet `visibleChild` property. Params: propval = The widget currently visible in the stack.string visibleChildName() @property nothrowGet `visibleChildName` property. Returns: The name of the widget currently visible in the stack.void visibleChildName(string propval) @property nothrowSet `visibleChildName` property. Params: propval = The name of the widget currently visible in the stack.adw.view_stack_page.ViewStackPage addNamed(gtk.widget.Widget child, string name = null) nothrowAdds a child to self.adw.view_stack_page.ViewStackPage addTitled(gtk.widget.Widget child, string name, string title) nothrowAdds a child to self.adw.view_stack_page.ViewStackPage addTitledWithIcon(gtk.widget.Widget child, string name, string title, string iconName) nothrowAdds a child to self.bool getHhomogeneous() nothrowGets whether self is horizontally homogeneous. Returns: whether self is horizontally homogeneousadw.view_stack_page.ViewStackPage getPage(gtk.widget.Widget child) nothrowGets the [adw.view_stack_page.ViewStackPage] object for child.gtk.selection_model.SelectionModel getPages() nothrowReturns a [gio.list_model.ListModel] that contains the pages of the stack.bool getVhomogeneous() nothrowGets whether self is vertically homogeneous. Returns: whether self is vertically homogeneousgtk.widget.Widget getVisibleChild() nothrowGets the currently visible child of self. Returns: the visible childstring getVisibleChildName() nothrowReturns the name of the currently visible child of self. Returns: the name of the visible childFluent builder implementation template for adw.view_stack.ViewStack
T hhomogeneous(bool propval) nothrowSet `hhomogeneous` property. Params: propval = Whether the stack is horizontally homogeneous.T vhomogeneous(bool propval) nothrowSet `vhomogeneous` property. Params: propval = Whether the stack is vertically homogeneous.T visibleChild(gtk.widget.Widget propval) nothrowSet `visibleChild` property. Params: propval = The widget currently visible in the stack. Returns: Builder instance for fluent chainingT visibleChildName(string propval) nothrowSet `visibleChildName` property. Params: propval = The name of the widget currently visible in the stack.Fluent builder for adw.view_stack.ViewStack