ViewStack

class ViewStack(pointer: <Error class: unknown class><<Error class: unknown class>>)

A view container for class@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 class@ViewSwitcher 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 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 class@Gtk.Stack, transitions between views are not animated.

AdwViewStack maintains a class@ViewStackPage object for each added child, which holds additional per-child properties. You obtain the class@ViewStackPage for a child with method@ViewStack.get_page and you can obtain a iface@Gtk.SelectionModel containing all the pages with method@ViewStack.get_pages.

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

AdwViewStack has a single CSS node named stack.

Accessibility

AdwViewStack uses the GTK_ACCESSIBLE_ROLE_TAB_PANEL for the stack pages which are the accessible parent objects of the child widgets.

Skipped during bindings generation

  • method visible-child: Property TypeInfo of getter and setter do not match

  • method visible-child-name: Property TypeInfo of getter and setter do not match

Constructors

Link copied to clipboard
constructor()

Creates a new AdwViewStack.

constructor(pointer: <Error class: unknown class><<Error class: unknown class>>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val adwViewStackPointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
open val gtkAccessiblePointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
open val gtkBuildablePointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
open val gtkConstraintTargetPointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard

Whether the stack is horizontally homogeneous.

Link copied to clipboard
val pages: <Error class: unknown class>

A selection model with the stack's pages.

Link copied to clipboard

Whether the stack is vertically homogeneous.

Functions

Link copied to clipboard
fun add(child: <Error class: unknown class>): ViewStackPage

Adds a child to @self.

Link copied to clipboard
fun addNamed(child: <Error class: unknown class>, name: String? = null): ViewStackPage

Adds a child to @self.

Link copied to clipboard
fun addTitled(child: <Error class: unknown class>, name: String? = null, title: String): ViewStackPage

Adds a child to @self.

Link copied to clipboard
fun addTitledWithIcon(child: <Error class: unknown class>, name: String? = null, title: String, iconName: String): ViewStackPage

Adds a child to @self.

Link copied to clipboard
fun getChildByName(name: String): <Error class: unknown class>?

Finds the child with @name in @self.

Link copied to clipboard

Gets whether @self is horizontally homogeneous.

Link copied to clipboard
fun getPage(child: <Error class: unknown class>): ViewStackPage

Gets the class@ViewStackPage object for @child.

Link copied to clipboard
fun getPages(): <Error class: unknown class>

Returns a iface@Gio.ListModel that contains the pages of the stack.

Link copied to clipboard

Gets whether @self is vertically homogeneous.

Link copied to clipboard
fun getVisibleChild(): <Error class: unknown class>?

Gets the currently visible child of @self.

Link copied to clipboard

Returns the name of the currently visible child of @self.

Link copied to clipboard
fun remove(child: <Error class: unknown class>)

Removes a child widget from @self.

Link copied to clipboard
fun setHhomogeneous(hhomogeneous: Boolean)

Sets @self to be horizontally homogeneous or not.

Link copied to clipboard
fun setVhomogeneous(vhomogeneous: Boolean)

Sets @self to be vertically homogeneous or not.

Link copied to clipboard
fun setVisibleChild(child: <Error class: unknown class>)

Makes @child the visible child of @self.

Link copied to clipboard

Makes the child with @name visible.