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:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
---|---|---|---|
d/r/w/en |
|
||
d/r/w/en |
|
||
d/r/w/en |
|
||
d/r/w/en |
|
||
d/r/w/en |
|
||
d/r/w/en |
|
||
d/r |
|
||
d/r/w/en |
|
||
d/r/w/en |
|
||
d/r/w/en |
|
||
d/r/w/en |
|
||
d/r |
|
||
d/r/w/en |
|
||
d/r/w/en |
|
||
d/r/w/en |
|
||
d/r/w/en |
|
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class Adw.Flap(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
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 toTRUE
.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.
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 nameflap
. 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:
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
orNone
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
orNone
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:
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:
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:
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:
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:
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:
Gets whether self is locked.
Deprecated since version 1.4: See the migration guide
- get_modal()¶
- Returns:
TRUE
if self is modal- Return type:
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:
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:
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:
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
orNone
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:
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:
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:
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
orNone
) – 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
orNone
) – 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, ifGTK_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. WithADW_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. IfTRUE
, [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. IfFALSE
, 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
orNone
) – 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:
- Default Value:
- Flags:
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:
- Default Value:
- Flags:
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:
- Default Value:
- Flags:
The flap position.
If it’s set to
GTK_PACK_START
, the flap is displayed before the content, ifGTK_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:
- Default Value:
250
- Flags:
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:
- Default Value:
- Flags:
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:
- Default Value:
- Flags:
Determines when the flap will fold.
If set to
ADW_FOLD_THRESHOLD_POLICY_MINIMUM
, flap will only fold when the children cannot fit anymore. WithADW_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:
- Default Value:
- Flags:
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:
- Default Value:
- Flags:
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. IfTRUE
, [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:
- Default Value:
- Flags:
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. IfFALSE
, 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:
- Default Value:
- Flags:
Whether the flap widget is revealed.
Deprecated since version 1.4: See the migration guide
- Adw.Flap.props.reveal_params¶
- Name:
reveal-params
- Type:
- Default Value:
- Flags:
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:
- Default Value:
1.0
- Flags:
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:
- Default Value:
- Flags:
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:
- Default Value:
- Flags:
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:
- Default Value:
- Flags:
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:
- Default Value:
- Flags:
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