Class StackSwitcher

All Implemented Interfaces:
Accessible, Buildable, ConstraintTarget, Orientable, Proxy

@Generated("org.javagi.JavaGI") public class StackSwitcher extends Widget implements Accessible, Buildable, ConstraintTarget, Orientable

Shows a row of buttons to switch between GtkStack pages.

An example GtkStackSwitcher

It acts as a controller for the associated GtkStack.

All the content for the buttons comes from the properties of the stacks StackPage objects; the button visibility in a GtkStackSwitcher widget is controlled by the visibility of the child in the GtkStack.

It is possible to associate multiple GtkStackSwitcher widgets with the same GtkStack widget.

CSS nodes

GtkStackSwitcher has a single CSS node named stackswitcher and style class .stack-switcher.

When circumstances require it, GtkStackSwitcher adds the .needs-attention style class to the widgets representing the stack pages.

Accessibility

GtkStackSwitcher uses the Gtk.AccessibleRole.tab_list role and uses the Gtk.AccessibleRole.tab role for its buttons.

Orientable

Since GTK 4.4, GtkStackSwitcher implements GtkOrientable allowing the stack switcher to be made vertical with gtk_orientable_set_orientation().

  • Constructor Details

    • StackSwitcher

      public StackSwitcher(MemorySegment address)
      Create a StackSwitcher instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • StackSwitcher

      public StackSwitcher()
      Create a new StackSwitcher.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the StackSwitcher class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected StackSwitcher asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class Widget
      Returns:
      the instance as if it were its parent type
    • getStack

      public @Nullable Stack getStack()
      Retrieves the stack.
      Returns:
      the stack
    • setStack

      public void setStack(@Nullable Stack stack)
      Sets the stack to control.
      Parameters:
      stack - a GtkStack
    • builder

      public static StackSwitcher.Builder<? extends StackSwitcher.Builder> builder()
      A StackSwitcher.Builder object constructs a StackSwitcher with the specified properties. Use the various set...() methods to set properties, and finish construction with StackSwitcher.Builder.build().
      Returns:
      the builder object