:right-sidebar: True Leaflet =================================================================== .. currentmodule:: gi.repository.Adw .. deprecated:: 1.4 See `the migration guide `_ .. class:: Leaflet(**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.Adw.Swipeable`, :class:`~gi.repository.Gtk.Accessible`, :class:`~gi.repository.Gtk.Buildable`, :class:`~gi.repository.Gtk.ConstraintTarget`, :class:`~gi.repository.Gtk.Orientable` :Constructors: :: Leaflet(**properties) new() -> Gtk.Widget Constructors ------------ .. rst-class:: interim-class .. class:: Leaflet :no-index: .. classmethod:: new() -> ~gi.repository.Gtk.Widget Creates a new ``AdwLeaflet``. .. deprecated:: 1.4 See `the migration guide `_ Methods ------- .. rst-class:: interim-class .. class:: Leaflet :no-index: .. method:: append(child: ~gi.repository.Gtk.Widget) -> ~gi.repository.Adw.LeafletPage Adds a child to ``self``. .. deprecated:: 1.4 See `the migration guide `_ :param child: the widget to add .. method:: get_adjacent_child(direction: ~gi.repository.Adw.NavigationDirection) -> ~gi.repository.Gtk.Widget | None Finds the previous or next navigatable child. This will be the same child :obj:`~gi.repository.Leaflet.navigate` or swipe gestures will navigate to. If there's no child to navigate to, ``NULL`` will be returned instead. See :obj:`~gi.repository.Adw.LeafletPage.props.navigatable`. .. deprecated:: 1.4 See `the migration guide `_ :param direction: the direction .. method:: get_can_navigate_back() -> bool Gets whether gestures and shortcuts for navigating backward are enabled. .. deprecated:: 1.4 See `the migration guide `_ .. method:: get_can_navigate_forward() -> bool Gets whether gestures and shortcuts for navigating forward are enabled. .. deprecated:: 1.4 See `the migration guide `_ .. method:: get_can_unfold() -> bool Gets whether ``self`` can unfold. .. deprecated:: 1.4 See `the migration guide `_ .. method:: get_child_by_name(name: str) -> ~gi.repository.Gtk.Widget | None Finds the child of ``self`` with ``name``. Returns ``NULL`` if there is no child with this name. See :obj:`~gi.repository.Adw.LeafletPage.props.name`. .. deprecated:: 1.4 See `the migration guide `_ :param name: the name of the child to find .. method:: get_child_transition_params() -> ~gi.repository.Adw.SpringParams Gets the child transition spring parameters for ``self``. .. deprecated:: 1.4 See `the migration guide `_ .. method:: get_child_transition_running() -> bool Gets whether a child transition is currently running for ``self``. .. deprecated:: 1.4 See `the migration guide `_ .. method:: get_fold_threshold_policy() -> ~gi.repository.Adw.FoldThresholdPolicy Gets the fold threshold policy for ``self``. .. deprecated:: 1.4 See `the migration guide `_ .. method:: get_folded() -> bool Gets whether ``self`` is folded. The leaflet will be folded if the size allocated to it is smaller than the sum of the minimum or natural sizes of the children (see :obj:`~gi.repository.Adw.Leaflet.props.fold_threshold_policy`), it will be unfolded otherwise. .. deprecated:: 1.4 See `the migration guide `_ .. method:: get_homogeneous() -> bool Gets whether ``self`` is homogeneous. .. deprecated:: 1.4 See `the migration guide `_ .. method:: get_mode_transition_duration() -> int Gets the mode transition animation duration for ``self``. .. deprecated:: 1.4 See `the migration guide `_ .. method:: get_page(child: ~gi.repository.Gtk.Widget) -> ~gi.repository.Adw.LeafletPage Returns the :obj:`~gi.repository.Adw.LeafletPage` object for ``child``. .. deprecated:: 1.4 See `the migration guide `_ :param child: a child of ``self`` .. method:: get_pages() -> ~gi.repository.Gtk.SelectionModel Returns a :obj:`~gi.repository.Gio.ListModel` that contains the pages of the leaflet. This can be used to keep an up-to-date view. The model also implements :obj:`~gi.repository.Gtk.SelectionModel` and can be used to track and change the visible page. .. deprecated:: 1.4 See `the migration guide `_ .. method:: get_transition_type() -> ~gi.repository.Adw.LeafletTransitionType Gets the type of animation used for transitions between modes and children. .. deprecated:: 1.4 See `the migration guide `_ .. method:: get_visible_child() -> ~gi.repository.Gtk.Widget | None Gets the widget currently visible when the leaflet is folded. .. deprecated:: 1.4 See `the migration guide `_ .. method:: get_visible_child_name() -> str | None Gets the name of the currently visible child widget. .. deprecated:: 1.4 See `the migration guide `_ .. method:: insert_child_after(child: ~gi.repository.Gtk.Widget, sibling: ~gi.repository.Gtk.Widget | None = None) -> ~gi.repository.Adw.LeafletPage Inserts ``child`` in the position after ``sibling`` in the list of children. If ``sibling`` is ``NULL``, inserts ``child`` at the first position. .. deprecated:: 1.4 See `the migration guide `_ :param child: the widget to insert :param sibling: the sibling after which to insert ``child`` .. method:: navigate(direction: ~gi.repository.Adw.NavigationDirection) -> bool Navigates to the previous or next child. The child must have the :obj:`~gi.repository.Adw.LeafletPage.props.navigatable` property set to ``TRUE``, otherwise it will be skipped. This will be the same child as returned by :obj:`~gi.repository.Leaflet.get_adjacent_child` or navigated to via swipe gestures. .. deprecated:: 1.4 See `the migration guide `_ :param direction: the direction .. method:: prepend(child: ~gi.repository.Gtk.Widget) -> ~gi.repository.Adw.LeafletPage Inserts ``child`` at the first position in ``self``. .. deprecated:: 1.4 See `the migration guide `_ :param child: the widget to prepend .. method:: remove(child: ~gi.repository.Gtk.Widget) -> None Removes a child widget from ``self``. .. deprecated:: 1.4 See `the migration guide `_ :param child: the child to remove .. method:: reorder_child_after(child: ~gi.repository.Gtk.Widget, sibling: ~gi.repository.Gtk.Widget | None = None) -> None Moves ``child`` to the position after ``sibling`` in the list of children. If ``sibling`` is ``NULL``, moves ``child`` to the first position. .. deprecated:: 1.4 See `the migration guide `_ :param child: the widget to move, must be a child of ``self`` :param sibling: the sibling to move ``child`` after .. method:: set_can_navigate_back(can_navigate_back: bool) -> None Sets whether gestures and shortcuts for navigating backward are enabled. The supported gestures are: - One-finger swipe on touchscreens - Horizontal scrolling on touchpads (usually two-finger swipe) - Back/forward mouse buttons The keyboard back/forward keys are also supported, as well as the :kbd:`Alt`+:kbd:`←` shortcut for horizontal orientation, or :kbd:`Alt`+:kbd:`↑` for vertical orientation. If the orientation is horizontal, for right-to-left locales, gestures and shortcuts are reversed. Only children that have :obj:`~gi.repository.Adw.LeafletPage.props.navigatable` set to ``TRUE`` can be navigated to. .. deprecated:: 1.4 See `the migration guide `_ :param can_navigate_back: the new value .. method:: set_can_navigate_forward(can_navigate_forward: bool) -> None Sets whether gestures and shortcuts for navigating forward are enabled. The supported gestures are: - One-finger swipe on touchscreens - Horizontal scrolling on touchpads (usually two-finger swipe) - Back/forward mouse buttons The keyboard back/forward keys are also supported, as well as the :kbd:`Alt`+:kbd:`→` shortcut for horizontal orientation, or :kbd:`Alt`+:kbd:`↓` for vertical orientation. If the orientation is horizontal, for right-to-left locales, gestures and shortcuts are reversed. Only children that have :obj:`~gi.repository.Adw.LeafletPage.props.navigatable` set to ``TRUE`` can be navigated to. .. deprecated:: 1.4 See `the migration guide `_ :param can_navigate_forward: the new value .. method:: set_can_unfold(can_unfold: bool) -> None Sets whether ``self`` can unfold. .. deprecated:: 1.4 See `the migration guide `_ :param can_unfold: whether ``self`` can unfold .. method:: set_child_transition_params(params: ~gi.repository.Adw.SpringParams) -> None Sets the child transition spring parameters for ``self``. The default value is equivalent to: .. code-block:: c :dedent: adw_spring_params_new (1, 0.5, 500) .. deprecated:: 1.4 See `the migration guide `_ :param params: the new parameters .. method:: set_fold_threshold_policy(policy: ~gi.repository.Adw.FoldThresholdPolicy) -> None Sets the fold threshold policy for ``self``. If set to ``ADW_FOLD_THRESHOLD_POLICY_MINIMUM``, it will only fold when the children cannot fit anymore. With ``ADW_FOLD_THRESHOLD_POLICY_NATURAL``, it will fold as soon as children don't get their natural size. This can be useful if you have a long ellipsizing label and want to let it ellipsize instead of immediately folding. .. deprecated:: 1.4 See `the migration guide `_ :param policy: the policy to use .. method:: set_homogeneous(homogeneous: bool) -> None Sets ``self`` to be homogeneous or not. If set to ``FALSE``, different children can have different size along the opposite orientation. .. deprecated:: 1.4 See `the migration guide `_ :param homogeneous: whether to make ``self`` homogeneous .. method:: set_mode_transition_duration(duration: int) -> None Sets the mode transition animation duration for ``self``. .. deprecated:: 1.4 See `the migration guide `_ :param duration: the new duration, in milliseconds .. method:: set_transition_type(transition: ~gi.repository.Adw.LeafletTransitionType) -> None Sets the type of animation used for transitions between modes and children. The transition type can be changed without problems at runtime, so it is possible to change the animation based on the mode or child that is about to become current. .. deprecated:: 1.4 See `the migration guide `_ :param transition: the new transition type .. method:: set_visible_child(visible_child: ~gi.repository.Gtk.Widget) -> None Sets the widget currently visible when the leaflet is folded. The transition is determined by :obj:`~gi.repository.Adw.Leaflet.props.transition_type` and :obj:`~gi.repository.Adw.Leaflet.props.child_transition_params`. The transition can be cancelled by the user, in which case visible child will change back to the previously visible child. .. deprecated:: 1.4 See `the migration guide `_ :param visible_child: the new child .. method:: set_visible_child_name(name: str) -> None Makes the child with the name ``name`` visible. See :obj:`~gi.repository.Adw.Leaflet.props.visible_child`. .. deprecated:: 1.4 See `the migration guide `_ :param name: the name of a child Properties ---------- .. rst-class:: interim-class .. class:: Leaflet :no-index: .. attribute:: props.can_navigate_back :type: bool Whether gestures and shortcuts for navigating backward are enabled. The supported gestures are: - One-finger swipe on touchscreens - Horizontal scrolling on touchpads (usually two-finger swipe) - Back/forward mouse buttons The keyboard back/forward keys are also supported, as well as the :kbd:`Alt`+:kbd:`←` shortcut for horizontal orientation, or :kbd:`Alt`+:kbd:`↑` for vertical orientation. If the orientation is horizontal, for right-to-left locales, gestures and shortcuts are reversed. Only children that have :obj:`~gi.repository.Adw.LeafletPage.props.navigatable` set to ``TRUE`` can be navigated to. .. deprecated:: 1.4 See `the migration guide `_ .. attribute:: props.can_navigate_forward :type: bool Whether gestures and shortcuts for navigating forward are enabled. The supported gestures are: - One-finger swipe on touchscreens - Horizontal scrolling on touchpads (usually two-finger swipe) - Back/forward mouse buttons The keyboard back/forward keys are also supported, as well as the :kbd:`Alt`+:kbd:`→` shortcut for horizontal orientation, or :kbd:`Alt`+:kbd:`↓` for vertical orientation. If the orientation is horizontal, for right-to-left locales, gestures and shortcuts are reversed. Only children that have :obj:`~gi.repository.Adw.LeafletPage.props.navigatable` set to ``TRUE`` can be navigated to. .. deprecated:: 1.4 See `the migration guide `_ .. attribute:: props.can_unfold :type: bool Whether or not the leaflet can unfold. .. deprecated:: 1.4 See `the migration guide `_ .. attribute:: props.child_transition_params :type: ~gi.repository.Adw.SpringParams The child transition spring parameters. The default value is equivalent to: .. code-block:: c :dedent: adw_spring_params_new (1, 0.5, 500) .. deprecated:: 1.4 See `the migration guide `_ .. attribute:: props.child_transition_running :type: bool Whether a child transition is currently running. .. deprecated:: 1.4 See `the migration guide `_ .. attribute:: props.fold_threshold_policy :type: ~gi.repository.Adw.FoldThresholdPolicy Determines when the leaflet will fold. If set to ``ADW_FOLD_THRESHOLD_POLICY_MINIMUM``, it will only fold when the children cannot fit anymore. With ``ADW_FOLD_THRESHOLD_POLICY_NATURAL``, it will fold as soon as children don't get their natural size. This can be useful if you have a long ellipsizing label and want to let it ellipsize instead of immediately folding. .. deprecated:: 1.4 See `the migration guide `_ .. attribute:: props.folded :type: bool Whether the leaflet is folded. The leaflet will be folded if the size allocated to it is smaller than the sum of the minimum or natural sizes of the children (see :obj:`~gi.repository.Adw.Leaflet.props.fold_threshold_policy`), it will be unfolded otherwise. .. deprecated:: 1.4 See `the migration guide `_ .. attribute:: props.homogeneous :type: bool Whether the leaflet allocates the same size for all children when folded. If set to ``FALSE``, different children can have different size along the opposite orientation. .. deprecated:: 1.4 See `the migration guide `_ .. attribute:: props.mode_transition_duration :type: int The mode transition animation duration, in milliseconds. .. deprecated:: 1.4 See `the migration guide `_ .. attribute:: props.pages :type: ~gi.repository.Gtk.SelectionModel A selection model with the leaflet's pages. This can be used to keep an up-to-date view. The model also implements :obj:`~gi.repository.Gtk.SelectionModel` and can be used to track and change the visible page. .. deprecated:: 1.4 See `the migration guide `_ .. attribute:: props.transition_type :type: ~gi.repository.Adw.LeafletTransitionType The type of animation used for transitions between modes and children. The transition type can be changed without problems at runtime, so it is possible to change the animation based on the mode or child that is about to become current. .. deprecated:: 1.4 See `the migration guide `_ .. attribute:: props.visible_child :type: ~gi.repository.Gtk.Widget The widget currently visible when the leaflet is folded. The transition is determined by :obj:`~gi.repository.Adw.Leaflet.props.transition_type` and :obj:`~gi.repository.Adw.Leaflet.props.child_transition_params`. The transition can be cancelled by the user, in which case visible child will change back to the previously visible child. .. deprecated:: 1.4 See `the migration guide `_ .. attribute:: props.visible_child_name :type: str The name of the widget currently visible when the leaflet is folded. See :obj:`~gi.repository.Adw.Leaflet.props.visible_child`. .. deprecated:: 1.4 See `the migration guide `_