Handy.Flap¶
- Subclasses:
None
Methods¶
- Inherited:
Gtk.Container (35), Gtk.Widget (278), GObject.Object (37), Gtk.Buildable (10), Gtk.Orientable (2), Handy.Swipeable (8)
- Structs:
Gtk.ContainerClass (5), Gtk.WidgetClass (12), GObject.ObjectClass (5)
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/en |
The content Widget |
||
r/w/en |
The flap widget |
||
r/w/en |
The flap position |
||
r/w/en |
The fold transition animation duration, in milliseconds |
||
r/w/en |
The current fold policy |
||
r |
Whether the flap is currently folded |
||
r/w/en |
Whether the flap is locked |
||
r/w/en |
Whether the flap is modal |
||
r/w/en |
The reveal transition animation duration, in milliseconds |
||
r/w/en |
Whether the flap is revealed |
||
r |
The current reveal transition progress |
||
r/w/en |
The separator widget |
||
r/w/en |
Whether the flap can be closed with a swipe gesture |
||
r/w/en |
Whether the flap can be opened with a swipe gesture |
||
r/w/en |
The type of animation used for reveal and fold transitions |
Style Properties¶
- Inherited:
Signals¶
Fields¶
Class Details¶
- class Handy.Flap(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
An adaptive container acting like a box or an overlay.
The
HdyFlap
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<Handy.Flap.props.fold_policy>] value.HdyFlap
has at most three children: [property`Flap`:py:data::content<Handy.Flap.props.content>], [property`Flap`:py:data::flap<Handy.Flap.props.flap>] and [property`Flap`:py:data::separator<Handy.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<Handy.Flap.props.reveal_flap>] value, as well as via swipe gestures if [property`Flap`:py:data::swipe-to-open<Handy.Flap.props.swipe_to_open>] and/or [property`Flap`:py:data::swipe-to-close<Handy.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<Handy.Flap.props.flap>] is transparent by default; add the
.background
style class to it if this is unwanted.If [property`Flap`:py:data::modal<Handy.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<Handy.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<Handy.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
HdyFlap
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
HdyFlap
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.New in version 1.2.
- classmethod new()¶
- Returns:
the newly created
HdyFlap
- Return type:
Creates a new
HdyFlap
.New in version 1.2.
- get_content()¶
- Returns:
the content widget for self
- Return type:
Gtk.Widget
orNone
Gets the content widget for self
New in version 1.2.
- get_flap()¶
- Returns:
the flap widget for self
- Return type:
Gtk.Widget
orNone
Gets the flap widget for self
New in version 1.2.
- get_flap_position()¶
- Returns:
the flap position for self
- Return type:
Gets the flap position for self.
New in version 1.2.
- get_fold_duration()¶
- Returns:
the fold transition duration, in milliseconds
- Return type:
Gets the amount of time that fold transitions will take.
New in version 1.2.
- get_fold_policy()¶
- Returns:
the current fold policy of self
- Return type:
Gets the current fold policy of self.
New in version 1.2.
- get_folded()¶
- Returns:
TRUE
if self is currently folded- Return type:
Gets whether self is currently folded.
New in version 1.2.
- get_locked()¶
- Returns:
whether self is locked
- Return type:
Gets whether self is locked.
New in version 1.2.
- get_modal()¶
- Returns:
whether self is modal
- Return type:
Gets whether the self is modal.
New in version 1.2.
- get_reveal_duration()¶
- Returns:
the reveal transition duration, in milliseconds
- Return type:
Gets the amount of time that reveal transitions will take.
New in version 1.2.
- get_reveal_flap()¶
- Returns:
whether flap widget is revealed
- Return type:
Gets whether the flap widget is revealed for self.
New in version 1.2.
- get_reveal_progress()¶
- Returns:
the current reveal progress for self
- Return type:
Gets the current reveal transition progress for self.
New in version 1.2.
- get_separator()¶
- Returns:
the separator widget for self
- Return type:
Gtk.Widget
orNone
Gets the separator widget for self.
New in version 1.2.
- 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.
New in version 1.2.
- 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.
New in version 1.2.
- 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.
New in version 1.2.
- set_content(content)¶
- Parameters:
content (
Gtk.Widget
orNone
) – the content widget
Sets the content widget for self.
It is always displayed when unfolded, and partially visible when folded.
New in version 1.2.
- set_flap(flap)¶
- Parameters:
flap (
Gtk.Widget
orNone
) – the flap widget
Sets the flap widget for self.
New in version 1.2.
- set_flap_position(position)¶
- Parameters:
position (
Gtk.PackType
) – the new value
Sets the flap position for self.
New in version 1.2.
- set_fold_duration(duration)¶
- Parameters:
duration (
int
) – the new duration, in milliseconds
Sets the duration that fold transitions will take.
New in version 1.2.
- set_fold_policy(policy)¶
- Parameters:
policy (
Handy.FlapFoldPolicy
) – a fold policy
Sets the current fold policy for self.
New in version 1.2.
- set_locked(locked)¶
- Parameters:
locked (
bool
) – the new value
Sets whether self is locked.
If
FALSE
, folding self 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<Handy.Flap.props.reveal_flap>] value never changes on its own.New in version 1.2.
- set_modal(modal)¶
- Parameters:
modal (
bool
) – whether self can be closed with a click
Sets whether the self can be closed with a click.
If modal is
TRUE
, clicking the content widget while flap is revealed, or pressing the <kbd>Esc</kbd> key, will close the flap. IfFALSE
, clicks are passed through to the content widget.New in version 1.2.
- set_reveal_duration(duration)¶
- Parameters:
duration (
int
) – the new duration, in milliseconds
Sets the duration that reveal transitions in self will take.
New in version 1.2.
- set_reveal_flap(reveal_flap)¶
- Parameters:
reveal_flap (
bool
) –TRUE
to reveal the flap widget,FALSE
otherwise
Sets whether the flap widget is revealed for self.
New in version 1.2.
- set_separator(separator)¶
- Parameters:
separator (
Gtk.Widget
orNone
) – the separator widget
Sets the separator widget for self.
New in version 1.2.
- 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<Handy.Flap.props.transition_type>] value.
New in version 1.2.
- 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<Handy.Flap.props.transition_type>] value.
New in version 1.2.
- set_transition_type(transition_type)¶
- Parameters:
transition_type (
Handy.FlapTransitionType
) – the new transition type
Sets the type of animation used for reveal and fold transitions in self.
New in version 1.2.
Property Details¶
- Handy.Flap.props.content¶
- Name:
content
- Type:
- Default Value:
- Flags:
The content widget.
It’s always displayed when unfolded, and partially visible when folded.
New in version 1.2.
- Handy.Flap.props.flap¶
- Name:
flap
- Type:
- Default Value:
- Flags:
The flap widget.
It’s only visible when [property`Flap`:py:data::reveal-progress<Handy.Flap.props.reveal_progress>] is greater than 0.
New in version 1.2.
- Handy.Flap.props.flap_position¶
- Name:
flap-position
- Type:
- Default Value:
- Flags:
The flap position.
If
GTK_PACK_START
, the flap is displayed before the content, ifGTK_PACK_END
, it’s displayed after the content.New in version 1.2.
- Handy.Flap.props.fold_duration¶
- Name:
fold-duration
- Type:
- Default Value:
250
- Flags:
The fold transition animation duration, in milliseconds.
New in version 1.2.
- Handy.Flap.props.fold_policy¶
- Name:
fold-policy
- Type:
- Default Value:
- Flags:
The current fold policy.
See [enum`FlapFoldPolicy`] for available policies.
New in version 1.2.
- Handy.Flap.props.folded¶
-
Whether the flap is currently folded.
See [property`Flap`:py:data::fold-policy<Handy.Flap.props.fold_policy>].
New in version 1.2.
- Handy.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<Handy.Flap.props.reveal_flap>] value never changes on its own.New in version 1.2.
- Handy.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.New in version 1.2.
- Handy.Flap.props.reveal_duration¶
- Name:
reveal-duration
- Type:
- Default Value:
250
- Flags:
The reveal transition animation duration, in milliseconds.
New in version 1.2.
- Handy.Flap.props.reveal_flap¶
- Name:
reveal-flap
- Type:
- Default Value:
- Flags:
Whether the flap widget is revealed.
New in version 1.2.
- Handy.Flap.props.reveal_progress¶
-
The current reveal transition progress.
0 means fully hidden, 1 means fully revealed. See [property`Flap`:py:data::reveal-flap<Handy.Flap.props.reveal_flap>].
New in version 1.2.
- Handy.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<Handy.Flap.props.transition_type>] value. If
NULL
, no separator will be used.New in version 1.2.
- Handy.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<Handy.Flap.props.transition_type>] value.
New in version 1.2.
- Handy.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<Handy.Flap.props.transition_type>] value.
New in version 1.2.
- Handy.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<Handy.Flap.props.flap>] is transparent by default, which means the content will be seen through it with
HDY_FLAP_TRANSITION_TYPE_OVER
transitions; add the.background
style class to it if this is unwanted.New in version 1.2.