Class clove::Carousel¶
-
class
clove
::
Carousel
: public clove::TabView A carousel container.
Something like a tab bar, but automatically switching forward tabs in regular intervals (and with a different style).
Public Functions
-
interval
() The tab switching interval (in milliseconds).
-
setInterval
(value) Setter for interval().
- Parameters
value
: The new value.
-
play
() Begins automatical tab switching.
-
pause
() Stops automatic tab switching.
-
isPlaying
() If automatic tab switching is enabled.
-
next
() Switches to the next tab.
-
tabs
() The list of tabs.
Each tab is a widget configuration, like for clove::build(), with some additional optional keys which holds infos like the tab header text. So, for example, one item in that list could be `{view:’Something’, …, tabLabel:’Tab1’}`. See also addTab().
-
setTabs
(value) Setter for tabs().
- Parameters
value
: The new value.
-
currentTab
() The index of the currently selected tab.
-
setCurrentTab
(value) Setter for currentTab().
- Parameters
value
: The new value.
-
userMayAddTabs
() If to show a button for adding new tabs.
If
true
, implement a handler for OnTabCreationRequested and create a tab with addTab() there.
-
setUserMayAddTabs
(value) Setter for userMayAddTabs().
- Parameters
value
: The new value.
-
tabBarLocation
() Where to place the tab bar.
Either
'top'
,'left'
,'bottom'
or'right'
.
-
setTabBarLocation
(value) Setter for tabBarLocation().
- Parameters
value
: The new value.
-
switchInvisibleAnimationName
() Optional animation name for switching away from a tab.
-
setSwitchInvisibleAnimationName
(value) Setter for switchInvisibleAnimationName().
- Parameters
value
: The new value.
-
switchVisibleAnimationName
() Optional animation name for switching to a tab.
-
setSwitchVisibleAnimationName
(value) Setter for switchVisibleAnimationName().
- Parameters
value
: The new value.
-
switchInvisibleAnimationDuration
() Optional animation duration (in msec) for the switch away animation.
-
setSwitchInvisibleAnimationDuration
(value) Setter for switchInvisibleAnimationDuration().
- Parameters
value
: The new value.
-
switchVisibleAnimationDuration
() Optional animation duration (in msec) for the switch animation.
-
setSwitchVisibleAnimationDuration
(value) Setter for switchVisibleAnimationDuration().
- Parameters
value
: The new value.
-
OnTabCreationRequested
Triggered when the user requested a new tab.
See also userMayAddTabs().
This is a clove.Event instance. See Manual for details.
-
addTab
(config) Adds a new tab.
The configuration may contain the following additional keys:
tabLabel
: The tab header text.tabIcon
: The tab icon as clove::Icon.tabMayBeClosedByUser
: If the user may close this tab.
This method returns a clove::Widget which can be used for getting subwidgets or removing the tab.
- Parameters
config
: A widget configuration like for clove::build().
-
declareProperty
(k, defaultV) Declares a widget property.
This is intended to be called only from inside the widget constructor.
Read the Manual about widget properties and custom widgets.
- Parameters
k
: The widget property name.defaultV
: The default value.
-
getProperty
(k) General-purpose getter for widget properties.
Typically used for handling properties, which do not directly belong to the widget class but which are helpers for external aspects (e.g. a row index for positioning in a grid).
The known ones have a dedicated getter and setter, i.e.
x.name()
for `x.getProperty(‘name’)and
x.setName(v)` respectively.Read the Manual about widget properties.
- Parameters
k
: The widget property name.
-
setProperty
(k, v) General-purpose setter for widget properties.
See getProperty().
- Parameters
k
: The widget property name.v
: The new value.
-
bindProperty
(k, vb) Binds a DataBinding to a property. Read Manual for details about data bindings.
- Parameters
k
: The widget property name.vb
: The clove.DataBinding to bind. May be ‘undefined’ for just unbinding.
-
init
(rootNameScope) Initializes the widget.
Never override this method in custom widgets. See doresize().
Intended for usage by the infrastructure; never call this method directly.
- Parameters
rootNameScope
: The root namescope to add this widget to.
-
doinit
() Executes late widget initialization (i.e. after properties are applied).
This is used for initialization steps which need the properties to be applied already. See also doinitEarly().
Override this method in custom widgets.
Intended for usage by the infrastructure; never call this method directly.
-
doinitEarly
() Executes early widget initialization (i.e. before properties are applied).
This is used for initialization steps which need to run before property values are applied. See also doinit().
Override this method in custom widgets.
Intended for usage by the infrastructure; never call this method directly.
-
resize
() Applies the new widget size to internal content.
Never override this method in custom widgets. See doresize().
This function is typically called from the parent widget when the size has been changed.
-
doresize
() Corrects alignments of internal elements according to the new widget size.
Override this method in custom widgets.
Never call this method directly. See resize().
-
relayout
() Notifies the parent widget that a new geometry is required.
This will eventually lead to a resizing according to clove::Widget::getPreferredWidth (et al).
This function is typically called from within the widget implementation when the content changed and from child widgets.
-
focus
() Sets the focus to this widget.
-
isAlive
() Checks if the widget is still alive (i.e. mounted somewhere in the dom tree).
-
computeMinimalWidth
() Computes the minimal width in pixel this widget needs to have.
Override this method for geometry measurement in custom widgets.
-
computePreferredWidth
() Computes the preferred width in pixel this widget needs to have.
Override this method for geometry measurement in custom widgets.
-
computeMinimalHeightForWidth
(w) Computes the minimal height in pixel this widget needs to have for a given width.
Override this method for geometry measurement in custom widgets.
- Parameters
w
: The width in pixel.
-
computePreferredHeightForWidth
(w) Computes the preferred height in pixel this widget needs to have for a given width.
Override this method for geometry measurement in custom widgets.
- Parameters
w
: The width in pixel.
-
getMinimalWidth
() Returns the minimal width in pixel this widget needs to have.
Do not override this method in custom widgets. This method caches geometry and does some other adjustments.
-
getPreferredWidth
() Returns the preferred width in pixel this widget needs to have.
Do not override this method in custom widgets. This method caches geometry and does some other adjustments.
-
getMinimalHeightForWidth
(w) Returns the minimal height in pixel this widget needs to have for a given width.
Do not override this method in custom widgets. This method caches geometry and does some other adjustments.
- Parameters
w
: The width in pixel.
-
getPreferredHeightForWidth
(w) Returns the preferred height in pixel this widget needs to have for a given width.
Do not override this method in custom widgets. This method caches geometry and does some other adjustments.
- Parameters
w
: The width in pixel.
-
addStyleClass
(clss) Adds the css class
clss
to this widget.- Parameters
clss
: A css class name.
-
removeStyleClass
(clss) Removes the css class
clss
from this widget.- Parameters
clss
: A css class name.
-
isStyleClass
(clss) Checks if this widget contains the css class
clss
.- Parameters
clss
: A css class name.
-
setStyleClassAssigned
(clss, assigned) Sets or unsets the css class
clss
to this widget.- Parameters
clss
: A css class name.assigned
: If to assign or unassign it.
-
containingNameScope
() The namescope this widget contains to.
-
nameScope
() The own namescope (or the namescope it contains to, if this widget does not bring a new one).
-
remove
(removeconfig) Removes this widget.
Note: This method does not guarantee to remove the widget synchronously, since there might be animations before.
Use clove::Widget::OnDestroyed for continuing after removal.
- Parameters
removeconfig
: The removal configuration (optional and only for exotic cases).
-
effectivelyEnabled
() If this widget is enabled and not marked as busy (i.e. can interact with the user).
This checks if the parent widgets are enabled and non-busy as well. See also enabled() and busy().
-
effectiveVisibility
() If this widget and all parent widgets are visible. See also visibility().
-
childrenWidgets
() List of the children clove::Widget instances.
-
parentWidget
() The parent clove::Widget.
-
name
() The name of the widget.
This name can be used for getting the widget instance later on. Read the Manual about namescopes for details.
-
setName
(value) Setter for name().
- Parameters
value
: The new value.
-
enabled
() If this widget is marked as enabled (i.e. can interact with the user).
This does not check the parents. See also effectivelyEnabled().
-
setEnabled
(value) Setter for enabled().
- Parameters
value
: The new value.
-
styleClass
() Custom css class(es).
-
setStyleClass
(value) Setter for styleClass().
- Parameters
value
: The new value.
-
style
() Custom css style string. You should not use that, but styleClass() instead.
-
setStyle
(value) Setter for style().
- Parameters
value
: The new value.
-
visibility
() If this widget is visible.
One of clove::Visible, clove::Invisible and clove::InvisibleCollapsed.
See also effectiveVisibility().
-
setVisibility
(value) Setter for visibility().
- Parameters
value
: The new value.
-
doStandaloneResizing
() If the widget handles to resize itself as needed.
This is only needed in exotic situations and by the infrastructure.
-
setDoStandaloneResizing
(value) Setter for doStandaloneResizing().
- Parameters
value
: The new value.
-
mayFocus
() If the widget can have the keyboard focus.
-
setMayFocus
(value) Setter for mayFocus().
- Parameters
value
: The new value.
-
horizontalStretchAffinity
() Numeric value >= 0 which specifies how much this widget would benefit from additional horizontal space.
-
setHorizontalStretchAffinity
(value) Setter for horizontalStretchAffinity().
- Parameters
value
: The new value.
-
verticalStretchAffinity
() Numeric value >= 0 which specifies how much this widget would benefit from additional vertical space.
-
setVerticalStretchAffinity
(value) Setter for verticalStretchAffinity().
- Parameters
value
: The new value.
-
strictHorizontalSizing
() If the widget is strictly forbidden to get additional horizontal space.
Otherwise there are situations where additional space is assigned even with
horizontalStretchAffinity()==0
.
-
setStrictHorizontalSizing
(value) Setter for strictHorizontalSizing().
- Parameters
value
: The new value.
-
strictVerticalSizing
() If the widget is strictly forbidden to get additional vertical space.
Otherwise there are situations where additional space is assigned even with
verticalStretchAffinity()==0
.
-
setStrictVerticalSizing
(value) Setter for strictVerticalSizing().
- Parameters
value
: The new value.
-
vstretch
() Alias for verticalStretchAffinity().
-
setVstretch
(value) Setter for vstretch().
- Parameters
value
: The new value.
-
hstretch
() Alias for horizontalStretchAffinity().
-
setHstretch
(value) Setter for hstretch().
- Parameters
value
: The new value.
-
busy
() If the widget is in busy state, typically resulting in a loading animation.
-
setBusy
(value) Setter for busy().
- Parameters
value
: The new value.
-
registerBusy
() Sets the widget to busy state and returns a token which helps returning to normal state.
See also unregisterBusy() and busy().
You must not mix this function with direct usage of setBusy()!
-
unregisterBusy
(token) Drops a token and returns to normal state if no other tokens exist.
- Parameters
token
: The token as returned by registerBusy().
-
hasFocus
() If the widget has the keyboard focus.
This also returns true if a child has focus.
-
innerSize
() Returns inner width and height of this widget.
-
outerSize
() Returns outer width and height of this widget.
-
OnDestroyed
Triggered when this widget was removed somehow.
This is a clove.Event instance. See Manual for details.
-
OnResized
Triggered when this widget was resized.
This is a clove.Event instance. See Manual for details.
-
OnVisibilityChanged
Triggered when the visibility of this widget changed.
Only direct changes trigger the event, not when the visibility of a predecessor changed.
This is a clove.Event instance. See Manual for details.
-
OnPropertyChanged
Triggered whenever a property of this widget changed its value.
Note: A few properties are only computed on-demand and don’t trigger this event.
This is a clove.Event instance. See Manual for details.
-
OnKeyDown
Triggered when a keyboard key went down.
This is a clove.Event instance. See Manual for details.
-
OnKeyUp
Triggered when a keyboard key came up.
This is a clove.Event instance. See Manual for details.
-
OnKeyPress
Triggered when a keyboard key was pressed.
Note that this event does not work for all keys in all browsers!
This is a clove.Event instance. See Manual for details.
-