:right-sidebar: True Flap =================================================================== .. currentmodule:: gi.repository.Adw .. deprecated:: 1.4 See `the migration guide `__ .. class:: Flap(**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` An adaptive container acting like a box or an overlay. .. image:: https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1-latest/flap-narrow.png The ``AdwFlap`` widget can display its children like a :obj:`~gi.repository.Gtk.Box` does or like a :obj:`~gi.repository.Gtk.Overlay` does, according to the :obj:`~gi.repository.Adw.Flap.props.fold_policy` value. ``AdwFlap`` has at most three children: :obj:`~gi.repository.Adw.Flap.props.content`\, :obj:`~gi.repository.Adw.Flap.props.flap` and :obj:`~gi.repository.Adw.Flap.props.separator`\. Content is the primary child, flap is displayed next to it when unfolded, or overlays it when folded. Flap can be shown or hidden by changing the :obj:`~gi.repository.Adw.Flap.props.reveal_flap` value, as well as via swipe gestures if :obj:`~gi.repository.Adw.Flap.props.swipe_to_open` and/or :obj:`~gi.repository.Adw.Flap.props.swipe_to_close` are set to ``TRUE``\. Optionally, a separator can be provided, which would be displayed between the content and the flap when there's no shadow to separate them, depending on the transition type. :obj:`~gi.repository.Adw.Flap.props.flap` is transparent by default; add the ```.background`` `__ style class to it if this is unwanted. If :obj:`~gi.repository.Adw.Flap.props.modal` is set to ``TRUE``\, content becomes completely inaccessible when the flap is revealed while folded. The position of the flap and separator children relative to the content is determined by orientation, as well as the :obj:`~gi.repository.Adw.Flap.props.flap_position` value. Folding the flap will automatically hide the flap widget, and unfolding it will automatically reveal it. If this behavior is not desired, the :obj:`~gi.repository.Adw.Flap.props.locked` property can be used to override it. Common use cases include sidebars, header bars that need to be able to overlap the window content (for example, in fullscreen mode) and bottom sheets. AdwFlap as GtkBuildable -------------------------------------------------------------------------------- The ``AdwFlap`` implementation of the :obj:`~gi.repository.Gtk.Buildable` interface supports setting the flap child by specifying “flap” as the “type” attribute of a ```` element, and separator by specifying “separator”. Specifying “content” child type or omitting it results in setting the content child. CSS nodes -------------------------------------------------------------------------------- ``AdwFlap`` has a single CSS node with name ``flap``\. The node will get the style classes ``.folded`` when it is folded, and ``.unfolded`` when it's not. Constructors ------------ .. rst-class:: interim-class .. class:: Flap :no-index: .. classmethod:: new() -> ~gi.repository.Gtk.Widget Creates a new ``AdwFlap``\. .. deprecated:: 1.4 See `the migration guide `__ Methods ------- .. rst-class:: interim-class .. class:: Flap :no-index: .. method:: get_content() -> ~gi.repository.Gtk.Widget | None Gets the content widget for ``self``\. .. deprecated:: 1.4 See `the migration guide `__ .. method:: get_flap() -> ~gi.repository.Gtk.Widget | None Gets the flap widget for ``self``\. .. deprecated:: 1.4 See `the migration guide `__ .. method:: get_flap_position() -> ~gi.repository.Gtk.PackType Gets the flap position for ``self``\. .. deprecated:: 1.4 See `the migration guide `__ .. method:: get_fold_duration() -> int Gets the fold transition animation duration for ``self``\, in milliseconds. .. deprecated:: 1.4 See `the migration guide `__ .. method:: get_fold_policy() -> ~gi.repository.Adw.FlapFoldPolicy Gets the fold policy 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 currently folded. See :obj:`~gi.repository.Adw.Flap.props.fold_policy`\. .. deprecated:: 1.4 See `the migration guide `__ .. method:: get_locked() -> bool Gets whether ``self`` is locked. .. deprecated:: 1.4 See `the migration guide `__ .. method:: get_modal() -> bool Gets whether ``self`` is modal. .. deprecated:: 1.4 See `the migration guide `__ .. method:: get_reveal_flap() -> bool Gets whether the flap widget is revealed for ``self``\. .. deprecated:: 1.4 See `the migration guide `__ .. method:: get_reveal_params() -> ~gi.repository.Adw.SpringParams Gets the reveal animation spring parameters for ``self``\. .. deprecated:: 1.4 See `the migration guide `__ .. method:: get_reveal_progress() -> float Gets the current reveal progress for ``self``\. 0 means fully hidden, 1 means fully revealed. See :obj:`~gi.repository.Adw.Flap.props.reveal_flap`\. .. deprecated:: 1.4 See `the migration guide `__ .. method:: get_separator() -> ~gi.repository.Gtk.Widget | None Gets the separator widget for ``self``\. .. deprecated:: 1.4 See `the migration guide `__ .. method:: get_swipe_to_close() -> bool Gets whether ``self`` can be closed with a swipe gesture. .. deprecated:: 1.4 See `the migration guide `__ .. method:: get_swipe_to_open() -> bool Gets whether ``self`` can be opened with a swipe gesture. .. deprecated:: 1.4 See `the migration guide `__ .. method:: get_transition_type() -> ~gi.repository.Adw.FlapTransitionType Gets the type of animation used for reveal and fold transitions in ``self``\. .. deprecated:: 1.4 See `the migration guide `__ .. method:: set_content(content: ~gi.repository.Gtk.Widget | None = None) -> None Sets the content widget for ``self``\. It's always displayed when unfolded, and partially visible when folded. .. deprecated:: 1.4 See `the migration guide `__ :param content: the content widget .. method:: set_flap(flap: ~gi.repository.Gtk.Widget | None = None) -> None Sets the flap widget for ``self``\. It's only visible when :obj:`~gi.repository.Adw.Flap.props.reveal_progress` is greater than 0. .. deprecated:: 1.4 See `the migration guide `__ :param flap: the flap widget .. method:: set_flap_position(position: ~gi.repository.Gtk.PackType) -> None Sets the flap position for ``self``\. If it's set to ``GTK_PACK_START``\, the flap is displayed before the content, if ``GTK_PACK_END``\, it's displayed after the content. .. deprecated:: 1.4 See `the migration guide `__ :param position: the new value .. method:: set_fold_duration(duration: int) -> None Sets the fold transition animation duration for ``self``\, in milliseconds. .. deprecated:: 1.4 See `the migration guide `__ :param duration: the new duration, in milliseconds .. method:: set_fold_policy(policy: ~gi.repository.Adw.FlapFoldPolicy) -> None Sets the fold policy for ``self``\. .. deprecated:: 1.4 See `the migration guide `__ :param policy: the fold policy .. 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``\, flap 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_locked(locked: bool) -> None Sets whether ``self`` is locked. If ``FALSE``\, folding when the flap is revealed automatically closes it, and unfolding it when the flap is not revealed opens it. If ``TRUE``\, :obj:`~gi.repository.Adw.Flap.props.reveal_flap` value never changes on its own. .. deprecated:: 1.4 See `the migration guide `__ :param locked: the new value .. method:: set_modal(modal: bool) -> None Sets whether ``self`` is modal. If ``TRUE``\, clicking the content widget while flap is revealed, as well as pressing the :kbd:`Esc` key, will close the flap. If ``FALSE``\, clicks are passed through to the content widget. .. deprecated:: 1.4 See `the migration guide `__ :param modal: whether ``self`` is modal .. method:: set_reveal_flap(reveal_flap: bool) -> None Sets whether the flap widget is revealed for ``self``\. .. deprecated:: 1.4 See `the migration guide `__ :param reveal_flap: whether to reveal the flap widget .. method:: set_reveal_params(params: ~gi.repository.Adw.SpringParams) -> None Sets the reveal animation 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_separator(separator: ~gi.repository.Gtk.Widget | None = None) -> None Sets the separator widget for ``self``\. It's displayed between content and flap when there's no shadow to display. When exactly it's visible depends on the :obj:`~gi.repository.Adw.Flap.props.transition_type` value. .. deprecated:: 1.4 See `the migration guide `__ :param separator: the separator widget .. method:: set_swipe_to_close(swipe_to_close: bool) -> None Sets whether ``self`` can be closed with a swipe gesture. The area that can be swiped depends on the :obj:`~gi.repository.Adw.Flap.props.transition_type` value. .. deprecated:: 1.4 See `the migration guide `__ :param swipe_to_close: whether ``self`` can be closed with a swipe gesture .. method:: set_swipe_to_open(swipe_to_open: bool) -> None Sets whether ``self`` can be opened with a swipe gesture. The area that can be swiped depends on the :obj:`~gi.repository.Adw.Flap.props.transition_type` value. .. deprecated:: 1.4 See `the migration guide `__ :param swipe_to_open: whether ``self`` can be opened with a swipe gesture .. method:: set_transition_type(transition_type: ~gi.repository.Adw.FlapTransitionType) -> None Sets the type of animation used for reveal and fold transitions in ``self``\. :obj:`~gi.repository.Adw.Flap.props.flap` is transparent by default, which means the content will be seen through it with ``ADW_FLAP_TRANSITION_TYPE_OVER`` transitions; add the ```.background`` `__ style class to it if this is unwanted. .. deprecated:: 1.4 See `the migration guide `__ :param transition_type: the new transition type Properties ---------- .. rst-class:: interim-class .. class:: Flap :no-index: .. attribute:: props.content :type: ~gi.repository.Gtk.Widget The type of the None singleton. .. deprecated:: 1.4 See `the migration guide `__ .. attribute:: props.flap :type: ~gi.repository.Gtk.Widget The type of the None singleton. .. deprecated:: 1.4 See `the migration guide `__ .. attribute:: props.flap_position :type: ~gi.repository.Gtk.PackType The type of the None singleton. .. deprecated:: 1.4 See `the migration guide `__ .. attribute:: props.fold_duration :type: int The type of the None singleton. .. deprecated:: 1.4 See `the migration guide `__ .. attribute:: props.fold_policy :type: ~gi.repository.Adw.FlapFoldPolicy The type of the None singleton. .. deprecated:: 1.4 See `the migration guide `__ .. attribute:: props.fold_threshold_policy :type: ~gi.repository.Adw.FoldThresholdPolicy The type of the None singleton. .. deprecated:: 1.4 See `the migration guide `__ .. attribute:: props.folded :type: bool The type of the None singleton. .. deprecated:: 1.4 See `the migration guide `__ .. attribute:: props.locked :type: bool The type of the None singleton. .. deprecated:: 1.4 See `the migration guide `__ .. attribute:: props.modal :type: bool The type of the None singleton. .. deprecated:: 1.4 See `the migration guide `__ .. attribute:: props.reveal_flap :type: bool The type of the None singleton. .. deprecated:: 1.4 See `the migration guide `__ .. attribute:: props.reveal_params :type: ~gi.repository.Adw.SpringParams The type of the None singleton. .. deprecated:: 1.4 See `the migration guide `__ .. attribute:: props.reveal_progress :type: float The type of the None singleton. .. deprecated:: 1.4 See `the migration guide `__ .. attribute:: props.separator :type: ~gi.repository.Gtk.Widget The type of the None singleton. .. deprecated:: 1.4 See `the migration guide `__ .. attribute:: props.swipe_to_close :type: bool The type of the None singleton. .. deprecated:: 1.4 See `the migration guide `__ .. attribute:: props.swipe_to_open :type: bool The type of the None singleton. .. deprecated:: 1.4 See `the migration guide `__ .. attribute:: props.transition_type :type: ~gi.repository.Adw.FlapTransitionType The type of the None singleton. .. deprecated:: 1.4 See `the migration guide `__