Handy.Leaflet¶
- 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 |
Whether or not swipe gesture can be used to switch to the previous child |
||
r/w/en |
Whether or not swipe gesture can be used to switch to the next child |
||
r/w/en |
The child transition animation duration, in milliseconds |
||
r |
Whether or not the child transition is currently running |
||
r/en |
Whether the widget is folded |
||
r/w/en |
Horizontally homogeneous sizing when the leaflet is folded |
||
r/w/en |
Horizontally homogeneous sizing when the leaflet is unfolded |
||
r/w/en |
Whether or not the size should smoothly change when changing between differently sized children |
||
r/w/en |
The mode transition animation duration, in milliseconds |
||
r/w/en |
The type of animation used to transition between modes and children |
||
r/w/en |
Vertically homogeneous sizing when the leaflet is folded |
||
r/w/en |
Vertically homogeneous sizing when the leaflet is unfolded |
||
r/w/en |
The widget currently visible when the leaflet is folded |
||
r/w/en |
The name of the widget currently visible when the children are stacked |
Child Properties¶
Name |
Type |
Default |
Flags |
Short Description |
---|---|---|---|---|
|
r/w |
The name of the child page |
||
|
r/w |
Whether the child can be navigated to |
Style Properties¶
- Inherited:
Signals¶
Fields¶
Name |
Type |
Access |
Description |
---|---|---|---|
parent_instance |
r |
Class Details¶
- class Handy.Leaflet(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
An adaptive container acting like a box or a stack.
The
HdyLeaflet
widget can display its children like a [class`Gtk`.Box] does or like a [class`Gtk`.Stack] does, adapting to size changes by switching between the two modes.When there is enough space the children are displayed side by side, otherwise only one is displayed and the leaflet is said to be “folded”. The threshold is dictated by the preferred minimum sizes of the children. When a leaflet is folded, the children can be navigated using swipe gestures.
The “over” and “under” transition types stack the children one on top of the other, while the “slide” transition puts the children side by side. While navigating to a child on the side or below can be performed by swiping the current child away, navigating to an upper child requires dragging it from the edge where it resides. This doesn’t affect non-dragging swipes.
The “over” and “under” transitions can draw their shadow on top of the window’s transparent areas, like the rounded corners. This is a side-effect of allowing shadows to be drawn on top of OpenGL areas. It can be mitigated by using [class`Window`] or [class`ApplicationWindow`] as they will crop anything drawn beyond the rounded corners.
The child property
navigatable
can be set onHdyLeaflet
children to determine whether they can be navigated to when folded. IfFALSE
, the child will be ignored by [method`Leaflet`.get_adjacent_child], [method`Leaflet`.navigate], and swipe gestures. This can be used used to prevent switching to widgets like separators.- CSS nodes
HdyLeaflet
has a single CSS node with nameleaflet
. The node will get the style classes.folded
when it is folded,.unfolded
when it’s not, or none if it didn’t compute its fold yet.New in version 1.0.
- classmethod new()¶
- Returns:
the newly created
HdyLeaflet
- Return type:
Creates a new
HdyLeaflet
.New in version 1.0.
- get_adjacent_child(direction)¶
- Parameters:
direction (
Handy.NavigationDirection
) – the direction- Returns:
the previous or next child
- Return type:
Gtk.Widget
orNone
Finds the previous or next navigatable child.
This will be the same widget [method`Leaflet`.navigate] will navigate to.
If there’s no child to navigate to,
NULL
will be returned instead.New in version 1.0.
- get_can_swipe_back()¶
- Returns:
TRUE
if back swipe is enabled- Return type:
Gets whether swipe gestures switch to the previous navigatable child.
New in version 1.0.
- get_can_swipe_forward()¶
- Returns:
TRUE
if forward swipe is enabled- Return type:
Gets whether swipe gestures switch to the next navigatable child.
New in version 1.0.
- get_child_by_name(name)¶
- Parameters:
name (
str
) – the name of the child to find- Returns:
the requested child of self
- Return type:
Gtk.Widget
orNone
Finds the child of self with the name given as the argument.
Returns
NULL
if there is no child with this name.New in version 1.0.
- get_child_transition_duration()¶
- Returns:
the child transition duration, in milliseconds
- Return type:
Gets the amount of time that transitions between children will take.
New in version 1.0.
- get_child_transition_running()¶
- Returns:
whether a transition is currently running
- Return type:
Returns whether self is currently in a transition from one page to another.
New in version 1.0.
- get_folded()¶
- Returns:
whether self is folded
- Return type:
Gets whether self is folded.
New in version 1.0.
- get_homogeneous(folded, orientation)¶
- Parameters:
folded (
bool
) – the foldorientation (
Gtk.Orientation
) – the orientation
- Returns:
whether self is homogeneous for the given fold and orientation
- Return type:
Gets whether self is homogeneous for the given fold and orientation.
New in version 1.0.
- get_interpolate_size()¶
- Returns:
TRUE
if child sizes are interpolated- Return type:
Gets whether to interpolate between the sizes of children on page switches.
New in version 1.0.
- get_mode_transition_duration()¶
- Returns:
the mode transition duration, in milliseconds
- Return type:
Gets the amount of time that transitions between modes in self will take.
New in version 1.0.
- get_transition_type()¶
- Returns:
the current transition type of self
- Return type:
Gets the animation type that will be used for transitions between modes and children.
New in version 1.0.
- get_visible_child()¶
- Returns:
the visible child widget
- Return type:
Gets the visible child widget.
New in version 1.0.
- get_visible_child_name()¶
- Returns:
the name of the visible child
- Return type:
Gets the name of the currently visible child widget.
New in version 1.0.
- insert_child_after(child, sibling)¶
- Parameters:
child (
Gtk.Widget
) – the widget to insertsibling (
Gtk.Widget
orNone
) – the sibling after which to insert child
Inserts child in the position after sibling in the list of children.
If sibling is
NULL
, inserts child at the first position.New in version 1.2.
- Parameters:
direction (
Handy.NavigationDirection
) – the direction- Returns:
whether the visible child was changed
- Return type:
Navigates to the previous or next navigatable child.
The switch is similar to performing a swipe gesture to go in direction.
New in version 1.0.
- prepend(child)¶
- Parameters:
child (
Gtk.Widget
) – the widget to prepend
Inserts child at the first position in self.
New in version 1.2.
- reorder_child_after(child, sibling)¶
- Parameters:
child (
Gtk.Widget
) – the widget to move, must be a child of selfsibling (
Gtk.Widget
orNone
) – the sibling to move child after
Moves child to the position after sibling in the list of children.
If sibling is
NULL
, move child to the first position.New in version 1.2.
- set_can_swipe_back(can_swipe_back)¶
- Parameters:
can_swipe_back (
bool
) – the new value
Sets whether swipe gestures switch to the previous navigatable child.
New in version 1.0.
- set_can_swipe_forward(can_swipe_forward)¶
- Parameters:
can_swipe_forward (
bool
) – the new value
Sets whether swipe gestures switch to the next navigatable child.
New in version 1.0.
- set_child_transition_duration(duration)¶
- Parameters:
duration (
int
) – the new duration, in milliseconds
Sets the duration that transitions between children in self will take.
New in version 1.0.
- set_homogeneous(folded, orientation, homogeneous)¶
- Parameters:
folded (
bool
) – the foldorientation (
Gtk.Orientation
) – the orientationhomogeneous (
bool
) –TRUE
to make self homogeneous
Sets whether to be homogeneous for the given fold and orientation.
If it is homogeneous, the [class`Leaflet`] will request the same width or height for all its children depending on the orientation. If it isn’t and it is folded, the leaflet may change width or height when a different child becomes visible.
New in version 1.0.
- set_interpolate_size(interpolate_size)¶
- Parameters:
interpolate_size (
bool
) – the new value
Sets whether self will interpolate its size when changing the visible child.
If the [property`Leaflet`:py:data::interpolate-size<Handy.Leaflet.props.interpolate_size>] property is set to
TRUE
, self will interpolate its size between the current one and the one it’ll take after changing the visible child, according to the set transition duration.New in version 1.0.
- set_mode_transition_duration(duration)¶
- Parameters:
duration (
int
) – the new duration, in milliseconds
Sets the duration that transitions between modes in self will take.
New in version 1.0.
- set_transition_type(transition)¶
- Parameters:
transition (
Handy.LeafletTransitionType
) – the new transition type
Sets the animation type that will be used for transitions between modes and children.
The transition type can be changed without problems at runtime, so it is possible to change the animation based on the mode or child that is about to become current.
New in version 1.0.
- set_visible_child(visible_child)¶
- Parameters:
visible_child (
Gtk.Widget
) – the new child
Sets the currently visible widget when the leaflet is folded.
New in version 1.0.
Property Details¶
- Handy.Leaflet.props.can_swipe_back¶
- Name:
can-swipe-back
- Type:
- Default Value:
- Flags:
Whether swipe gestures allow switching to the previous navigatable child.
New in version 1.0.
- Handy.Leaflet.props.can_swipe_forward¶
- Name:
can-swipe-forward
- Type:
- Default Value:
- Flags:
Whether swipe gestures allow switching to the next navigatable child.
New in version 1.0.
- Handy.Leaflet.props.child_transition_duration¶
- Name:
child-transition-duration
- Type:
- Default Value:
200
- Flags:
The child transition animation duration, in milliseconds.
New in version 1.0.
- Handy.Leaflet.props.child_transition_running¶
-
Whether a child transition is currently running.
New in version 1.0.
- Handy.Leaflet.props.folded¶
- Name:
folded
- Type:
- Default Value:
- Flags:
Whether the leaflet is folded.
The leaflet will be folded if the size allocated to it is smaller than the sum of the natural size of its children, it will be unfolded otherwise.
New in version 1.0.
- Handy.Leaflet.props.hhomogeneous_folded¶
- Name:
hhomogeneous-folded
- Type:
- Default Value:
- Flags:
Whether to allocate the same width for all children when folded.
New in version 1.0.
- Handy.Leaflet.props.hhomogeneous_unfolded¶
- Name:
hhomogeneous-unfolded
- Type:
- Default Value:
- Flags:
Whether to allocate the same width for all children when unfolded.
New in version 1.0.
- Handy.Leaflet.props.interpolate_size¶
- Name:
interpolate-size
- Type:
- Default Value:
- Flags:
Whether the size should smoothly change when changing between children.
New in version 1.0.
- Handy.Leaflet.props.mode_transition_duration¶
- Name:
mode-transition-duration
- Type:
- Default Value:
250
- Flags:
The mode transition animation duration, in milliseconds.
New in version 1.0.
- Handy.Leaflet.props.transition_type¶
- Name:
transition-type
- Type:
- Default Value:
- Flags:
The animation type used for transitions between modes and children.
The transition type can be changed without problems at runtime, so it is possible to change the animation based on the mode or child that is about to become current.
New in version 1.0.
- Handy.Leaflet.props.vhomogeneous_folded¶
- Name:
vhomogeneous-folded
- Type:
- Default Value:
- Flags:
Whether to allocates the same height for all children when folded.
New in version 1.0.
- Handy.Leaflet.props.vhomogeneous_unfolded¶
- Name:
vhomogeneous-unfolded
- Type:
- Default Value:
- Flags:
Whether to allocate the same height for all children when unfolded.
New in version 1.0.
- Handy.Leaflet.props.visible_child¶
- Name:
visible-child
- Type:
- Default Value:
- Flags:
The widget currently visible when the leaflet is folded.
The transition is determined by [property`Leaflet`:py:data::transition-type<Handy.Leaflet.props.transition_type>] and [property`Leaflet`:py:data::child-transition-duration<Handy.Leaflet.props.child_transition_duration>]. The transition can be cancelled by the user, in which case visible child will change back to the previously visible child.
New in version 1.0.
- Handy.Leaflet.props.visible_child_name¶
- Name:
visible-child-name
- Type:
- Default Value:
- Flags:
The name of the widget currently visible when the leaflet is folded.
See [property`Leaflet`:py:data::visible-child<Handy.Leaflet.props.visible_child>].
New in version 1.0.