Next: <AdwCarouselIndicatorDots>, Previous: <AdwCallbackAnimationTarget>, Up: Classes   [Index]


1.17 <AdwCarousel> ¶

Class: <AdwCarousel> ¶

It derives from <GtkWidget>.

A paginated scrolling widget.

The <AdwCarousel> widget can be used to display a set of pages with swipe-based navigation between them.

CarouselIndicatorDots and CarouselIndicatorLines can be used to provide page indicators for <AdwCarousel>.

CSS nodes ¶

<AdwCarousel> has a single CSS node with name carousel.

Properties ¶

Property: carousel:allow-long-swipes self ¶

Whether to allow swiping for more than one page at a time.

If the value is FALSE, each swipe can only move to the adjacent pages.

Its value is a boolean.

Set it with (set! (carousel:allow-long-swipes self) value).

Property: carousel:allow-mouse-drag self ¶

Sets whether the <AdwCarousel> can be dragged with mouse pointer.

If the value is FALSE, dragging is only available on touch.

Its value is a boolean.

Set it with (set! (carousel:allow-mouse-drag self) value).

Property: carousel:allow-scroll-wheel self ¶

Whether the widget will respond to scroll wheel events.

If the value is FALSE, wheel events will be ignored.

Its value is a boolean.

Set it with (set! (carousel:allow-scroll-wheel self) value).

Property: carousel:interactive self ¶

Whether the carousel can be navigated.

This can be used to temporarily disable the carousel to only allow navigating it in a certain state.

Its value is a boolean.

Set it with (set! (carousel:interactive self) value).

Property: carousel:n-pages self ¶

The number of pages in a <AdwCarousel>.

Its value is an unsigned 32-bit integer.

It is read only.

Property: carousel:position self ¶

Current scrolling position, unitless.

1 matches 1 page. Use Carousel.scroll_to for changing it.

Its value is a real number.

It is read only.

Property: carousel:reveal-duration self ¶

Page reveal duration, in milliseconds.

Reveal duration is used when animating adding or removing pages.

Its value is an unsigned 32-bit integer.

Set it with (set! (carousel:reveal-duration self) value).

Property: carousel:scroll-params self ¶

Scroll animation spring parameters.

The default value is equivalent to:

adw_spring_params_new (1, 0.5, 500)

Its value is a <AdwSpringParams>, or #f.

Set it with (set! (carousel:scroll-params self) value).

Property: carousel:spacing self ¶

Spacing between pages in pixels.

Its value is an unsigned 32-bit integer.

Set it with (set! (carousel:spacing self) value).

Procedures ¶

Method: carousel:append self child ¶
Method: append self child ¶

Appends child to self.

self

Passed: a <AdwCarousel>.

a carousel

child

Passed: a <GtkWidget>.

a widget to add

Method: carousel:get-allow-long-swipes? self ⇒ %return ¶
Method: get-allow-long-swipes? self ⇒ %return ¶

Gets whether to allow swiping for more than one page at a time.

self

Passed: a <AdwCarousel>.

a carousel

%return

Returned: a boolean.

TRUE if long swipes are allowed

Method: carousel:get-allow-mouse-drag? self ⇒ %return ¶
Method: get-allow-mouse-drag? self ⇒ %return ¶

Sets whether self can be dragged with mouse pointer.

self

Passed: a <AdwCarousel>.

a carousel

%return

Returned: a boolean.

whether self can be dragged with mouse pointer

Method: carousel:get-allow-scroll-wheel? self ⇒ %return ¶
Method: get-allow-scroll-wheel? self ⇒ %return ¶

Gets whether self will respond to scroll wheel events.

self

Passed: a <AdwCarousel>.

a carousel

%return

Returned: a boolean.

TRUE if self will respond to scroll wheel events

Method: carousel:get-interactive? self ⇒ %return ¶
Method: get-interactive? self ⇒ %return ¶

Gets whether self can be navigated.

self

Passed: a <AdwCarousel>.

a carousel

%return

Returned: a boolean.

whether self can be navigated

Method: carousel:get-n-pages self ⇒ %return ¶
Method: get-n-pages self ⇒ %return ¶

Gets the number of pages in self.

self

Passed: a <AdwCarousel>.

a carousel

%return

Returned: an unsigned 32-bit integer.

the number of pages in self

Method: carousel:get-nth-page self n ⇒ %return ¶
Method: get-nth-page self n ⇒ %return ¶

Gets the page at position n.

self

Passed: a <AdwCarousel>.

a carousel

n

Passed: an unsigned 32-bit integer.

index of the page

%return

Returned: a <GtkWidget>.

the page

Method: carousel:get-position self ⇒ %return ¶
Method: get-position self ⇒ %return ¶

Gets current scroll position in self, unitless.

1 matches 1 page. Use Carousel.scroll_to for changing it.

self

Passed: a <AdwCarousel>.

a carousel

%return

Returned: a real number.

the scroll position

Method: carousel:get-reveal-duration self ⇒ %return ¶
Method: get-reveal-duration self ⇒ %return ¶

Gets the page reveal duration, in milliseconds.

self

Passed: a <AdwCarousel>.

a carousel

%return

