Adw.ViewSwitcherSidebar¶
- Subclasses:
None
Methods¶
- Inherited:
Gtk.Widget (183), GObject.Object (37), Gtk.Accessible (18), Gtk.Buildable (1)
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Gtk.Widget (25), GObject.Object (7), Gtk.Accessible (7), Gtk.Buildable (9)
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
|---|---|---|---|
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
Signals¶
- Inherited:
Name |
Short Description |
|---|---|
Emitted when an item has been activated. |
Fields¶
- Inherited:
Class Details¶
- class Adw.ViewSwitcherSidebar(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
An adaptive sidebar that controls an [class`ViewStack`].
<picture> <source srcset=”view-switcher-sidebar-dark.png” media=”(prefers-color-scheme: dark)”> <img src=”view-switcher-sidebar.png” alt=”view-switcher-sidebar”> </picture>
AdwViewSwitcherSidebaris a view switcher implemented using a [class`Sidebar`], in a similar fashion to [class`Gtk`.StackSidebar].AdwViewSwitcherSidebaritems have an icon, a label, as well as an unread dot or a badge.Unlike other switchers,
AdwViewSwitcherSidebarsupports grouping pages into sections, using the [property`ViewStackPage`:py:data::starts-section<Adw.ViewSwitcherSidebar.props.starts_section>] and [property`ViewStackPage`:py:data::section-title<Adw.ViewSwitcherSidebar.props.section_title>] properties.Like [class`Sidebar`],
AdwViewSwitcherSidebaris adaptive and can behave as a sidebar or a page, via the [property`ViewSwitcherSidebar`:py:data::mode<Adw.ViewSwitcherSidebar.props.mode>] property.<picture> <source srcset=”view-switcher-sidebar-modes-dark.png” media=”(prefers-color-scheme: dark)”> <img src=”view-switcher-sidebar-modes.png” alt=”view-switcher-sidebar-modes”> </picture>
Connect to the [signal`ViewSwitcherSidebar`:py:func:::activated<Adw.ViewSwitcherSidebar.signals.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,AdwViewSwitcherSidebarsupports filtering items via the [property`ViewSwitcherSidebar`:py:data::filter<Adw.ViewSwitcherSidebar.props.filter>] property.Use [property`ViewSwitcherSidebar`:py:data::placeholder<Adw.ViewSwitcherSidebar.props.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
AdwViewSwitcherSidebarhas a single CSS node with nameview-switcher-sidebar.See also: [class`ViewSwitcher`], [class`ViewSwitcherBar`], [class`InlineViewSwitcher`].
New in version 1.9.
- classmethod new()¶
- Returns:
the newly created
AdwViewSwitcherSidebar- Return type:
Creates a new
AdwViewSwitcherSidebar.New in version 1.9.
- get_filter()¶
- Returns:
the item filter
- Return type:
Gtk.FilterorNone
Gets the item filter for self.
New in version 1.9.
- get_mode()¶
- Returns:
the current mode
- Return type:
Gets self's look and behavior.
See [method`Sidebar`.get_mode].
New in version 1.9.
- get_placeholder()¶
- Returns:
the placeholder widget
- Return type:
Gtk.WidgetorNone
Gets the placeholder widget for self.
New in version 1.9.
- get_stack()¶
- Returns:
The stack of self
- Return type:
Gets the stack self controls.
New in version 1.9.
- set_filter(filter)¶
- Parameters:
filter (
Gtk.FilterorNone) – the item filter
Sets the item filter for self.
Can be used to implement search within the sidebar.
Use [property`ViewSwitcherSidebar`:py:data::placeholder<Adw.ViewSwitcherSidebar.props.placeholder>] to provide an empty state.
See [method`Sidebar`.set_filter].
New in version 1.9.
- set_mode(mode)¶
- Parameters:
mode (
Adw.SidebarMode) – the new mode
Sets self's look and behavior.
If set to [enum`Adw`.SidebarMode.sidebar], behaves like a sidebar: with a sidebar style and a persistent selection.
If set to [enum`Adw`.SidebarMode.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 [class`NavigationSplitView`] when collapsed, as the sidebar pane becomes a page there.
When used with [class`OverlaySplitView`], the sidebar should stay in sidebar mode, as the sidebar pane is still a sidebar when collapsed.
See [method`Sidebar`.set_mode].
New in version 1.9.
- set_placeholder(placeholder)¶
- Parameters:
placeholder (
Gtk.WidgetorNone) – the placeholder widget
Sets the placeholder widget for self.
This widget will be shown if self has no items, or all of its items have been filtered out by [property`ViewSwitcherSidebar`:py:data::filter<Adw.ViewSwitcherSidebar.props.filter>].
See [method`Sidebar`.set_placeholder].
New in version 1.9.
- set_stack(stack)¶
- Parameters:
stack (
Adw.ViewStackorNone) – a stack
Sets the stack to control.
New in version 1.9.
Signal Details¶
- Adw.ViewSwitcherSidebar.signals.activated(view_switcher_sidebar)¶
- Signal Name:
activated- Flags:
- Parameters:
view_switcher_sidebar (
Adw.ViewSwitcherSidebar) – The object which received the signal
Emitted when an item has been activated.
New in version 1.9.
Property Details¶
- Adw.ViewSwitcherSidebar.props.filter¶
- Name:
filter- Type:
- Default Value:
- Flags:
The item filter.
Can be used to implement search within the sidebar.
Use [property`ViewSwitcherSidebar`:py:data::placeholder<Adw.ViewSwitcherSidebar.props.placeholder>] to provide an empty state.
See [property`Sidebar`:py:data::filter<Adw.ViewSwitcherSidebar.props.filter>].
New in version 1.9.
- Adw.ViewSwitcherSidebar.props.mode¶
- Name:
mode- Type:
- Default Value:
- Flags:
Determines the sidebar’s look and behavior.
If set to [enum`Adw`.SidebarMode.sidebar], behaves like a sidebar: with a sidebar style and a persistent selection.
If set to [enum`Adw`.SidebarMode.page], behaves like a page of boxed lists.
The page mode is intended to be used with [class`NavigationSplitView`] when collapsed, as the sidebar pane becomes a page there.
When used with [class`OverlaySplitView`], the sidebar should stay in sidebar mode, as the sidebar pane is still a sidebar when collapsed.
See [property`Sidebar`:py:data::mode<Adw.ViewSwitcherSidebar.props.mode>].
New in version 1.9.
- Adw.ViewSwitcherSidebar.props.placeholder¶
- Name:
placeholder- Type:
- Default Value:
- Flags:
The placeholder widget.
This widget will be shown if the sidebar has no items, or all of its items have been filtered out by [property`ViewSwitcherSidebar`:py:data::filter<Adw.ViewSwitcherSidebar.props.filter>].
See [property`Sidebar`:py:data::placeholder<Adw.ViewSwitcherSidebar.props.placeholder>].
New in version 1.9.
- Adw.ViewSwitcherSidebar.props.stack¶
- Name:
stack- Type:
- Default Value:
- Flags:
The stack the sidebar controls.
New in version 1.9.