Top |
gboolean | allow-mouse-drag | Read / Write |
guint | animation-duration | Read / Write |
gboolean | center-content | Read / Write |
guint | indicator-spacing | Read / Write |
HdyCarouselIndicatorStyle | indicator-style | Read / Write |
gboolean | interactive | Read / Write |
guint | n-pages | Read |
gdouble | position | Read |
guint | spacing | Read / Write |
GEnum ╰── HdyCarouselIndicatorStyle GObject ╰── GInitiallyUnowned ╰── GtkWidget ╰── GtkContainer ╰── GtkBin ╰── GtkEventBox ╰── HdyCarousel
HdyCarousel implements AtkImplementorIface, GtkBuildable, GtkOrientable and HdySwipeable.
The HdyCarousel widget can be used to display a set of pages with swipe-based navigation between them and optional indicators.
GtkWidget *
hdy_carousel_new (void
);
Create a new HdyCarousel widget.
Since: 1.0
void hdy_carousel_prepend (HdyCarousel *self
,GtkWidget *child
);
Prepends child
to self
Since: 1.0
void hdy_carousel_insert (HdyCarousel *self
,GtkWidget *child
,gint position
);
Inserts child
into self
at position position
.
If position is -1, or larger than the number of pages,
child
will be appended to the end.
Since: 1.0
void hdy_carousel_reorder (HdyCarousel *self
,GtkWidget *child
,gint position
);
Moves child
into position position
.
If position is -1, or larger than the number of pages, child
will be moved
to the end.
Since: 1.0
void hdy_carousel_scroll_to (HdyCarousel *self
,GtkWidget *widget
);
Scrolls to widget
position with an animation.
“animation-duration” property can be used for controlling the
duration.
Since: 1.0
void hdy_carousel_scroll_to_full (HdyCarousel *self
,GtkWidget *widget
,gint64 duration
);
Scrolls to widget
position with an animation.
Since: 1.0
guint
hdy_carousel_get_n_pages (HdyCarousel *self
);
Gets the number of pages in self
.
Since: 1.0
gdouble
hdy_carousel_get_position (HdyCarousel *self
);
Gets current scroll position in self
. It's unitless, 1 matches 1 page.
Since: 1.0
gboolean
hdy_carousel_get_interactive (HdyCarousel *self
);
Gets whether self
can be navigated.
Since: 1.0
void hdy_carousel_set_interactive (HdyCarousel *self
,gboolean interactive
);
Sets whether self
can be navigated. This can be used to temporarily disable
a HdyCarousel to only allow swiping in a certain state.
Since: 1.0
HdyCarouselIndicatorStyle
hdy_carousel_get_indicator_style (HdyCarousel *self
);
Gets the current page indicator style.
Since: 1.0
void hdy_carousel_set_indicator_style (HdyCarousel *self
,HdyCarouselIndicatorStyle style
);
Sets style of page indicators. Depending on orientation, they are displayed below or besides the pages. If the pages are meant to be centered, “center-content” can be used to compensate for that.
Since: 1.0
guint
hdy_carousel_get_indicator_spacing (HdyCarousel *self
);
Gets spacing between content and page indicators.
Since: 1.0
void hdy_carousel_set_indicator_spacing (HdyCarousel *self
,guint spacing
);
Sets spacing between content and page indicators. Does nothing if
“indicator-style” is HDY_CAROUSEL_INDICATOR_STYLE_NONE
.
Since: 1.0
gboolean
hdy_carousel_get_center_content (HdyCarousel *self
);
Sets whether self
is centering pages.
Since: 1.0
void hdy_carousel_set_center_content (HdyCarousel *self
,gboolean center_content
);
Sets whether self
is centering content. If “indicator-style” is
HDY_CAROUSEL_INDICATOR_STYLE_NONE
, centering does nothing, otherwise it
adds whitespace to the left or above the pages to compensate for the
indicators.
Since: 1.0
guint
hdy_carousel_get_spacing (HdyCarousel *self
);
Gets spacing between pages in pixels.
Since: 1.0
void hdy_carousel_set_spacing (HdyCarousel *self
,guint spacing
);
Sets spacing between pages in pixels.
Since: 1.0
guint
hdy_carousel_get_animation_duration (HdyCarousel *self
);
Gets animation duration used by hdy_carousel_scroll_to()
.
Since: 1.0
void hdy_carousel_set_animation_duration (HdyCarousel *self
,guint duration
);
Sets animation duration used by hdy_carousel_scroll_to()
.
Since: 1.0
gboolean
hdy_carousel_get_allow_mouse_drag (HdyCarousel *self
);
Sets whether self
can be dragged with mouse pointer
Since: 1.0
void hdy_carousel_set_allow_mouse_drag (HdyCarousel *self
,gboolean allow_mouse_drag
);
Sets whether self
can be dragged with mouse pointer. If allow_mouse_drag
is FALSE
, dragging is only available on touch.
This should usually be FALSE
.
Since: 1.0
These enumeration values describe the possible page indicator styles in a HdyCarousel widget.
New values may be added to this enumeration over time.
“allow-mouse-drag”
property“allow-mouse-drag” gboolean
Sets whether the HdyCarousel can be dragged with mouse pointer. If the
value is FALSE
, dragging is only available on touch.
This should usually be FALSE
.
Owner: HdyCarousel
Flags: Read / Write
Default value: FALSE
Since: 1.0
“animation-duration”
property“animation-duration” guint
Animation duration in milliseconds, used by hdy_carousel_scroll_to()
.
Owner: HdyCarousel
Flags: Read / Write
Default value: 250
Since: 1.0
“center-content”
property“center-content” gboolean
Whether the HdyCarousel is centering pages. If
“indicator-style” is HDY_CAROUSEL_INDICATOR_STYLE_NONE
,
centering does nothing, otherwise it adds whitespace to the left or above
the pages to compensate for the indicators.
Owner: HdyCarousel
Flags: Read / Write
Default value: FALSE
Since: 1.0
“indicator-spacing”
property“indicator-spacing” guint
Spacing between content and page indicators. Does nothing if
“indicator-style” is HDY_CAROUSEL_INDICATOR_STYLE_NONE
.
Owner: HdyCarousel
Flags: Read / Write
Default value: 0
Since: 1.0
“indicator-style”
property“indicator-style” HdyCarouselIndicatorStyle
The style of page indicators. Depending on orientation, they are displayed below or besides the pages. If the pages are meant to be centered, “center-content” can be used to compensate for that.
Owner: HdyCarousel
Flags: Read / Write
Default value: HDY_CAROUSEL_INDICATOR_STYLE_NONE
Since: 1.0
“interactive”
property“interactive” gboolean
Whether self
can be navigated. This can be used to temporarily disable
a HdyCarousel to only allow navigating it in a certain state.
Owner: HdyCarousel
Flags: Read / Write
Default value: TRUE
Since: 1.0
“n-pages”
property“n-pages” guint
The number of pages in a HdyCarousel
Owner: HdyCarousel
Flags: Read
Default value: 0
Since: 1.0
“position”
property“position” gdouble
Current scrolling position, unitless. 1 matches 1 page. Use
hdy_carousel_scroll_to()
for changing it.
Owner: HdyCarousel
Flags: Read
Allowed values: >= 0
Default value: 0
Since: 1.0
“page-changed”
signalvoid user_function (HdyCarousel *self, guint index, gpointer user_data)
This signal is emitted after a page has been changed. This can be used to implement "infinite scrolling" by connecting to this signal and amending the pages.
self |
The HdyCarousel instance |
|
index |
Current page |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
Since: 1.0