:right-sidebar: True SidebarItem =================================================================== .. currentmodule:: gi.repository.Adw .. versionadded:: 1.9 .. class:: SidebarItem(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.Object` An item within :obj:`~gi.repository.Adw.SidebarSection`\. Sidebar items must have a title, set via :obj:`~gi.repository.Adw.SidebarItem.props.title`\. Sidebar items should, but are not required to, have an icon. Icons can be set from an icon name, via :obj:`~gi.repository.Adw.SidebarItem.props.icon_name`\, or a :obj:`~gi.repository.Gdk.Paintable`\, via :obj:`~gi.repository.Adw.SidebarItem.props.icon_paintable`\. Items can also have subtitles, set with the :obj:`~gi.repository.Adw.SidebarItem.props.subtitle` property. Subtitles should be used sparingly. To add a tooltip, use :obj:`~gi.repository.Adw.SidebarItem.props.tooltip`\. Tooltips always use Pango markup. Items can have an arbitrary suffix widget, set with the :obj:`~gi.repository.Adw.SidebarItem.props.suffix` properties. It will be displayed at the end of its row, or before the arrow in the :obj:`~gi.repository.Adw.SidebarMode.page` mode. To hide or disable the item, use the :obj:`~gi.repository.Adw.SidebarItem.props.visible` and :obj:`~gi.repository.Adw.SidebarItem.props.enabled` properties respectively. To access the items's section, use :obj:`~gi.repository.Adw.SidebarItem.props.section`\. It's also possible to access the index of the item in both the section and the sidebar, using :obj:`~gi.repository.SidebarItem.get_section_index` and :obj:`~gi.repository.SidebarItem.get_index` respectively. Dragging content over sidebar items activates them by default. To disable this behavior, set :obj:`~gi.repository.Adw.SidebarItem.props.drag_motion_activate` to ``FALSE``\. ``AdwSidebarItem`` is derivable, and applications that need to associate each page with data can store it in the items themselves this way. Constructors ------------ .. rst-class:: interim-class .. class:: SidebarItem :no-index: .. classmethod:: new(title: str) -> ~gi.repository.Adw.SidebarItem Creates a new ``AdwSidebarItem`` with ``title`` as its title. .. versionadded:: 1.9 :param title: the item title Methods ------- .. rst-class:: interim-class .. class:: SidebarItem :no-index: .. method:: get_drag_motion_activate() -> bool Gets whether ``self`` will be activated on pointer motion during Drag-and-Drop. .. versionadded:: 1.9 .. method:: get_enabled() -> bool Gets whether ``self`` is enabled. .. versionadded:: 1.9 .. method:: get_icon_name() -> str | None Gets the icon name for ``item``\. .. versionadded:: 1.9 .. method:: get_icon_paintable() -> ~gi.repository.Gdk.Paintable | None Gets the paintable used as the icon for ``item``\. .. versionadded:: 1.9 .. method:: get_index() -> int Gets index of ``self`` within its :obj:`~gi.repository.Adw.Sidebar`\. If ``self`` is within a section, but that section is not in a sidebar, index will be within the section only. If ``self`` is not within a section, the index will be 0. The item can later be retrieved by passing this index into :obj:`~gi.repository.Sidebar.get_item`\. .. versionadded:: 1.9 .. method:: get_section() -> ~gi.repository.Adw.SidebarSection | None Gets the section ``self`` is in. .. versionadded:: 1.9 .. method:: get_section_index() -> int Gets index of ``self`` within its :obj:`~gi.repository.Adw.SidebarSection`\. If ``self`` is not within a section, the index will be 0. The item can later be retrieved by passing this index into :obj:`~gi.repository.SidebarSection.get_item`\. .. versionadded:: 1.9 .. method:: get_subtitle() -> str | None Gets the subtitle of ``self``\. .. versionadded:: 1.9 .. method:: get_suffix() -> ~gi.repository.Gtk.Widget | None Gets the suffix widget for ``self``\. .. versionadded:: 1.9 .. method:: get_title() -> str | None Gets the title of ``self``\. .. versionadded:: 1.9 .. method:: get_tooltip() -> str | None Gets the tooltip of ``self``\. .. versionadded:: 1.9 .. method:: get_use_underline() -> bool Gets whether an underline in the title indicates a mnemonic. .. versionadded:: 1.9 .. method:: get_visible() -> bool Gets whether ``self`` is visible. .. versionadded:: 1.9 .. method:: set_drag_motion_activate(drag_motion_activate: bool) -> None Sets whether to activate ``self`` on pointer motion during Drag-and-Drop. This is needed to be able to drag content into the page the item represents, when the sidebar is used as a page switcher. However, it may be unwanted when dropping content onto the item itself, so it can be disabled. .. versionadded:: 1.9 :param drag_motion_activate: whether to enable the item on drag motion .. method:: set_enabled(enabled: bool) -> None Sets whether ``self`` is enabled. See :obj:`~gi.repository.Gtk.Widget.props.sensitive`\. .. versionadded:: 1.9 :param enabled: whether to enable the item .. method:: set_icon_name(icon_name: str | None = None) -> None Sets the icon name for ``item``\. Mutually exclusive with :obj:`~gi.repository.Adw.SidebarItem.props.icon_paintable`\. .. versionadded:: 1.9 :param icon_name: the icon name .. method:: set_icon_paintable(paintable: ~gi.repository.Gdk.Paintable | None = None) -> None Sets the paintable to use as the icon for ``item``\. Mutually exclusive with :obj:`~gi.repository.Adw.SidebarItem.props.icon_name`\. .. versionadded:: 1.9 :param paintable: the icon paintable .. method:: set_subtitle(subtitle: str | None = None) -> None Sets the subtitle of ``self``\. .. versionadded:: 1.9 :param subtitle: the subtitle .. method:: set_suffix(suffix: ~gi.repository.Gtk.Widget | None = None) -> None Sets the suffix widget for ``self``\. Suffix will be shown at the end of the item's row, or before the arrow in the :obj:`~gi.repository.Adw.SidebarMode.page` mode. .. versionadded:: 1.9 :param suffix: the suffix widget .. method:: set_title(title: str | None = None) -> None Sets the title of ``self``\. .. versionadded:: 1.9 :param title: the title .. method:: set_tooltip(tooltip: str | None = None) -> None Sets the tooltip of ``self``\. The tooltip can be marked up with the Pango text markup language. .. versionadded:: 1.9 :param tooltip: the tooltip .. method:: set_use_underline(use_underline: bool) -> None Sets whether an underline in the title indicates a mnemonic. The mnemonic can be used to activate the item. .. versionadded:: 1.9 :param use_underline: whether an underline in the text indicates a mnemonic .. method:: set_visible(visible: bool) -> None Sets whether ``self`` is visible. .. versionadded:: 1.9 :param visible: whether the item is visible Properties ---------- .. rst-class:: interim-class .. class:: SidebarItem :no-index: .. attribute:: props.drag_motion_activate :type: bool The type of the None singleton. .. versionadded:: 1.9 .. attribute:: props.enabled :type: bool The type of the None singleton. .. versionadded:: 1.9 .. attribute:: props.icon_name :type: str The type of the None singleton. .. versionadded:: 1.9 .. attribute:: props.icon_paintable :type: ~gi.repository.Gdk.Paintable The type of the None singleton. .. versionadded:: 1.9 .. attribute:: props.section :type: ~gi.repository.Adw.SidebarSection The type of the None singleton. .. versionadded:: 1.9 .. attribute:: props.subtitle :type: str The type of the None singleton. .. versionadded:: 1.9 .. attribute:: props.suffix :type: ~gi.repository.Gtk.Widget The type of the None singleton. .. versionadded:: 1.9 .. attribute:: props.title :type: str The type of the None singleton. .. versionadded:: 1.9 .. attribute:: props.tooltip :type: str The type of the None singleton. .. versionadded:: 1.9 .. attribute:: props.use_underline :type: bool The type of the None singleton. .. versionadded:: 1.9 .. attribute:: props.visible :type: bool The type of the None singleton. .. versionadded:: 1.9 Fields ------ .. rst-class:: interim-class .. class:: SidebarItem :no-index: .. attribute:: parent_instance