Class Carousel
- All Implemented Interfaces:
Proxy
,Swipeable
,Accessible
,Buildable
,ConstraintTarget
,Orientable
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
.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Carousel.Builder<B extends Carousel.Builder<B>>
Inner class implementing a builder pattern to construct a GObject with properties.static class
static interface
Functional interface declaration of thePageChangedCallback
callback.Nested classes/interfaces inherited from class org.gnome.gtk.Widget
Widget.DestroyCallback, Widget.DirectionChangedCallback, Widget.HideCallback, Widget.KeynavFailedCallback, Widget.MapCallback, Widget.MnemonicActivateCallback, Widget.MoveFocusCallback, Widget.QueryTooltipCallback, Widget.RealizeCallback, Widget.ShowCallback, Widget.StateFlagsChangedCallback, Widget.UnmapCallback, Widget.UnrealizeCallback, Widget.WidgetClass, Widget.WidgetImpl
Nested classes/interfaces inherited from class org.gnome.gobject.InitiallyUnowned
InitiallyUnowned.InitiallyUnownedClass
Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
Nested classes/interfaces inherited from interface org.gnome.gtk.Accessible
Accessible.AccessibleImpl, Accessible.AccessibleInterface
Nested classes/interfaces inherited from interface org.gnome.gtk.Buildable
Buildable.BuildableIface, Buildable.BuildableImpl
Nested classes/interfaces inherited from interface org.gnome.gtk.ConstraintTarget
ConstraintTarget.ConstraintTargetImpl, ConstraintTarget.ConstraintTargetInterface
Nested classes/interfaces inherited from interface org.gnome.gtk.Orientable
Orientable.OrientableIface, Orientable.OrientableImpl
Nested classes/interfaces inherited from interface org.gnome.adw.Swipeable
Swipeable.SwipeableImpl, Swipeable.SwipeableInterface
-
Constructor Summary
ConstructorDescriptionCarousel()
Creates a newAdwCarousel
.Carousel
(MemorySegment address) Create a Carousel proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Appendschild
to this Carousel.protected Carousel
asParent()
Returns this instance as if it were its parent type.static Carousel.Builder
<? extends Carousel.Builder> builder()
ACarousel.Builder
object constructs aCarousel
with the specified properties.void
emitPageChanged
(int index) Emits the "page-changed" signal.boolean
Gets whether to allow swiping for more than one page at a time.boolean
Sets whether this Carousel can be dragged with mouse pointer.boolean
Gets whether this Carousel will respond to scroll wheel events.boolean
Gets whether this Carousel can be navigated.int
Gets the number of pages in this Carousel.getNthPage
(int n) Gets the page at positionn
.double
Gets current scroll position in this Carousel, unitless.int
Gets the page reveal duration, in milliseconds.Gets the scroll animation spring parameters for this Carousel.int
Gets spacing between pages in pixels.static Type
getType()
Get the GType of the Carousel classvoid
Insertschild
into this Carousel at positionposition
.This signal is emitted after a page has been changed.void
Prependschild
to this Carousel.void
Removeschild
from this Carousel.void
Moveschild
into positionposition
.void
Scrolls towidget
.void
setAllowLongSwipes
(boolean allowLongSwipes) Sets whether to allow swiping for more than one page at a time.void
setAllowMouseDrag
(boolean allowMouseDrag) Sets whether this Carousel can be dragged with mouse pointer.void
setAllowScrollWheel
(boolean allowScrollWheel) Sets whether this Carousel will respond to scroll wheel events.void
setInteractive
(boolean interactive) Sets whether this Carousel can be navigated.void
setRevealDuration
(int revealDuration) Sets the page reveal duration, in milliseconds.void
setScrollParams
(SpringParams params) Sets the scroll animation spring parameters for this Carousel.void
setSpacing
(int spacing) Sets spacing between pages in pixels.Methods inherited from class org.gnome.gtk.Widget
actionSetEnabled, activateActionIfExists, activateDefault, activateWidget, addController, addCssClass, addMnemonicLabel, addTickCallback, allocate, childFocus, computeBounds, computeExpand, computeExpand, computePoint, computeTransform, contains, createPangoContext, createPangoLayout, cssChanged, directionChanged, disposeTemplate, dragCheckThreshold, emitDestroy, emitDirectionChanged, emitHide, emitKeynavFailed, emitMap, emitMnemonicActivate, emitMoveFocus, emitQueryTooltip, emitRealize, emitShow, emitStateFlagsChanged, emitUnmap, emitUnrealize, errorBell, focus, getAllocatedBaseline, getAllocatedHeight, getAllocatedWidth, getAllocation, getAncestor, getBaseline, getCanFocus, getCanTarget, getChildVisible, getClipboard, getColor, 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, getMemoryLayout, getName, getNative, getNextSibling, getOpacity, getOverflow, getPangoContext, getParent, getPreferredSize, getPrevSibling, getPrimaryClipboard, getRealized, getReceivesDefault, getRequestMode, getRoot, getScaleFactor, getSensitive, getSettings, getSize, getSizeRequest, getStateFlags, getStyleContext, getTemplateChild, getTooltipMarkup, getTooltipText, getValign, getVexpand, getVexpandSet, getVisible, getWidth, grabFocus, hasCssClass, hasDefault, hasFocus, hasVisibleFocus, hide, inDestruction, initTemplate, insertActionGroup, insertAfter, insertBefore, isAncestor, isDrawable, isFocus, isSensitive, isVisible, keynavFailed, listMnemonicLabels, map, measure, mnemonicActivate, moveFocus, observeChildren, observeControllers, onDestroy, onDirectionChanged, onHide, onKeynavFailed, onMap, onMnemonicActivate, onMoveFocus, onQueryTooltip, onRealize, onShow, onStateFlagsChanged, onUnmap, onUnrealize, pick, pick, queryTooltip, queueAllocate, queueDraw, queueResize, realize, removeController, removeCssClass, removeMnemonicLabel, removeTickCallback, root, setCanFocus, setCanTarget, setChildVisible, setCssClasses, setCursor, setCursorFromName, setDefaultDirection, setDirection, setFocusable, setFocusChild, setFocusOnClick, setFontMap, setFontOptions, setHalign, setHasTooltip, setHexpand, setHexpandSet, setLayoutManager, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setName, setOpacity, setOverflow, setParent, setReceivesDefault, setSensitive, setSizeRequest, setStateFlags, setStateFlags, setTooltipMarkup, setTooltipText, setValign, setVexpand, setVexpandSet, setVisible, shouldLayout, show, sizeAllocate, sizeAllocate, snapshot, snapshotChild, stateFlagsChanged, systemSettingChanged, translateCoordinates, triggerTooltipQuery, unmap, unparent, unrealize, unroot, unsetStateFlags, unsetStateFlags
Methods inherited from class org.gnome.gobject.GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newInstance, newInstance, newv, notify_, notify_, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withProperties
Methods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, getPrivate, readGClass, writeGClass
Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.gnome.gtk.Accessible
announce, getAccessibleParent, getAccessibleRole, getAtContext, getBounds, getFirstAccessibleChild, getNextAccessibleSibling, getPlatformState, resetProperty, resetRelation, resetState, setAccessibleParent, updateNextAccessibleSibling, updateProperty, updateRelation, updateState
Methods inherited from interface org.gnome.gtk.Buildable
getBuildableId
Methods inherited from interface org.gnome.gtk.Orientable
getOrientation, setOrientation
Methods inherited from interface org.gnome.adw.Swipeable
getCancelProgress, getDistance, getProgress, getSnapPoints, getSwipeArea
-
Constructor Details
-
Carousel
Create a Carousel proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
Carousel
public Carousel()Creates a newAdwCarousel
.
-
-
Method Details
-
getType
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuper
keyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()
doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName()
. This will call the native function pointer of this virtual method in the typeclass of the parent type. -
append
Appendschild
to this Carousel.- 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 this Carousel can be dragged with mouse pointer.- Returns:
- whether this Carousel can be dragged with mouse pointer
-
getAllowScrollWheel
public boolean getAllowScrollWheel()Gets whether this Carousel will respond to scroll wheel events.- Returns:
TRUE
if this Carousel will respond to scroll wheel events
-
getInteractive
public boolean getInteractive()Gets whether this Carousel can be navigated.- Returns:
- whether this Carousel can be navigated
-
getNPages
public int getNPages()Gets the number of pages in this Carousel.- Returns:
- the number of pages in this Carousel
-
getNthPage
Gets the page at positionn
.- Parameters:
n
- index of the page- Returns:
- the page
-
getPosition
public double getPosition()Gets current scroll position in this Carousel, unitless.1 matches 1 page. Use
scrollTo(org.gnome.gtk.Widget, boolean)
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 this Carousel.- Returns:
- the animation parameters
-
getSpacing
public int getSpacing()Gets spacing between pages in pixels.- Returns:
- spacing between pages
-
insert
Insertschild
into this Carousel at positionposition
.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 insertchild
at
-
prepend
Prependschild
to this Carousel.- Parameters:
child
- a widget to add
-
remove
Removeschild
from this Carousel.- Parameters:
child
- a widget to remove
-
reorder
Moveschild
into positionposition
.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 movechild
to
-
scrollTo
Scrolls towidget
.If
animate
isTRUE
, the transition will be animated.- Parameters:
widget
- a child of this Carouselanimate
- whether to animate the transition
-
setAllowLongSwipes
public void setAllowLongSwipes(boolean allowLongSwipes) Sets whether to allow swiping for more than one page at a time.If
allowLongSwipes
isFALSE
, each swipe can only move to the adjacent pages.- Parameters:
allowLongSwipes
- whether to allow long swipes
-
setAllowMouseDrag
public void setAllowMouseDrag(boolean allowMouseDrag) Sets whether this Carousel can be dragged with mouse pointer.If
allowMouseDrag
isFALSE
, dragging is only available on touch.- Parameters:
allowMouseDrag
- whether this Carousel can be dragged with mouse pointer
-
setAllowScrollWheel
public void setAllowScrollWheel(boolean allowScrollWheel) Sets whether this Carousel will respond to scroll wheel events.If
allowScrollWheel
isFALSE
, wheel events will be ignored.- Parameters:
allowScrollWheel
- whether this Carousel will respond to scroll wheel events
-
setInteractive
public void setInteractive(boolean interactive) Sets whether this Carousel can be navigated.This can be used to temporarily disable the carousel to only allow navigating it in a certain state.
- Parameters:
interactive
- whether this Carousel can be navigated
-
setRevealDuration
public void setRevealDuration(int revealDuration) Sets the page reveal duration, in milliseconds.Reveal duration is used when animating adding or removing pages.
- Parameters:
revealDuration
- the new reveal duration value
-
setScrollParams
Sets the scroll animation spring parameters for this Carousel.The default value is equivalent to:
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
public SignalConnection<Carousel.PageChangedCallback> onPageChanged(Carousel.PageChangedCallback handler) 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
.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitPageChanged
public void emitPageChanged(int index) Emits the "page-changed" signal. SeeonPageChanged(org.gnome.adw.Carousel.PageChangedCallback)
. -
builder
ACarousel.Builder
object constructs aCarousel
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withCarousel.Builder.build()
.
-