Class ViewSwitcher

All Implemented Interfaces:
PointerInterface

public class ViewSwitcher extends Widget
An adaptive view switcher.

<picture>
<source srcset="view-switcher-dark.png" media="(prefers-color-scheme: dark)">
<img src="view-switcher.png" alt="view-switcher">
</picture>

An adaptive view switcher designed to switch between multiple views
contained in a [class@ViewStack] in a similar fashion to
[class@Gtk.StackSwitcher].

`AdwViewSwitcher` buttons always have an icon and a label. They can be
displayed side by side, or icon on top of the label. This can be controlled
via the [property@ViewSwitcher:policy] property.

Most applications should be using [class@ViewSwitcherBar] and
[class@ViewSwitcherTitle].

## CSS nodes

`AdwViewSwitcher` has a single CSS node with name `viewswitcher`. It can have
the style classes `.wide` and `.narrow`, matching its policy.

## Accessibility

`AdwViewSwitcher` uses the `GTK_ACCESSIBLE_ROLE_TAB_LIST` role and uses the
`GTK_ACCESSIBLE_ROLE_TAB` for its buttons.

https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.ViewSwitcher.html

  • Constructor Details

    • ViewSwitcher

      public ViewSwitcher(PointerContainer pointer)
    • ViewSwitcher

      public ViewSwitcher()
      Creates a new `AdwViewSwitcher`.
  • Method Details

    • getClassHandler

      public static ClassHandler getClassHandler()
    • getPolicy

      public int getPolicy()
      Gets the policy of @self.
      Returns:
      the policy of @self
    • getStack

      public ViewStack getStack()
      Gets the stack controlled by @self.
      Returns:
      the stack
    • setPolicy

      public void setPolicy(int policy)
      Sets the policy of @self.
      Parameters:
      policy - the new policy
    • setStack

      public void setStack(@Nullable ViewStack stack)
      Sets the stack controlled by @self.
      Parameters:
      stack - a stack
    • asAccessible

      public Accessible asAccessible()
      Implements interface Accessible. Call this to get access to interface functions.
      Overrides:
      asAccessible in class Widget
      Returns:
      Accessible
    • asBuildable

      public Buildable asBuildable()
      Implements interface Buildable. Call this to get access to interface functions.
      Overrides:
      asBuildable in class Widget
      Returns:
      Buildable
    • asConstraintTarget

      public ConstraintTarget asConstraintTarget()
      Implements interface ConstraintTarget. Call this to get access to interface functions.
      Overrides:
      asConstraintTarget in class Widget
      Returns:
      ConstraintTarget
    • getTypeID

      public static long getTypeID()
    • getParentTypeID

      public static long getParentTypeID()
    • getTypeSize

      public static TypeSystem.TypeSize getTypeSize()
    • getParentTypeSize

      public static TypeSystem.TypeSize getParentTypeSize()
    • getInstanceSize

      public static int getInstanceSize()