Handy.Flap

g Atk.ImplementorIface Atk.ImplementorIface Gtk.Widget Gtk.Widget Atk.ImplementorIface->Gtk.Widget GObject.GInterface GObject.GInterface GObject.GInterface->Atk.ImplementorIface Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable Gtk.Orientable Gtk.Orientable GObject.GInterface->Gtk.Orientable Handy.Swipeable Handy.Swipeable GObject.GInterface->Handy.Swipeable GObject.InitiallyUnowned GObject.InitiallyUnowned GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.Buildable->Gtk.Widget Gtk.Container Gtk.Container Handy.Flap Handy.Flap Gtk.Container->Handy.Flap Gtk.Orientable->Handy.Flap Gtk.Widget->Gtk.Container Handy.Swipeable->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

new ()

get_content ()

get_flap ()

get_flap_position ()

get_fold_duration ()

get_fold_policy ()

get_folded ()

get_locked ()

get_modal ()

get_reveal_duration ()

get_reveal_flap ()

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_locked (locked)

set_modal (modal)

set_reveal_duration (duration)

set_reveal_flap (reveal_flap)

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.Container (10), Gtk.Widget (82), GObject.Object (7), Gtk.Buildable (10), Handy.Swipeable (7)

Properties

Inherited:

Gtk.Container (3), Gtk.Widget (39), Gtk.Orientable (1)

Name

Type

Flags

Short Description

content

Gtk.Widget

r/w/en

The content Widget

flap

Gtk.Widget

r/w/en

The flap widget

flap-position

Gtk.PackType

r/w/en

The flap position

fold-duration

int

r/w/en

The fold transition animation duration, in milliseconds

fold-policy

Handy.FlapFoldPolicy

r/w/en

The current fold policy

folded

bool

r

Whether the flap is currently folded

locked

bool

r/w/en

Whether the flap is locked

modal

bool

r/w/en

Whether the flap is modal

reveal-duration

int

r/w/en

The reveal transition animation duration, in milliseconds

reveal-flap

bool

r/w/en

Whether the flap is revealed

reveal-progress

float

r

The current reveal transition progress

separator

Gtk.Widget

r/w/en

The separator widget

swipe-to-close

bool

r/w/en

Whether the flap can be closed with a swipe gesture

swipe-to-open

bool

r/w/en

Whether the flap can be opened with a swipe gesture

transition-type

Handy.FlapTransitionType

r/w/en

The type of animation used for reveal and fold transitions

Style Properties

Inherited:

Gtk.Widget (17)

Signals

Inherited:

Gtk.Container (4), Gtk.Widget (69), GObject.Object (1), Handy.Swipeable (1)

Fields

Inherited:

Gtk.Container (4), Gtk.Widget (69), GObject.Object (1), Handy.Swipeable (1)

Class Details

class Handy.Flap(**kwargs)
Bases:

Gtk.Container, Gtk.Orientable, Handy.Swipeable

Abstract:

No

Structure:

Handy.FlapClass

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 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<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.

Handy.Flap as Gtk.Buildable

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 name flap. 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:

Gtk.Widget

Creates a new HdyFlap.

New in version 1.2.

get_content()
Returns:

the content widget for self

Return type:

Gtk.Widget or None

Gets the content widget for self

New in version 1.2.

get_flap()
Returns:

the flap widget for self

Return type:

Gtk.Widget or None

Gets the flap widget for self

New in version 1.2.

get_flap_position()
Returns:

the flap position for self

Return type:

Gtk.PackType

Gets the flap position for self.

New in version 1.2.

get_fold_duration()
Returns:

the fold transition duration, in milliseconds

Return type:

int

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:

Handy.FlapFoldPolicy

Gets the current fold policy of self.

New in version 1.2.

get_folded()
Returns:

TRUE if self is currently folded

Return type:

bool

Gets whether self is currently folded.

New in version 1.2.

get_locked()
Returns:

whether self is locked

Return type:

bool

Gets whether self is locked.

New in version 1.2.

get_modal()
Returns:

whether self is modal

Return type:

bool

Gets whether the self is modal.

New in version 1.2.

get_reveal_duration()
Returns:

the reveal transition duration, in milliseconds

Return type:

int

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:

bool

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:

float

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 or None

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:

bool

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:

bool

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:

Handy.FlapTransitionType

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 or None) – 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 or None) – 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. If TRUE, [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. If FALSE, 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 or None) – 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:

Gtk.Widget

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

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:

Gtk.Widget

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

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:

Gtk.PackType

Default Value:

Gtk.PackType.START

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The flap position.

If GTK_PACK_START, the flap is displayed before the content, if GTK_PACK_END, it’s displayed after the content.

New in version 1.2.

Handy.Flap.props.fold_duration
Name:

fold-duration

Type:

int

Default Value:

250

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The fold transition animation duration, in milliseconds.

New in version 1.2.

Handy.Flap.props.fold_policy
Name:

fold-policy

Type:

Handy.FlapFoldPolicy

Default Value:

Handy.FlapFoldPolicy.AUTO

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The current fold policy.

See [enum`FlapFoldPolicy`] for available policies.

New in version 1.2.

Handy.Flap.props.folded
Name:

folded

Type:

bool

Default Value:

False

Flags:

READABLE

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:

bool

Default Value:

False

Flags:

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<Handy.Flap.props.reveal_flap>] value never changes on its own.

New in version 1.2.

Handy.Flap.props.modal
Name:

modal

Type:

bool

Default Value:

True

Flags:

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.

New in version 1.2.

Handy.Flap.props.reveal_duration
Name:

reveal-duration

Type:

int

Default Value:

250

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The reveal transition animation duration, in milliseconds.

New in version 1.2.

Handy.Flap.props.reveal_flap
Name:

reveal-flap

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the flap widget is revealed.

New in version 1.2.

Handy.Flap.props.reveal_progress
Name:

reveal-progress

Type:

float

Default Value:

1.0

Flags:

READABLE

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:

Gtk.Widget

Default Value:

None

Flags:

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<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:

bool

Default Value:

True

Flags:

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<Handy.Flap.props.transition_type>] value.

New in version 1.2.

Handy.Flap.props.swipe_to_open
Name:

swipe-to-open

Type:

bool

Default Value:

True

Flags:

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<Handy.Flap.props.transition_type>] value.

New in version 1.2.

Handy.Flap.props.transition_type
Name:

transition-type

Type:

Handy.FlapTransitionType

Default Value:

Handy.FlapTransitionType.OVER

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

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.