Returned: an unsigned 32-bit integer.

the duration

Method: carousel:get-scroll-params self ⇒ %return ¶
Method: get-scroll-params self ⇒ %return ¶

Gets the scroll animation spring parameters for self.

self

Passed: a <AdwCarousel>.

a carousel

%return

Returned: a <AdwSpringParams>.

the animation parameters

Method: carousel:get-spacing self ⇒ %return ¶
Method: get-spacing self ⇒ %return ¶

Gets spacing between pages in pixels.

self

Passed: a <AdwCarousel>.

a carousel

%return

Returned: an unsigned 32-bit integer.

spacing between pages

Method: carousel:insert self child position ¶
Method: insert self child 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.

self

Passed: a <AdwCarousel>.

a carousel

child

Passed: a <GtkWidget>.

a widget to add

position

Passed: a 32-bit integer.

the position to insert child at

Procedure: carousel:new ⇒ %return ¶

Creates a new <AdwCarousel>.

%return

Returned: a <GtkWidget>.

the newly created <AdwCarousel>

Method: carousel:prepend self child ¶
Method: prepend self child ¶

Prepends child to self.

self

Passed: a <AdwCarousel>.

a carousel

child

Passed: a <GtkWidget>.

a widget to add

Method: carousel:remove self child ¶
Method: remove self child ¶

Removes child from self.

self

Passed: a <AdwCarousel>.

a carousel

child

Passed: a <GtkWidget>.

a widget to remove

Method: carousel:reorder self child position ¶
Method: reorder self child position ¶

Moves child into position position.

If position is -1, or larger than the number of pages, child will be moved at the end.

self

Passed: a <AdwCarousel>.

a carousel

child

Passed: a <GtkWidget>.

a widget to add

position

Passed: a 32-bit integer.

the position to move child to

Method: carousel:scroll-to self widget animate ¶
Method: scroll-to self widget animate ¶

Scrolls to widget.

If animate is TRUE, the transition will be animated.

self

Passed: a <AdwCarousel>.

a carousel

widget

Passed: a <GtkWidget>.

a child of self

animate

Passed: a boolean.

whether to animate the transition

Method: carousel:set-allow-long-swipes self allow-long-swipes ¶
Method: set-allow-long-swipes self allow-long-swipes ¶

Sets whether to allow swiping for more than one page at a time.

If allow-long-swipes is FALSE, each swipe can only move to the adjacent pages.

self

Passed: a <AdwCarousel>.

a carousel

allow-long-swipes

Passed: a boolean.

whether to allow long swipes

Method: carousel:set-allow-mouse-drag self allow-mouse-drag ¶
Method: set-allow-mouse-drag self allow-mouse-drag ¶

Sets whether self can be dragged with mouse pointer.

If allow-mouse-drag is FALSE, dragging is only available on touch.

self

Passed: a <AdwCarousel>.

a carousel

allow-mouse-drag

Passed: a boolean.

whether self can be dragged with mouse pointer

Method: carousel:set-allow-scroll-wheel self allow-scroll-wheel ¶
Method: set-allow-scroll-wheel self allow-scroll-wheel ¶

Sets whether self will respond to scroll wheel events.

If allow-scroll-wheel is FALSE, wheel events will be ignored.

self

Passed: a <AdwCarousel>.

a carousel

allow-scroll-wheel

Passed: a boolean.

whether self will respond to scroll wheel events

Method: carousel:set-interactive self interactive ¶
Method: set-interactive self interactive ¶

Sets whether self can be navigated.

This can be used to temporarily disable the carousel to only allow navigating it in a certain state.

self

Passed: a <AdwCarousel>.

a carousel

interactive

Passed: a boolean.

whether self can be navigated

Method: carousel:set-reveal-duration self reveal-duration ¶
Method: set-reveal-duration self reveal-duration ¶

Sets the page reveal duration, in milliseconds.

Reveal duration is used when animating adding or removing pages.

self

Passed: a <AdwCarousel>.

a carousel

reveal-duration

Passed: an unsigned 32-bit integer.

the new reveal duration value

Method: carousel:set-scroll-params self params ¶
Method: set-scroll-params self params ¶

Sets the scroll animation spring parameters for self.

The default value is equivalent to:

adw_spring_params_new (1, 0.5, 500)
self

Passed: a <AdwCarousel>.

a carousel

params

Passed: a <AdwSpringParams>.

the new parameters

Method: carousel:set-spacing self spacing ¶
Method: set-spacing self spacing ¶

Sets spacing between pages in pixels.

self

Passed: a <AdwCarousel>.

a carousel

spacing

Passed: an unsigned 32-bit integer.

the new spacing value

Signals ¶

Signal: carousel:page-changed ¶

Connect a handler with (connect object carousel:page-changed handler). It is called as (handler self index).

This signal is emitted after a page has been changed.

It can be used to implement "infinite scrolling" by amending the pages after every scroll.

::: note An empty carousel is indicated by (int)index == -1.

self

Passed: a <AdwCarousel>.

index

Passed: an unsigned 32-bit integer.

current page


Next: <AdwCarouselIndicatorDots>, Previous: <AdwCallbackAnimationTarget>, Up: Classes   [Index]