Class ViewSwitcherSidebar.Builder<B extends ViewSwitcherSidebar.Builder<B>>

Type Parameters:
B - the type of the Builder that is returned
All Implemented Interfaces:
Accessible.Builder<B>, BuilderInterface
Enclosing class:
ViewSwitcherSidebar

public static class ViewSwitcherSidebar.Builder<B extends ViewSwitcherSidebar.Builder<B>> extends Widget.Builder<B> implements Accessible.Builder<B>
Inner class implementing a builder pattern to construct a GObject with properties.
Since:
1.9
  • Constructor Details

    • Builder

      protected Builder()
      Default constructor for a Builder object.
  • Method Details

    • build

      public ViewSwitcherSidebar build()
      Finish building the ViewSwitcherSidebar object. This will call GObject.withProperties(Type, String[], Value[]) to create a new GObject instance, which is then cast to ViewSwitcherSidebar.
      Overrides:
      build in class Widget.Builder<B extends ViewSwitcherSidebar.Builder<B>>
      Returns:
      a new instance of ViewSwitcherSidebar with the properties that were set in the Builder object.
    • setFilter

      public B setFilter(Filter filter)

      The item filter.

      Can be used to implement search within the sidebar.

      Use ViewSwitcherSidebar:placeholder to provide an empty state.

      See Sidebar:filter.

      Parameters:
      filter - the value for the filter property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.9
    • setMode

      public B setMode(SidebarMode mode)

      Determines the sidebar's look and behavior.

      view-switcher-sidebar-modes

      If set to Adw.SidebarMode.sidebar, behaves like a sidebar: with a sidebar style and a persistent selection.

      If set to Adw.SidebarMode.page, behaves like a page of boxed lists.

      The page mode is intended to be used with NavigationSplitView when collapsed, as the sidebar pane becomes a page there.

      When used with OverlaySplitView, the sidebar should stay in sidebar mode, as the sidebar pane is still a sidebar when collapsed.

      See Sidebar:mode.

      Parameters:
      mode - the value for the mode property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.9
    • setPlaceholder

      public B setPlaceholder(Widget placeholder)

      The placeholder widget.

      This widget will be shown if the sidebar has no items, or all of its items have been filtered out by ViewSwitcherSidebar:filter.

      See Sidebar:placeholder.

      Parameters:
      placeholder - the value for the placeholder property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.9
    • setStack

      public B setStack(ViewStack stack)
      The stack the sidebar controls.
      Parameters:
      stack - the value for the stack property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.9
    • onActivated

      public B onActivated(ViewSwitcherSidebar.ActivatedCallback handler)
      Emitted when an item has been activated.
      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.9
      See Also: