Adw.Flap

g Adw.Flap Adw.Flap Adw.Swipeable Adw.Swipeable Adw.Swipeable->Adw.Flap GObject.GInterface GObject.GInterface GObject.GInterface->Adw.Swipeable Gtk.Accessible Gtk.Accessible GObject.GInterface->Gtk.Accessible Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable Gtk.ConstraintTarget Gtk.ConstraintTarget GObject.GInterface->Gtk.ConstraintTarget Gtk.Orientable Gtk.Orientable GObject.GInterface->Gtk.Orientable GObject.InitiallyUnowned GObject.InitiallyUnowned Gtk.Widget Gtk.Widget GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.Accessible->Gtk.Widget Gtk.Buildable->Gtk.Widget Gtk.ConstraintTarget->Gtk.Widget Gtk.Orientable->Adw.Flap Gtk.Widget->Adw.Flap

Subclasses:

None

Methods

Inherited:

Gtk.Widget (181), GObject.Object (37), Gtk.Accessible (15), Gtk.Buildable (1), Adw.Swipeable (5), Gtk.Orientable (2)

Structs:

Gtk.WidgetClass (18), GObject.ObjectClass (5)

class

new ()

get_content ()

get_flap ()

get_flap_position ()

get_fold_duration ()

get_fold_policy ()

get_fold_threshold_policy ()

get_folded ()

get_locked ()

get_modal ()

get_reveal_flap ()

get_reveal_params ()

get_reveal_progress ()

get_separator ()

get_swipe_to_close ()

get_swipe_to_open ()

get_transition_type ()

set_content (content)

set_flap (flap)

set_flap_position (position)

set_fold_duration (duration)

set_fold_policy (policy)

set_fold_threshold_policy (policy)

set_locked (locked)

set_modal (modal)

set_reveal_flap (reveal_flap)

set_reveal_params (params)

set_separator (separator)

set_swipe_to_close (swipe_to_close)

set_swipe_to_open (swipe_to_open)

set_transition_type (transition_type)

Virtual Methods

Inherited:

Gtk.Widget (25), GObject.Object (7), Gtk.Accessible (6), Gtk.Buildable (9), Adw.Swipeable (5)

Properties

Inherited:

Gtk.Widget (34), Gtk.Accessible (1), Gtk.Orientable (1)

Name

Type

Flags

Short Description

content

Gtk.Widget

d/r/w/en

deprecated

flap

Gtk.Widget

d/r/w/en

deprecated

flap-position

Gtk.PackType

d/r/w/en

deprecated

fold-duration

int

d/r/w/en

deprecated

fold-policy

Adw.FlapFoldPolicy

d/r/w/en

deprecated

fold-threshold-policy

Adw.FoldThresholdPolicy

d/r/w/en

deprecated

folded

bool

d/r

deprecated

locked

bool

d/r/w/en

deprecated

modal

bool

d/r/w/en

deprecated

reveal-flap

bool

d/r/w/en

deprecated

reveal-params

Adw.SpringParams

d/r/w/en

deprecated

reveal-progress

float

d/r

deprecated

separator

Gtk.Widget

d/r/w/en

deprecated

swipe-to-close

bool

d/r/w/en

deprecated

swipe-to-open

bool

d/r/w/en

deprecated

transition-type

Adw.FlapTransitionType

d/r/w/en

deprecated

Signals

Inherited:

Gtk.Widget (13), GObject.Object (1)

Fields

Inherited:

Gtk.Widget (13), GObject.Object (1)

Class Details

class Adw.Flap(**kwargs)
Bases:

Gtk.Widget, Adw.Swipeable, Gtk.Orientable

Abstract:

No

Structure:

Adw.FlapClass

An adaptive container acting like a box or an overlay.

<picture> <source srcset=”flap-wide-dark.png” media=”(prefers-color-scheme: dark)”> <img src=”flap-wide.png” alt=”flap-wide”> </picture> <picture> <source srcset=”flap-narrow-dark.png” media=”(prefers-color-scheme: dark)”> <img src=”flap-narrow.png” alt=”flap-narrow”> </picture>

The AdwFlap widget can display its children like a [class`Gtk`.Box] does or like a [class`Gtk`.Overlay] does, according to the [property`Flap`:py:data::fold-policy<Adw.Flap.props.fold_policy>] value.

AdwFlap has at most three children: [property`Flap`:py:data::content<Adw.Flap.props.content>], [property`Flap`:py:data::flap<Adw.Flap.props.flap>] and [property`Flap`:py:data::separator<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 [property`Flap`:py:data::reveal-flap<Adw.Flap.props.reveal_flap>] value, as well as via swipe gestures if [property`Flap`:py:data::swipe-to-open<Adw.Flap.props.swipe_to_open>] and/or [property`Flap`:py:data::swipe-to-close<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.

[property`Flap`:py:data::flap<Adw.Flap.props.flap>] is transparent by default; add the .background style class to it if this is unwanted.

If [property`Flap`:py:data::modal<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 [property`Flap`:py:data::flap-position<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 [property`Flap`:py:data::locked<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.

Adw.Flap as Gtk.Buildable

The AdwFlap implementation of the [iface`Gtk`.Buildable] interface supports setting the flap child by specifying “flap” as the “type” attribute of a <child> 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.

Deprecated since version 1.4: See the migration guide

classmethod new()
Returns:

the newly created AdwFlap

Return type:

Gtk.Widget

Creates a new AdwFlap.

Deprecated since version 1.4: See the migration guide

get_content()
Returns:

the content widget for self

Return type:

Gtk.Widget or None

Gets the content widget for self.

Deprecated since version 1.4: See the migration guide

get_flap()
Returns:

the flap widget for self

Return type:

Gtk.Widget or None

Gets the flap widget for self.

Deprecated since version 1.4: See the migration guide

get_flap_position()
Returns:

the flap position for self

Return type:

Gtk.PackType

Gets the flap position for self.

Deprecated since version 1.4: See the migration guide

get_fold_duration()
Returns:

the fold transition duration

Return type:

int

Gets the fold transition animation duration for self, in milliseconds.

Deprecated since version 1.4: See the migration guide

get_fold_policy()
Returns:

the fold policy for self

Return type:

Adw.FlapFoldPolicy

Gets the fold policy for self.

Deprecated since version 1.4: See the migration guide

get_fold_threshold_policy()
Returns:

the fold threshold policy

Return type:

Adw.FoldThresholdPolicy

Gets the fold threshold policy for self.

Deprecated since version 1.4: See the migration guide

get_folded()
Returns:

TRUE if self is currently folded

Return type:

bool

Gets whether self is currently folded.

See [property`Flap`:py:data::fold-policy<Adw.Flap.props.fold_policy>].

Deprecated since version 1.4: See the migration guide

get_locked()
Returns:

TRUE if self is locked

Return type:

bool

Gets whether self is locked.

Deprecated since version 1.4: See the migration guide

get_modal()
Returns:

TRUE if self is modal

Return type:

bool

Gets whether self is modal.

Deprecated since version 1.4: See the migration guide

get_reveal_flap()
Returns:

TRUE if the flap widget is revealed

Return type:

bool

Gets whether the flap widget is revealed for self.

Deprecated since version 1.4: See the migration guide

get_reveal_params()
Returns:

the reveal animation parameters

Return type:

Adw.SpringParams

Gets the reveal animation spring parameters for self.

Deprecated since version 1.4: See the migration guide

get_reveal_progress()
Returns:

the current reveal progress for self

Return type:

float

Gets the current reveal progress for self.

0 means fully hidden, 1 means fully revealed.

See [property`Flap`:py:data::reveal-flap<Adw.Flap.props.reveal_flap>].

Deprecated since version 1.4: See the migration guide

get_separator()
Returns:

the separator widget for self

Return type:

Gtk.Widget or None

Gets the separator widget for self.

Deprecated since version 1.4: See the migration guide

get_swipe_to_close()
Returns:

TRUE if self can be closed with a swipe gesture

Return type:

bool

Gets whether self can be closed with a swipe gesture.

Deprecated since version 1.4: See the migration guide

get_swipe_to_open()
Returns:

TRUE if self can be opened with a swipe gesture

Return type:

bool

Gets whether self can be opened with a swipe gesture.

Deprecated since version 1.4: See the migration guide

get_transition_type()
Returns:

the current transition type of self

Return type:

Adw.FlapTransitionType

Gets the type of animation used for reveal and fold transitions in self.

Deprecated since version 1.4: See the migration guide

set_content(content)
Parameters:

content (Gtk.Widget or None) – the content widget

Sets the content widget for self.

It’s always displayed when unfolded, and partially visible when folded.

Deprecated since version 1.4: See the migration guide

set_flap(flap)
Parameters:

flap (Gtk.Widget or None) – the flap widget

Sets the flap widget for self.

It’s only visible when [property`Flap`:py:data::reveal-progress<Adw.Flap.props.reveal_progress>] is greater than 0.

Deprecated since version 1.4: See the migration guide

set_flap_position(position)
Parameters:

position (Gtk.PackType) – the new value

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 since version 1.4: See the migration guide

set_fold_duration(duration)
Parameters:

duration (int) – the new duration, in milliseconds

Sets the fold transition animation duration for self, in milliseconds.

Deprecated since version 1.4: See the migration guide

set_fold_policy(policy)
Parameters:

policy (Adw.FlapFoldPolicy) – the fold policy

Sets the fold policy for self.

Deprecated since version 1.4: See the migration guide

set_fold_threshold_policy(policy)
Parameters:

policy (Adw.FoldThresholdPolicy) – the policy to use

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 since version 1.4: See the migration guide

set_locked(locked)
Parameters:

locked (bool) – the new value

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, [property`Flap`:py:data::reveal-flap<Adw.Flap.props.reveal_flap>] value never changes on its own.

Deprecated since version 1.4: See the migration guide

set_modal(modal)
Parameters:

modal (bool) – whether self is modal

Sets whether self is modal.

If TRUE, clicking the content widget while flap is revealed, as well as pressing the <kbd>Esc</kbd> key, will close the flap. If FALSE, clicks are passed through to the content widget.

Deprecated since version 1.4: See the migration guide

set_reveal_flap(reveal_flap)
Parameters:

reveal_flap (bool) – whether to reveal the flap widget

Sets whether the flap widget is revealed for self.

Deprecated since version 1.4: See the migration guide

set_reveal_params(params)
Parameters:

params (Adw.SpringParams) – the new parameters

Sets the reveal animation spring parameters for self.

The default value is equivalent to:

``c adw_spring_params_new (1, 0.5, 500) ``

Deprecated since version 1.4: See the migration guide

set_separator(separator)
Parameters:

separator (Gtk.Widget or None) – the separator widget

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 [property`Flap`:py:data::transition-type<Adw.Flap.props.transition_type>] value.

Deprecated since version 1.4: See the migration guide

set_swipe_to_close(swipe_to_close)
Parameters:

swipe_to_close (bool) – whether self can be closed with a swipe gesture

Sets whether self can be closed with a swipe gesture.

The area that can be swiped depends on the [property`Flap`:py:data::transition-type<Adw.Flap.props.transition_type>] value.

Deprecated since version 1.4: See the migration guide

set_swipe_to_open(swipe_to_open)
Parameters:

swipe_to_open (bool) – whether self can be opened with a swipe gesture

Sets whether self can be opened with a swipe gesture.

The area that can be swiped depends on the [property`Flap`:py:data::transition-type<Adw.Flap.props.transition_type>] value.

Deprecated since version 1.4: See the migration guide

set_transition_type(transition_type)
Parameters:

transition_type (Adw.FlapTransitionType) – the new transition type

Sets the type of animation used for reveal and fold transitions in self.

[property`Flap`:py:data::flap<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 since version 1.4: See the migration guide

Property Details

Adw.Flap.props.content
Name:

content

Type:

Gtk.Widget

Default Value:

None

Flags:

DEPRECATED, READABLE, WRITABLE, EXPLICIT_NOTIFY

The content widget.

It’s always displayed when unfolded, and partially visible when folded.

Deprecated since version 1.4: See the migration guide

Adw.Flap.props.flap
Name:

flap

Type:

Gtk.Widget

Default Value:

None

Flags:

DEPRECATED, READABLE, WRITABLE, EXPLICIT_NOTIFY

The flap widget.

It’s only visible when [property`Flap`:py:data::reveal-progress<Adw.Flap.props.reveal_progress>] is greater than 0.

Deprecated since version 1.4: See the migration guide

Adw.Flap.props.flap_position
Name:

flap-position

Type:

Gtk.PackType

Default Value:

Gtk.PackType.START

Flags:

DEPRECATED, READABLE, WRITABLE, EXPLICIT_NOTIFY

The flap position.

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 since version 1.4: See the migration guide

Adw.Flap.props.fold_duration
Name:

fold-duration

Type:

int

Default Value:

250

Flags:

DEPRECATED, READABLE, WRITABLE, EXPLICIT_NOTIFY

The fold transition animation duration, in milliseconds.

Deprecated since version 1.4: See the migration guide

Adw.Flap.props.fold_policy
Name:

fold-policy

Type:

Adw.FlapFoldPolicy

Default Value:

Adw.FlapFoldPolicy.AUTO

Flags:

DEPRECATED, READABLE, WRITABLE, EXPLICIT_NOTIFY

The fold policy for the flap.

Deprecated since version 1.4: See the migration guide

Adw.Flap.props.fold_threshold_policy
Name:

fold-threshold-policy

Type:

Adw.FoldThresholdPolicy

Default Value:

Adw.FoldThresholdPolicy.MINIMUM

Flags:

DEPRECATED, READABLE, WRITABLE, EXPLICIT_NOTIFY

Determines when the flap will fold.

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 since version 1.4: See the migration guide

Adw.Flap.props.folded
Name:

folded

Type:

bool

Default Value:

False

Flags:

DEPRECATED, READABLE

Whether the flap is currently folded.

See [property`Flap`:py:data::fold-policy<Adw.Flap.props.fold_policy>].

Deprecated since version 1.4: See the migration guide

Adw.Flap.props.locked
Name:

locked

Type:

bool

Default Value:

False

Flags:

DEPRECATED, READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the flap 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, [property`Flap`:py:data::reveal-flap<Adw.Flap.props.reveal_flap>] value never changes on its own.

Deprecated since version 1.4: See the migration guide

Adw.Flap.props.modal
Name:

modal

Type:

bool

Default Value:

True

Flags:

DEPRECATED, READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the flap is modal.

If TRUE, clicking the content widget while flap is revealed, as well as pressing the <kbd>Esc</kbd> key, will close the flap. If FALSE, clicks are passed through to the content widget.

Deprecated since version 1.4: See the migration guide

Adw.Flap.props.reveal_flap
Name:

reveal-flap

Type:

bool

Default Value:

True

Flags:

DEPRECATED, READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the flap widget is revealed.

Deprecated since version 1.4: See the migration guide

Adw.Flap.props.reveal_params
Name:

reveal-params

Type:

Adw.SpringParams

Default Value:

None

Flags:

DEPRECATED, READABLE, WRITABLE, EXPLICIT_NOTIFY

The reveal animation spring parameters.

The default value is equivalent to:

``c adw_spring_params_new (1, 0.5, 500) ``

Deprecated since version 1.4: See the migration guide

Adw.Flap.props.reveal_progress
Name:

reveal-progress

Type:

float

Default Value:

1.0

Flags:

DEPRECATED, READABLE

The current reveal transition progress.

0 means fully hidden, 1 means fully revealed.

See [property`Flap`:py:data::reveal-flap<Adw.Flap.props.reveal_flap>].

Deprecated since version 1.4: See the migration guide

Adw.Flap.props.separator
Name:

separator

Type:

Gtk.Widget

Default Value:

None

Flags:

DEPRECATED, READABLE, WRITABLE, EXPLICIT_NOTIFY

The separator widget.

It’s displayed between content and flap when there’s no shadow to display. When exactly it’s visible depends on the [property`Flap`:py:data::transition-type<Adw.Flap.props.transition_type>] value.

Deprecated since version 1.4: See the migration guide

Adw.Flap.props.swipe_to_close
Name:

swipe-to-close

Type:

bool

Default Value:

True

Flags:

DEPRECATED, READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the flap can be closed with a swipe gesture.

The area that can be swiped depends on the [property`Flap`:py:data::transition-type<Adw.Flap.props.transition_type>] value.

Deprecated since version 1.4: See the migration guide

Adw.Flap.props.swipe_to_open
Name:

swipe-to-open

Type:

bool

Default Value:

True

Flags:

DEPRECATED, READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the flap can be opened with a swipe gesture.

The area that can be swiped depends on the [property`Flap`:py:data::transition-type<Adw.Flap.props.transition_type>] value.

Deprecated since version 1.4: See the migration guide

Adw.Flap.props.transition_type
Name:

transition-type

Type:

Adw.FlapTransitionType

Default Value:

Adw.FlapTransitionType.OVER

Flags:

DEPRECATED, READABLE, WRITABLE, EXPLICIT_NOTIFY

the type of animation used for reveal and fold transitions.

[property`Flap`:py:data::flap<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 since version 1.4: See the migration guide