Class clove::MainView

class clove::MainView : public clove::Widget

A typical main view, including a clove::Toolbar and a container for an inner body widget.

Public Functions

sidebar()

The sidebar widget as widget configuration like for clove::build().

setSidebar(value)

Setter for sidebar().

Parameters
  • value: The new value.

bodyLeft()

The left inner widget as widget configuration like for clove::build().

setBodyLeft(value)

Setter for bodyLeft().

Parameters
  • value: The new value.

bodyRight()

The right inner widget as widget configuration like for clove::build().

setBodyRight(value)

Setter for bodyRight().

Parameters
  • value: The new value.

bodyLeftViewActionLabel()

The title string for the left inner widget.

setBodyLeftViewActionLabel(value)

Setter for bodyLeftViewActionLabel().

Parameters
  • value: The new value.

bodyRightViewActionLabel()

The title string for the right inner widget.

setBodyRightViewActionLabel(value)

Setter for bodyRightViewActionLabel().

Parameters
  • value: The new value.

splitterPosition()

The position of the splitter between the left and right inner widget as number between 0.0 and 1.0.

setSplitterPosition(value)

Setter for splitterPosition().

Parameters
  • value: The new value.

switchToRightBody()

If in small mode, it switches the view to the right body.

switchToLeftBody()

If in small mode, it switches the view to the left body.

head1()

The 1st header text.

setHead1(value)

Setter for head1().

Parameters
  • value: The new value.

head2()

The 2nd header text.

setHead2(value)

Setter for head2().

Parameters
  • value: The new value.

headControl()

An optional widget for arbitrary control purposes as widget configuration like for clove::build(). It’s displayed below the menu bar in full width.

setHeadControl(value)

Setter for headControl().

Parameters
  • value: The new value.

headControlWidget()

Returns the control widget as clove::Widget (or undefined if no headControl() is set).

icon()

The header icon as clove::Icon.

setIcon(value)

Setter for icon().

Parameters
  • value: The new value.

actions()

Menu actions.

See clove::Menubar::actions().

setActions(value)

Setter for actions().

Parameters
  • value: The new value.

showOnly()

Specifies if to forcefully show just one of the two main panels (0, 1, undefined).

setShowOnly(value)

Setter for showOnly().

Parameters
  • value: The new value.

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’) andx.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

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.