Top | ![]() |
![]() |
![]() |
![]() |
void | hdy_swipeable_switch_child () |
void | hdy_swipeable_emit_child_switched () |
HdySwipeTracker * | hdy_swipeable_get_swipe_tracker () |
gdouble | hdy_swipeable_get_distance () |
gdouble * | hdy_swipeable_get_snap_points () |
gdouble | hdy_swipeable_get_progress () |
gdouble | hdy_swipeable_get_cancel_progress () |
void | hdy_swipeable_get_swipe_area () |
The HdySwipeable interface is implemented by all swipeable widgets. They can be synced using HdySwipeGroup.
See HdySwipeTracker for details about implementing it.
void hdy_swipeable_switch_child (HdySwipeable *self
,guint index
,gint64 duration
);
See HdySwipeable::child-switched.
self |
||
index |
the index of the child to switch to |
|
duration |
Animation duration in milliseconds |
Since: 1.0
void hdy_swipeable_emit_child_switched (HdySwipeable *self
,guint index
,gint64 duration
);
Emits HdySwipeable::child-switched signal. This should be called when the widget switches visible child widget.
duration
can be 0 if the child is switched without animation.
self |
||
index |
the index of the child to switch to |
|
duration |
Animation duration in milliseconds |
Since: 1.0
HdySwipeTracker *
hdy_swipeable_get_swipe_tracker (HdySwipeable *self
);
Gets the HdySwipeTracker used by this swipeable widget.
Since: 1.0
gdouble
hdy_swipeable_get_distance (HdySwipeable *self
);
Gets the swipe distance of self
. This corresponds to how many pixels
1 unit represents.
Since: 1.0
gdouble * hdy_swipeable_get_snap_points (HdySwipeable *self
,gint *n_snap_points
);
Gets the snap points of self
. Each snap point represents a progress value
that is considered acceptable to end the swipe on.
[virtual get_snap_points]
the snap points of
self
. The array must be freed with g_free()
.
[array length=n_snap_points][transfer full]
Since: 1.0
gdouble
hdy_swipeable_get_progress (HdySwipeable *self
);
Gets the current progress of self
Since: 1.0
gdouble
hdy_swipeable_get_cancel_progress (HdySwipeable *self
);
Gets the progress self
will snap back to after the gesture is canceled.
Since: 1.0
void hdy_swipeable_get_swipe_area (HdySwipeable *self
,HdyNavigationDirection navigation_direction
,gboolean is_drag
,GdkRectangle *rect
);
Gets the area self
can start a swipe from for the given direction and
gesture type.
This can be used to restrict swipes to only be possible from a certain area,
for example, to only allow edge swipes, or to have a draggable element and
ignore swipes elsewhere.
Swipe area is only considered for direct swipes (as in, not initiated by HdySwipeGroup).
If not implemented, the default implementation returns the allocation of
self
, allowing swipes from anywhere.
self |
||
navigation_direction |
the direction of the swipe |
|
is_drag |
whether the swipe is caused by a dragging gesture |
|
rect |
a pointer to a GdkRectangle to store the swipe area. |
[out] |
Since: 1.0
struct HdySwipeableInterface { GTypeInterface parent; void (*switch_child) (HdySwipeable *self, guint index, gint64 duration); HdySwipeTracker * (*get_swipe_tracker) (HdySwipeable *self); gdouble (*get_distance) (HdySwipeable *self); gdouble * (*get_snap_points) (HdySwipeable *self, gint *n_snap_points); gdouble (*get_progress) (HdySwipeable *self); gdouble (*get_cancel_progress) (HdySwipeable *self); void (*get_swipe_area) (HdySwipeable *self, HdyNavigationDirection navigation_direction, gboolean is_drag, GdkRectangle *rect); };
An interface for swipeable widgets.
The parent interface. |
||
Switches visible child. |
||
Gets the swipe tracker. |
||
Gets the swipe distance. |
||
Gets the snap points |
||
Gets the current progress. |
||
Gets the cancel progress. |
||
Gets the swipeable rectangle. |
Since: 1.0
“child-switched”
signalvoid user_function (HdySwipeable *self, guint index, gint64 duration, gpointer user_data)
This signal should be emitted when the widget's visible child is changed.
duration
can be 0 if the child is switched without animation.
This is used by HdySwipeGroup, applications should not connect to it.
self |
The HdySwipeable instance |
|
index |
the index of the child to switch to |
|
duration |
Animation duration in milliseconds |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run First
Since: 1.0