ViewSwitcherSidebar#
Added in version 1.9.
Superclasses: Widget, InitiallyUnowned, Object
Implemented Interfaces: Accessible, Buildable, ConstraintTarget
An adaptive sidebar that controls an ViewStack.
AdwViewSwitcherSidebar is a view switcher implemented using a
Sidebar, in a similar fashion to StackSidebar.
AdwViewSwitcherSidebar items have an icon, a label, as well as an unread
dot or a badge.
Unlike other switchers, AdwViewSwitcherSidebar supports grouping pages into
sections, using the starts_section and
section_title properties.
Like Sidebar, AdwViewSwitcherSidebar is adaptive and can behave as
a sidebar or a page, via the mode property.
Connect to the activated signal to run code when
an item has been activated. This can be used to toggle the visible pane when
used in a split view.
Like AdwSidebar, AdwViewSwitcherSidebar supports filtering items via the
filter property.
Use placeholder to provide an empty state
widget. It will be shown when all items have been filtered out, or the
sidebar has no items otherwise.
CSS nodes#
AdwViewSwitcherSidebar has a single CSS node with name
view-switcher-sidebar.
See also: ViewSwitcher, ViewSwitcherBar,
InlineViewSwitcher.
Constructors#
Methods#
- class ViewSwitcherSidebar
-
- get_mode() → SidebarMode#
Gets
self's look and behavior.See
get_mode.Added in version 1.9.
- set_filter(filter: Filter | None = None) → None#
Sets the item filter for
self.Can be used to implement search within the sidebar.
Use
placeholderto provide an empty state.See
set_filter.Added in version 1.9.
- Parameters:
filter – the item filter
- set_mode(mode: SidebarMode) → None#
Sets
self's look and behavior.
If set to
sidebar, behaves like a sidebar: with a sidebar style and a persistent selection.If set to
page, behaves like a page of boxed lists. In this mode, the selection is invisible and only tracked to determine the initially selected item once switched back to sidebar mode.The page mode is intended to be used with
NavigationSplitViewwhen 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
set_mode.Added in version 1.9.
- Parameters:
mode – the new mode
Properties#
- class ViewSwitcherSidebar
-
- props.mode: SidebarMode#
The type of the None singleton.
Added in version 1.9.