Object Hierarchy:

Object hierarchy for Stack


[ CCode ( type_id = "gtk_stack_get_type ()" ) ]
public class Stack : Widget, Accessible, Buildable, ConstraintTarget

The GtkStack widget is a container which only shows one of its children at a time.

In contrast to GtkNotebook, GtkStack does not provide a means for users to change the visible child. Instead, the StackSwitcher widget can be used with GtkStack to provide this functionality.

Transitions between pages can be animated as slides or fades. This can be controlled with set_transition_type. These animations respect the gtk_enable_animations setting.

GtkStack maintains a StackPage object for each added child, which holds additional per-child properties. You obtain the StackPage for a child with get_page.

GtkStack as GtkBuildable

To set child-specific properties in a .ui file, create GtkStackPage objects explicitly, and set the child widget as a property on it:

  <object class="GtkStack" id="stack">
<object class="GtkStackPage">
<property name="name">page1</property>
<property name="title">In the beginning…</property>
<property name="child">
<object class="GtkLabel">
<property name="label">It was dark</property>
# CSS nodes

GtkStack has a single CSS node named stack.


GtkStack uses the TAB_PANEL for the stack pages, which are the accessible parent objects of the child widgets.

Namespace: Gtk
Package: gtk4



Creation methods:


Inherited Members:

All known members inherited from class Gtk.Widget