Adw.Carousel¶
- Subclasses:
None
Methods¶
- Inherited:
Gtk.Widget (181), GObject.Object (37), Gtk.Accessible (15), Gtk.Buildable (1), Adw.Swipeable (5), Gtk.Orientable (2)
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r |
|||
r |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
Signals¶
- Inherited:
Name |
Short Description |
---|---|
This signal is emitted after a page has been changed. |
Fields¶
- Inherited:
Class Details¶
- class Adw.Carousel(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
A paginated scrolling widget.
<picture> <source srcset=”carousel-dark.png” media=”(prefers-color-scheme: dark)”> <img src=”carousel.png” alt=”carousel”> </picture>
The
AdwCarousel
widget can be used to display a set of pages with swipe-based navigation between them.[class`CarouselIndicatorDots`] and [class`CarouselIndicatorLines`] can be used to provide page indicators for
AdwCarousel
.- CSS nodes
AdwCarousel
has a single CSS node with namecarousel
.- classmethod new()¶
- Returns:
the newly created
AdwCarousel
- Return type:
Creates a new
AdwCarousel
.
- append(child)¶
- Parameters:
child (
Gtk.Widget
) – a widget to add
Appends child to self.
- get_allow_long_swipes()¶
- Returns:
TRUE
if long swipes are allowed- Return type:
Gets whether to allow swiping for more than one page at a time.
- get_allow_mouse_drag()¶
- Returns:
whether self can be dragged with mouse pointer
- Return type:
Sets whether self can be dragged with mouse pointer.
- get_allow_scroll_wheel()¶
- Returns:
TRUE
if self will respond to scroll wheel events- Return type:
Gets whether self will respond to scroll wheel events.
- get_interactive()¶
- Returns:
whether self can be navigated
- Return type:
Gets whether self can be navigated.
- get_n_pages()¶
- Returns:
the number of pages in self
- Return type:
Gets the number of pages in self.
- get_nth_page(n)¶
- Parameters:
n (
int
) – index of the page- Returns:
the page
- Return type:
Gets the page at position n.
- get_position()¶
- Returns:
the scroll position
- Return type:
Gets current scroll position in self, unitless.
1 matches 1 page. Use [method`Carousel`.scroll_to] for changing it.
- get_reveal_duration()¶
- Returns:
the duration
- Return type:
Gets the page reveal duration, in milliseconds.
- get_scroll_params()¶
- Returns:
the animation parameters
- Return type:
Gets the scroll animation spring parameters for self.
- get_spacing()¶
- Returns:
spacing between pages
- Return type:
Gets spacing between pages in pixels.
- insert(child, position)¶
- Parameters:
child (
Gtk.Widget
) – a widget to addposition (
int
) – the position to insert child at
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.
- prepend(child)¶
- Parameters:
child (
Gtk.Widget
) – a widget to add
Prepends child to self.
- remove(child)¶
- Parameters:
child (
Gtk.Widget
) – a widget to remove
Removes child from self.
- reorder(child, position)¶
- Parameters:
child (
Gtk.Widget
) – a widget to addposition (
int
) – the position to move child to
Moves child into position position.
If position is -1, or larger than the number of pages, child will be moved at the end.
- scroll_to(widget, animate)¶
- Parameters:
widget (
Gtk.Widget
) – a child of selfanimate (
bool
) – whether to animate the transition
Scrolls to widget.
If animate is
TRUE
, the transition will be animated.
- set_allow_long_swipes(allow_long_swipes)¶
- Parameters:
allow_long_swipes (
bool
) – whether to 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.
- set_allow_mouse_drag(allow_mouse_drag)¶
- Parameters:
allow_mouse_drag (
bool
) – whether self can be dragged with mouse pointer
Sets whether self can be dragged with mouse pointer.
If allow_mouse_drag is
FALSE
, dragging is only available on touch.
- set_allow_scroll_wheel(allow_scroll_wheel)¶
- Parameters:
allow_scroll_wheel (
bool
) – whether self will respond to scroll wheel events
Sets whether self will respond to scroll wheel events.
If allow_scroll_wheel is
FALSE
, wheel events will be ignored.
- set_interactive(interactive)¶
- Parameters:
interactive (
bool
) – whether self can be navigated
Sets whether self can be navigated.
This can be used to temporarily disable the carousel to only allow navigating it in a certain state.
- set_reveal_duration(reveal_duration)¶
- Parameters:
reveal_duration (
int
) – the new reveal duration value
Sets the page reveal duration, in milliseconds.
Reveal duration is used when animating adding or removing pages.
- set_scroll_params(params)¶
- Parameters:
params (
Adw.SpringParams
) – the new parameters
Sets the scroll animation spring parameters for self.
The default value is equivalent to:
``c adw_spring_params_new (1, 0.5, 500) ``
Signal Details¶
- Adw.Carousel.signals.page_changed(carousel, index)¶
- Signal Name:
page-changed
- Flags:
- Parameters:
carousel (
Adw.Carousel
) – The object which received the signalindex (
int
) – current page
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
.
Property Details¶
- Adw.Carousel.props.allow_long_swipes¶
- Name:
allow-long-swipes
- Type:
- Default Value:
- Flags:
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.
- Adw.Carousel.props.allow_mouse_drag¶
- Name:
allow-mouse-drag
- Type:
- Default Value:
- Flags:
Sets whether the
AdwCarousel
can be dragged with mouse pointer.If the value is
FALSE
, dragging is only available on touch.
- Adw.Carousel.props.allow_scroll_wheel¶
- Name:
allow-scroll-wheel
- Type:
- Default Value:
- Flags:
Whether the widget will respond to scroll wheel events.
If the value is
FALSE
, wheel events will be ignored.
- Adw.Carousel.props.interactive¶
- Name:
interactive
- Type:
- Default Value:
- Flags:
Whether the carousel can be navigated.
This can be used to temporarily disable the carousel to only allow navigating it in a certain state.
- Adw.Carousel.props.n_pages¶
-
The number of pages in a
AdwCarousel
.
- Adw.Carousel.props.position¶
-
Current scrolling position, unitless.
1 matches 1 page. Use [method`Carousel`.scroll_to] for changing it.
- Adw.Carousel.props.reveal_duration¶
- Name:
reveal-duration
- Type:
- Default Value:
0
- Flags:
Page reveal duration, in milliseconds.
Reveal duration is used when animating adding or removing pages.
- Adw.Carousel.props.scroll_params¶
- Name:
scroll-params
- Type:
- Default Value:
- Flags:
Scroll animation spring parameters.
The default value is equivalent to:
``c adw_spring_params_new (1, 0.5, 500) ``
- Adw.Carousel.props.spacing¶
- Name:
spacing
- Type:
- Default Value:
0
- Flags:
Spacing between pages in pixels.