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()Get builder for [adw.view_stack.ViewStack] Returns: New builder objectbool hhomogeneous() @propertyGet `hhomogeneous` property. Returns: Whether the stack is horizontally homogeneous.void hhomogeneous(bool propval) @propertySet `hhomogeneous` property. Params: propval = Whether the stack is horizontally homogeneous.gtk.selection_model.SelectionModel pages() @propertyGet `pages` property. Returns: A selection model with the stack's pages.bool vhomogeneous() @propertyGet `vhomogeneous` property. Returns: Whether the stack is vertically homogeneous.void vhomogeneous(bool propval) @propertySet `vhomogeneous` property. Params: propval = Whether the stack is vertically homogeneous.gtk.widget.Widget visibleChild() @propertyGet `visibleChild` property. Returns: The widget currently visible in the stack.void visibleChild(gtk.widget.Widget propval) @propertySet `visibleChild` property. Params: propval = The widget currently visible in the stack.string visibleChildName() @propertyGet `visibleChildName` property. Returns: The name of the widget currently visible in the stack.void visibleChildName(string propval) @propertySet `visibleChildName` property. Params: propval = The name of the widget currently visible in the stack.adw.view_stack_page.ViewStackPage add(gtk.widget.Widget child)Adds a child to self.adw.view_stack_page.ViewStackPage addNamed(gtk.widget.Widget child, string name = null)Adds a child to self.adw.view_stack_page.ViewStackPage addTitled(gtk.widget.Widget child, string name, string title)Adds a child to self.adw.view_stack_page.ViewStackPage addTitledWithIcon(gtk.widget.Widget child, string name, string title, string iconName)Adds a child to self.gtk.widget.Widget getChildByName(string name)Finds the child with name in self.bool getHhomogeneous()Gets whether self is horizontally homogeneous. Returns: whether self is horizontally homogeneousadw.view_stack_page.ViewStackPage getPage(gtk.widget.Widget child)Gets the [adw.view_stack_page.ViewStackPage] object for child.gtk.selection_model.SelectionModel getPages()Returns a [gio.list_model.ListModel] that contains the pages of the stack.bool getVhomogeneous()Gets whether self is vertically homogeneous. Returns: whether self is vertically homogeneousgtk.widget.Widget getVisibleChild()Gets the currently visible child of self. Returns: the visible childstring getVisibleChildName()Returns the name of the currently visible child of self. Returns: the name of the visible childvoid remove(gtk.widget.Widget child)Removes a child widget from self.void setHhomogeneous(bool hhomogeneous)Sets self to be horizontally homogeneous or not.void setVhomogeneous(bool vhomogeneous)Sets self to be vertically homogeneous or not.void setVisibleChild(gtk.widget.Widget child)Makes child the visible child of self.void setVisibleChildName(string name)Makes the child with name visible.Fluent builder implementation template for adw.view_stack.ViewStack
T hhomogeneous(bool propval)Set `hhomogeneous` property. Params: propval = Whether the stack is horizontally homogeneous.T vhomogeneous(bool propval)Set `vhomogeneous` property. Params: propval = Whether the stack is vertically homogeneous.T visibleChild(gtk.widget.Widget propval)Set `visibleChild` property. Params: propval = The widget currently visible in the stack. Returns: Builder instance for fluent chainingT visibleChildName(string propval)Set `visibleChildName` property. Params: propval = The name of the widget currently visible in the stack.Fluent builder for adw.view_stack.ViewStack