ViewStack


Object Hierarchy:

Adw.ViewStack Adw.ViewStack Adw.ViewStack Gtk.Widget Gtk.Widget Gtk.Widget->Adw.ViewStack GLib.InitiallyUnowned GLib.InitiallyUnowned GLib.InitiallyUnowned->Gtk.Widget GLib.Object GLib.Object GLib.Object->GLib.InitiallyUnowned Gtk.Accessible Gtk.Accessible Gtk.Accessible->Adw.ViewStack Gtk.Accessible->Gtk.Widget Gtk.Buildable Gtk.Buildable Gtk.Buildable->Adw.ViewStack Gtk.Buildable->Gtk.Widget Gtk.ConstraintTarget Gtk.ConstraintTarget Gtk.ConstraintTarget->Adw.ViewStack Gtk.ConstraintTarget->Gtk.Widget

Description:

[ CCode ( type_id = "adw_view_stack_get_type ()" ) ]
public sealed class ViewStack : Widget, Accessible, Buildable, ConstraintTarget

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:

```xml <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.


Namespace: Adw
Package: libadwaita-1

Content:

Properties:

Creation methods:

Methods:

Inherited Members:

All known members inherited from class Gtk.Widget