Package ch.bailu.gtk.adw
Class Carousel
- All Implemented Interfaces:
PointerInterface
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 name `carousel`.
<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 name `carousel`.
https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.Carousel.html
-
Nested Class Summary
Nested classes/interfaces inherited from class ch.bailu.gtk.gtk.Widget
Widget.OnDestroy, Widget.OnDestroyNotify, Widget.OnDirectionChanged, Widget.OnHide, Widget.OnKeynavFailed, Widget.OnMap, Widget.OnMnemonicActivate, Widget.OnMoveFocus, Widget.OnQueryTooltip, Widget.OnRealize, Widget.OnShow, Widget.OnStateFlagsChanged, Widget.OnTickCallback, Widget.OnUnmap, Widget.OnUnrealize
Nested classes/interfaces inherited from class ch.bailu.gtk.gobject.Object
Object.OnBindingTransformFunc, Object.OnDuplicateFunc, Object.OnNotify, Object.OnToggleNotify, Object.OnWeakNotify
-
Field Summary
Fields inherited from class ch.bailu.gtk.gtk.Widget
SIGNAL_ON_DESTROY, SIGNAL_ON_DIRECTION_CHANGED, SIGNAL_ON_HIDE, SIGNAL_ON_KEYNAV_FAILED, SIGNAL_ON_MAP, SIGNAL_ON_MNEMONIC_ACTIVATE, SIGNAL_ON_MOVE_FOCUS, SIGNAL_ON_QUERY_TOOLTIP, SIGNAL_ON_REALIZE, SIGNAL_ON_SHOW, SIGNAL_ON_STATE_FLAGS_CHANGED, SIGNAL_ON_UNMAP, SIGNAL_ON_UNREALIZE
Fields inherited from class ch.bailu.gtk.gobject.Object
SIGNAL_ON_NOTIFY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Appends @child to @self.Implements interfaceAccessible
.Implements interfaceBuildable
.Implements interfaceConstraintTarget
.Implements interfaceOrientable
.Implements interfaceSwipeable
.boolean
Gets whether to allow swiping for more than one page at a time.boolean
Sets whether @self can be dragged with mouse pointer.boolean
Gets whether @self will respond to scroll wheel events.static ClassHandler
static int
boolean
Gets whether @self can be navigated.int
Gets the number of pages in @self.getNthPage
(int n) Gets the page at position @n.static long
static TypeSystem.TypeSize
double
Gets current scroll position in @self, unitless.int
Gets the page reveal duration, in milliseconds.Gets the scroll animation spring parameters for @self.int
Gets spacing between pages in pixels.static long
static TypeSystem.TypeSize
void
Inserts @child into @self at position @position.onPageChanged
(Carousel.OnPageChanged signal) Connect to signal "page-changed".void
Prepends @child to @self.void
Removes @child from @self.void
Moves @child into position @position.void
Scrolls to @widget.void
setAllowLongSwipes
(boolean allow_long_swipes) Sets whether to allow swiping for more than one page at a time.void
setAllowMouseDrag
(boolean allow_mouse_drag) Sets whether @self can be dragged with mouse pointer.void
setAllowScrollWheel
(boolean allow_scroll_wheel) Sets whether @self will respond to scroll wheel events.void
setInteractive
(boolean interactive) Sets whether @self can be navigated.void
setRevealDuration
(int reveal_duration) Sets the page reveal duration, in milliseconds.void
setScrollParams
(SpringParams params) Sets the scroll animation spring parameters for @self.void
setSpacing
(int spacing) Sets spacing between pages in pixels.Methods inherited from class ch.bailu.gtk.gtk.Widget
actionSetEnabled, actionSetEnabled, activate, activateAction, activateAction, activateActionVariant, activateActionVariant, activateDefault, addController, addCssClass, addCssClass, addMnemonicLabel, addTickCallback, allocate, childFocus, computeBounds, computeExpand, computePoint, computeTransform, contains, createPangoContext, createPangoLayout, createPangoLayout, disposeTemplate, dragCheckThreshold, errorBell, getAllocatedBaseline, getAllocatedHeight, getAllocatedWidth, getAllocation, getAncestor, getCanFocus, getCanTarget, getChildVisible, getClipboard, getCssClasses, getCssName, getCursor, getDefaultDirection, getDirection, getDisplay, getFirstChild, getFocusable, getFocusChild, getFocusOnClick, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHeight, getHexpand, getHexpandSet, getLastChild, getLayoutManager, getMapped, getMarginBottom, getMarginEnd, getMarginStart, getMarginTop, getName, getNative, getNextSibling, getOpacity, getOverflow, getPangoContext, getParent, getPreferredSize, getPrevSibling, getPrimaryClipboard, getRealized, getReceivesDefault, getRequestMode, getRoot, getScaleFactor, getSensitive, getSettings, getSize, getSizeRequest, getStateFlags, getStyleContext, getTemplateChild, getTemplateChild, getTooltipMarkup, getTooltipText, getValign, getVexpand, getVexpandSet, getVisible, getWidth, grabFocus, hasCssClass, hasCssClass, hasDefault, hasFocus, hasVisibleFocus, hide, inDestruction, initTemplate, insertActionGroup, insertActionGroup, insertAfter, insertBefore, isAncestor, isDrawable, isFocus, isSensitive, isVisible, keynavFailed, listMnemonicLabels, map, measure, mnemonicActivate, observeChildren, observeControllers, onDestroy, onDirectionChanged, onHide, onKeynavFailed, onMap, onMnemonicActivate, onMoveFocus, onQueryTooltip, onRealize, onShow, onStateFlagsChanged, onUnmap, onUnrealize, pick, queueAllocate, queueDraw, queueResize, realize, removeController, removeCssClass, removeCssClass, removeMnemonicLabel, removeTickCallback, setCanFocus, setCanTarget, setChildVisible, setCssClasses, setCursor, setCursorFromName, setCursorFromName, setDefaultDirection, setDirection, setFocusable, setFocusChild, setFocusOnClick, setFontMap, setFontOptions, setHalign, setHasTooltip, setHexpand, setHexpandSet, setLayoutManager, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setName, setName, setOpacity, setOverflow, setParent, setReceivesDefault, setSensitive, setSizeRequest, setStateFlags, setTooltipMarkup, setTooltipMarkup, setTooltipText, setTooltipText, setValign, setVexpand, setVexpandSet, setVisible, shouldLayout, show, sizeAllocate, snapshotChild, triggerTooltipQuery, unmap, unparent, unrealize, unsetStateFlags
Methods inherited from class ch.bailu.gtk.gobject.Object
addToggleRef, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, disconnect, disconnect, dupData, dupData, dupQdata, forceFloating, freezeNotify, get, get, getData, getData, getProperty, getProperty, getQdata, interfaceFindProperty, interfaceInstallProperty, isFloating, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, replaceData, replaceData, replaceQdata, runDispose, set, set, setData, setData, setDataFull, setDataFull, setProperty, setProperty, setQdata, setQdataFull, stealData, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref
Methods inherited from class ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Methods inherited from class ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Field Details
-
SIGNAL_ON_PAGE_CHANGED
- See Also:
-
-
Constructor Details
-
Carousel
-
Carousel
public Carousel()Creates a new `AdwCarousel`.
-
-
Method Details
-
getClassHandler
-
append
Appends @child to @self.- Parameters:
child
- a widget to add
-
getAllowLongSwipes
public boolean getAllowLongSwipes()Gets whether to allow swiping for more than one page at a time.- Returns:
- `TRUE` if long swipes are allowed
-
getAllowMouseDrag
public boolean getAllowMouseDrag()Sets whether @self can be dragged with mouse pointer.- Returns:
- whether @self can be dragged with mouse pointer
-
getAllowScrollWheel
public boolean getAllowScrollWheel()Gets whether @self will respond to scroll wheel events.- Returns:
- `TRUE` if @self will respond to scroll wheel events
-
getInteractive
public boolean getInteractive()Gets whether @self can be navigated.- Returns:
- whether @self can be navigated
-
getNPages
public int getNPages()Gets the number of pages in @self.- Returns:
- the number of pages in @self
-
getNthPage
Gets the page at position @n.- Parameters:
n
- index of the page- Returns:
- the page
-
getPosition
public double getPosition()Gets current scroll position in @self, unitless.
1 matches 1 page. Use [method@Carousel.scroll_to] for changing it.- Returns:
- the scroll position
-
getRevealDuration
public int getRevealDuration()Gets the page reveal duration, in milliseconds.- Returns:
- the duration
-
getScrollParams
Gets the scroll animation spring parameters for @self.- Returns:
- the animation parameters
-
getSpacing
public int getSpacing()Gets spacing between pages in pixels.- Returns:
- spacing between pages
-
insert
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.- Parameters:
child
- a widget to addposition
- the position to insert @child at
-
prepend
Prepends @child to @self.- Parameters:
child
- a widget to add
-
remove
Removes @child from @self.- Parameters:
child
- a widget to remove
-
reorder
Moves @child into position @position.
If position is -1, or larger than the number of pages, @child will be moved
at the end.- Parameters:
child
- a widget to addposition
- the position to move @child to
-
scrollTo
Scrolls to @widget.
If @animate is `TRUE`, the transition will be animated.- Parameters:
widget
- a child of @selfanimate
- whether to animate the transition
-
setAllowLongSwipes
public void setAllowLongSwipes(boolean 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.- Parameters:
allow_long_swipes
- whether to allow long swipes
-
setAllowMouseDrag
public void setAllowMouseDrag(boolean allow_mouse_drag) Sets whether @self can be dragged with mouse pointer.
If @allow_mouse_drag is `FALSE`, dragging is only available on touch.- Parameters:
allow_mouse_drag
- whether @self can be dragged with mouse pointer
-
setAllowScrollWheel
public void setAllowScrollWheel(boolean allow_scroll_wheel) Sets whether @self will respond to scroll wheel events.
If @allow_scroll_wheel is `FALSE`, wheel events will be ignored.- Parameters:
allow_scroll_wheel
- whether @self will respond to scroll wheel events
-
setInteractive
public void setInteractive(boolean 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.- Parameters:
interactive
- whether @self can be navigated
-
setRevealDuration
public void setRevealDuration(int reveal_duration) Sets the page reveal duration, in milliseconds.
Reveal duration is used when animating adding or removing pages.- Parameters:
reveal_duration
- the new reveal duration value
-
setScrollParams
Sets the scroll animation spring parameters for @self.
The default value is equivalent to:
```c
adw_spring_params_new (1, 0.5, 500)
```- Parameters:
params
- the new parameters
-
setSpacing
public void setSpacing(int spacing) Sets spacing between pages in pixels.- Parameters:
spacing
- the new spacing value
-
onPageChanged
Connect to signal "page-changed".
SeeCarousel.OnPageChanged.onPageChanged(int)
for signal description.
FieldSIGNAL_ON_PAGE_CHANGED
contains original signal name and can be used as resource reference.- Parameters:
signal
- callback function (lambda).- Returns:
SignalHandler
. Can be used to disconnect signal and to release callback function.
-
asSwipeable
Implements interfaceSwipeable
. Call this to get access to interface functions.- Returns:
Swipeable
-
asAccessible
Implements interfaceAccessible
. Call this to get access to interface functions.- Overrides:
asAccessible
in classWidget
- Returns:
Accessible
-
asBuildable
Implements interfaceBuildable
. Call this to get access to interface functions.- Overrides:
asBuildable
in classWidget
- Returns:
Buildable
-
asConstraintTarget
Implements interfaceConstraintTarget
. Call this to get access to interface functions.- Overrides:
asConstraintTarget
in classWidget
- Returns:
ConstraintTarget
-
asOrientable
Implements interfaceOrientable
. Call this to get access to interface functions.- Returns:
Orientable
-
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-