:right-sidebar: True ViewSwitcherSidebar =================================================================== .. currentmodule:: gi.repository.Adw .. versionadded:: 1.9 .. class:: ViewSwitcherSidebar(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.Gtk.Widget`, :class:`~gi.repository.GObject.InitiallyUnowned`, :class:`~gi.repository.GObject.Object` Implemented Interfaces: :class:`~gi.repository.Gtk.Accessible`, :class:`~gi.repository.Gtk.Buildable`, :class:`~gi.repository.Gtk.ConstraintTarget` An adaptive sidebar that controls an :obj:`~gi.repository.Adw.ViewStack`\. .. image:: https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1-latest/view-switcher-sidebar.png ``AdwViewSwitcherSidebar`` is a view switcher implemented using a :obj:`~gi.repository.Adw.Sidebar`\, in a similar fashion to :obj:`~gi.repository.Gtk.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 :obj:`~gi.repository.Adw.ViewStackPage.props.starts_section` and :obj:`~gi.repository.Adw.ViewStackPage.props.section_title` properties. Like :obj:`~gi.repository.Adw.Sidebar`\, ``AdwViewSwitcherSidebar`` is adaptive and can behave as a sidebar or a page, via the :obj:`~gi.repository.Adw.ViewSwitcherSidebar.props.mode` property. .. image:: https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1-latest/view-switcher-sidebar-modes.png Connect to the :obj:`~gi.repository.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``\, ``AdwViewSwitcherSidebar`` supports filtering items via the :obj:`~gi.repository.Adw.ViewSwitcherSidebar.props.filter` property. Use :obj:`~gi.repository.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 -------------------------------------------------------------------------------- ``AdwViewSwitcherSidebar`` has a single CSS node with name ``view-switcher-sidebar``\. See also: :obj:`~gi.repository.Adw.ViewSwitcher`\, :obj:`~gi.repository.Adw.ViewSwitcherBar`\, :obj:`~gi.repository.Adw.InlineViewSwitcher`\. Constructors ------------ .. rst-class:: interim-class .. class:: ViewSwitcherSidebar :no-index: .. classmethod:: new() -> ~gi.repository.Gtk.Widget Creates a new ``AdwViewSwitcherSidebar``\. .. versionadded:: 1.9 Methods ------- .. rst-class:: interim-class .. class:: ViewSwitcherSidebar :no-index: .. method:: get_filter() -> ~gi.repository.Gtk.Filter | None Gets the item filter for ``self``\. .. versionadded:: 1.9 .. method:: get_mode() -> ~gi.repository.Adw.SidebarMode Gets ``self``\'s look and behavior. See :obj:`~gi.repository.Sidebar.get_mode`\. .. versionadded:: 1.9 .. method:: get_placeholder() -> ~gi.repository.Gtk.Widget | None Gets the placeholder widget for ``self``\. .. versionadded:: 1.9 .. method:: get_stack() -> ~gi.repository.Adw.ViewStack | None Gets the stack ``self`` controls. .. versionadded:: 1.9 .. method:: set_filter(filter: ~gi.repository.Gtk.Filter | None = None) -> None Sets the item filter for ``self``\. Can be used to implement search within the sidebar. Use :obj:`~gi.repository.Adw.ViewSwitcherSidebar.props.placeholder` to provide an empty state. See :obj:`~gi.repository.Sidebar.set_filter`\. .. versionadded:: 1.9 :param filter: the item filter .. method:: set_mode(mode: ~gi.repository.Adw.SidebarMode) -> None Sets ``self``\'s look and behavior. .. image:: https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1-latest/view-switcher-sidebar-modes.png If set to :obj:`~gi.repository.Adw.SidebarMode.sidebar`\, behaves like a sidebar: with a sidebar style and a persistent selection. If set to :obj:`~gi.repository.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 :obj:`~gi.repository.Adw.NavigationSplitView` when collapsed, as the sidebar pane becomes a page there. When used with :obj:`~gi.repository.Adw.OverlaySplitView`\, the sidebar should stay in sidebar mode, as the sidebar pane is still a sidebar when collapsed. See :obj:`~gi.repository.Sidebar.set_mode`\. .. versionadded:: 1.9 :param mode: the new mode .. method:: set_placeholder(placeholder: ~gi.repository.Gtk.Widget | None = None) -> None 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 :obj:`~gi.repository.Adw.ViewSwitcherSidebar.props.filter`\. See :obj:`~gi.repository.Sidebar.set_placeholder`\. .. versionadded:: 1.9 :param placeholder: the placeholder widget .. method:: set_stack(stack: ~gi.repository.Adw.ViewStack | None = None) -> None Sets the stack to control. .. versionadded:: 1.9 :param stack: a stack Properties ---------- .. rst-class:: interim-class .. class:: ViewSwitcherSidebar :no-index: .. attribute:: props.filter :type: ~gi.repository.Gtk.Filter The type of the None singleton. .. versionadded:: 1.9 .. attribute:: props.mode :type: ~gi.repository.Adw.SidebarMode The type of the None singleton. .. versionadded:: 1.9 .. attribute:: props.placeholder :type: ~gi.repository.Gtk.Widget The type of the None singleton. .. versionadded:: 1.9 .. attribute:: props.stack :type: ~gi.repository.Adw.ViewStack The type of the None singleton. .. versionadded:: 1.9 Signals ------- .. rst-class:: interim-class .. class:: ViewSwitcherSidebar.signals :no-index: .. method:: activated() -> None The type of the None singleton. .. versionadded:: 1.9