AdwViewStack

A view container for class@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 class@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 class@ViewSwitcher will use to let users identify which page is which. Set them using the property@ViewStackPage:title, property@ViewStackPage:icon-name, property@ViewStackPage:needs-attention, and property@ViewStackPage:badge-number properties.

Unlike gtk.stack.Stack, transitions between views are not animated.

adw.view_stack.ViewStack maintains a class@ViewStackPage object for each added child, which holds additional per-child properties. You obtain the class@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 class@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.

struct AdwViewStack