Stacks
Three widgets keep a set of pages and show one of them at a time. The stack is the container itself; the switcher and the sidebar are two different controls that switch over a stack; the notebook is the older container that brings its own tab bar with it.
One visible child out of many. transition-type picks the animation —
crossfade, the four slide-…, the eight over-… / under-… and the rotates —
and transition-duration its length; a two-way nick such as
slide-left-right resolves to one of the one-directional types by which page you
came from, exactly as get_simple_transition_type does.
hhomogeneous and vhomogeneous say whether every page is allocated the
same width and height; both are on by default, and the measure pass then looks
at the visible page alone. interpolate-size lets the stack’s own box resize
smoothly during the change.
StackSwitcher
Section titled “StackSwitcher”A linked row of toggle buttons, one per page of a stack. stack names the
stack by id and the row follows it in both directions: clicking a button makes
its page visible, and a page change anywhere else re-marks the buttons. You
cannot deselect the current page by clicking its own button — GTK undoes the
deactivation from the stack itself.
What each button shows follows the page. A title gives a label button; an
icon-name gives an icon button and puts the title on the switcher as a
tooltip; a page with both shows both; and a page with neither is left out
of the row entirely. needs-attention on a page puts a dot on its button.
orientation turns the row vertical.
StackSidebar
Section titled “StackSidebar”The same binding as the switcher, in a vertical list down the side of your window.
stack names the stack by id and the rows follow it in both directions.
A row is made of the page’s title alone. That is the one rule where this and
the switcher disagree: the switcher falls back to an icon when there is no title,
the sidebar does not, so a page carrying only an icon gets no row at all.
needs-attention puts a dot in front of the label.
Notebook
Section titled “Notebook”The older page container, and a stack that brings its own tab bar. In C it holds a
GtkStack for the pages and a header widget beside it, which is why page is an
index rather than a name: the stack speaks names, the notebook speaks positions.
tab-pos says which edge the strip is on — top, bottom, left, right — and
show-tabs takes it away entirely. show-border is the bevel around the pages:
in C it is a CSS class (gtk_notebook_set_show_border adds .frame), and its own
docs say it only shows once the tabs are not. enable-popup puts the pages in a
right-click menu.
A GtkNotebookPage is a GObject too, so tab-label, menu-label, tab-fill,
tab-expand and reorderable live on the page element. A page with no
tab-label is not left out of the strip — it is numbered, “Page 3”, counting the
visible pages from one.
Three guards are C’s, not ours: a negative page means the last page rather than
“none”, an out-of-range page does nothing at all, and a page whose element is
hidden cannot be switched to.
Related
Section titled “Related”- Layout: the containers a page inside a stack is built from.
- Buttons: the toggle button a switcher’s row is made of.
- Adwaita View Switching:
Adw.ViewStackand the three switchers, libadwaita’s own answer to the same job. - Adwaita Storybook: the same widgets in a live component browser you can poke at.