Class WInteractWidget
- Direct Known Subclasses:
WAbstractMedia
,WContainerWidget
,WFormWidget
,WGLWidget
,WImage
,WLabel
,WPaintedWidget
,WProgressBar
,WTable
,WTemplate
,WText
This abstract widget provides access to event signals that correspond to user-interface interaction through mouse or keyboard.
When JavaScript is disabled, only the clicked()
event will
propagate (but without event details information).
CSS
Styling through CSS is not applicable.
-
Nested Class Summary
Nested classes/interfaces inherited from class eu.webtoolkit.jwt.WObject
WObject.FormData
-
Field Summary
-
Constructor Summary
ConstructorDescriptionCreate an InteractWidget.WInteractWidget
(WContainerWidget parentContainer) Create an InteractWidget. -
Method Summary
Modifier and TypeMethodDescriptionclicked()
Event signal emitted when the primary mouse button was clicked on this widget.Event signal emitted when the primary mouse button was double clicked on this widget.Event signal emitted when enter was pressed.Event signal emitted when escape was pressed.Event signal emitted when a gesture is changed.Event signal emitted when a gesture is ended.Event signal emitted when a gesture is started.int
Returns the mouse over signal delay.boolean
Returns whether the widget is enabled.Event signal emitted when a "character" was entered.Event signal emitted when a keyboard key is pushed down.Event signal emitted when a keyboard key is released.void
load()
Loads content just before the widget is used.Event signal emitted when the mouse is dragged over this widget.Event signal emitted when the mouse moved over this widget.Event signal emitted when a mouse button was pushed down on this widget.Event signal emitted when the mouse went out of this widget.Event signal emitted when the mouse entered this widget.Event signal emitted when a mouse button was released on this widget.Event signal emitted when the mouse scroll wheel was used.protected void
propagateSetEnabled
(boolean enabled) Propagates that a widget was enabled or disabled through children.void
remove()
Destructor.final void
setDraggable
(String mimeType) Configure dragging for drag and drop.final void
setDraggable
(String mimeType, WWidget dragWidget) Configure dragging for drag and drop.final void
setDraggable
(String mimeType, WWidget dragWidget, boolean isDragWidgetOnly) Configure dragging for drag and drop.void
setDraggable
(String mimeType, WWidget dragWidget, boolean isDragWidgetOnly, WObject sourceObject) Configure dragging for drag and drop.void
setMouseOverDelay
(int delay) Sets a delay for the mouse over event.void
setPopup
(boolean popup) Lets the widget overlay over other sibling widgets.Event signal emitted when a finger is removed from the screen.Event signal emitted when a finger, which is already placed on the screen, is moved across the screen.Event signal emitted when a finger is placed on the screen.void
Disable drag & drop for this widget.Methods inherited from class eu.webtoolkit.jwt.WWebWidget
addStyleClass, beingDeleted, blurred, callJavaScriptMember, childrenChanged, createDomElement, doJavaScript, enableAjax, escapeText, escapeText, escapeText, escapeText, find, findById, focussed, getAttributeValue, getBaseZIndex, getChildren, getClearSides, getDecorationStyle, getDomChanges, getFloatSide, getHeight, getHtmlTagName, getId, getJavaScriptMember, getLineHeight, getMargin, getMaximumHeight, getMaximumWidth, getMinimumHeight, getMinimumWidth, getOffset, getPositionScheme, getScrollVisibilityMargin, getStyleClass, getTabIndex, getToolTip, getVerticalAlignment, getVerticalAlignmentLength, getWidth, hasFocus, hasStyleClass, isCanReceiveFocus, isDisabled, isHidden, isHiddenKeepsGeometry, isInline, isLoaded, isPopup, isRendered, isScrollVisibilityEnabled, isScrollVisible, isSetFirstFocus, isThemeStyleEnabled, isVisible, iterateChildren, jsStringLiteral, jsStringLiteral, manageWidget, parentResized, parentResized, propagateSetVisible, refresh, removeScript, removeStyleClass, render, resize, scrollVisibilityChanged, setAttributeValue, setBaseZIndex, setCanReceiveFocus, setClearSides, setDecorationStyle, setDeferredToolTip, setDisabled, setFlexBox, setFloatSide, setFocus, setHidden, setHiddenKeepsGeometry, setHtmlTagName, setId, setInline, setJavaScriptMember, setLineHeight, setLoadLaterWhenInvisible, setMargin, setMaximumSize, setMinimumSize, setObjectName, setOffsets, setParentWidget, setPositionScheme, setScrollVisibilityEnabled, setScrollVisibilityMargin, setSelectable, setStyleClass, setTabIndex, setThemeStyleEnabled, setToolTip, setVerticalAlignment, unescapeText, updateSignalConnection, voidEventSignal, widgetAdded, widgetRemoved
Methods inherited from class eu.webtoolkit.jwt.WWidget
acceptDrops, acceptDrops, addCssRule, addCssRule, addJSignal, addStyleClass, animateHide, animateShow, boxBorder, boxPadding, createJavaScript, disable, dropEvent, enable, getDropTouch, getJsRef, getParent, hide, htmlText, isExposed, isGlobalWidget, isLayoutSizeAware, layoutSizeChanged, needsRerender, positionAt, positionAt, removeFromParent, removeStyleClass, removeWidget, render, resize, scheduleRender, scheduleRender, scheduleRender, setClearSides, setDeferredToolTip, setFocus, setHeight, setHidden, setLayoutSizeAware, setMargin, setMargin, setMargin, setMargin, setMargin, setOffsets, setOffsets, setOffsets, setOffsets, setOffsets, setToolTip, setVerticalAlignment, setWidth, show, stopAcceptDrops, toggleStyleClass, toggleStyleClass, tr
Methods inherited from class eu.webtoolkit.jwt.WObject
getObjectName, setFormData
-
Field Details
-
dragTouchSlot_
-
dragTouchEndSlot_
-
-
Constructor Details
-
WInteractWidget
Create an InteractWidget. -
WInteractWidget
public WInteractWidget()Create an InteractWidget.
-
-
Method Details
-
remove
public void remove()Description copied from class:WWidget
Destructor.Deletes a widget and all contained contents.
- Overrides:
remove
in classWWebWidget
- See Also:
-
keyWentDown
Event signal emitted when a keyboard key is pushed down.The keyWentDown signal is the first signal emitted when a key is pressed (before the keyPressed signal). Unlike
keyPressed()
however it is also emitted for modifier keys (such as "shift", "control", ...) or keyboard navigation keys that do not have a corresponding character.Form widgets (like
WLineEdit
) will receive key events when focussed. Other widgets will receive key events when they contain (directly or indirectly) a form widget that has focus.To capture a key down event when no element has focus, see
WApplication.globalKeyWentDown()
- See Also:
-
keyPressed
Event signal emitted when a "character" was entered.The keyPressed signal is emitted when a key is pressed, and a character is entered. Unlike
keyWentDown()
, it is emitted only for key presses that result in a character being entered, and thus not for modifier keys or keyboard navigation keys.Form widgets (like
WLineEdit
) will receive key events when focussed. Other widgets will receive key events when they contain (directly or indirectly) a form widget that has focus.To capture a key press when no element has focus, see
WApplication.globalKeyPressed()
- See Also:
-
keyWentUp
Event signal emitted when a keyboard key is released.This is the counter-part of the
keyWentDown()
event. Every key-down has its corresponding key-up.Form widgets (like
WLineEdit
) will receive key events when focussed. Other widgets will receive key events when they contain (directly or indirectly) a form widget that has focus.To capture a key up event when no element has focus, see
WApplication.globalKeyWentUp()
- See Also:
-
enterPressed
Event signal emitted when enter was pressed.This signal is emitted when the Enter or Return key was pressed.
Form widgets (like
WLineEdit
) will receive key events when focussed. Other widgets will receive key events when they contain (directly or indirectly) a form widget that has focus.To capture an enter press when no element has focus, see
WApplication.globalEnterPressed()
- See Also:
-
escapePressed
Event signal emitted when escape was pressed.This signal is emitted when the Escape key was pressed.
Form widgets (like
WLineEdit
) will receive key events when focussed. Other widgets will receive key events when they contain (directly or indirectly) a form widget that has focus.To capture an escape press when no element has focus, see
WApplication.globalEscapePressed()
- See Also:
-
clicked
Event signal emitted when the primary mouse button was clicked on this widget.The event details contains information such as the
WMouseEvent.getButton()
, optionalkeyboard modifiers
, and mouse coordinates relative to theWMouseEvent.getWidget()
, the windowWMouseEvent.getWindow()
, or theWMouseEvent.getDocument()
.For more details, see the MDN documentation.
Note: When JavaScript is disabled, the event details contain invalid information.
-
doubleClicked
Event signal emitted when the primary mouse button was double clicked on this widget.The event details contains information such as the
WMouseEvent.getButton()
, optionalkeyboard modifiers
, and mouse coordinates relative to theWMouseEvent.getWidget()
, the windowWMouseEvent.getWindow()
, or theWMouseEvent.getDocument()
.For more details, see the MDN documentation.
Note: When JavaScript is disabled, the signal will never fire.
-
mouseWentDown
Event signal emitted when a mouse button was pushed down on this widget.The event details contains information such as the
WMouseEvent.getButton()
, optionalkeyboard modifiers
, and mouse coordinates relative to theWMouseEvent.getWidget()
, the windowWMouseEvent.getWindow()
, or theWMouseEvent.getDocument()
.Note: When JavaScript is disabled, the signal will never fire.
-
mouseWentUp
Event signal emitted when a mouse button was released on this widget.The event details contains information such as the
WMouseEvent.getButton()
, optionalkeyboard modifiers
, and mouse coordinates relative to theWMouseEvent.getWidget()
, the windowWMouseEvent.getWindow()
, or theWMouseEvent.getDocument()
.If you connect also the
mouseWentDown()
signal, then a subsequentmouseWentUp()
will be received by the same widget, even if mouse is no longer over the original widget.Note: When JavaScript is disabled, the signal will never fire.
-
mouseWentOut
Event signal emitted when the mouse went out of this widget.Note: When JavaScript is disabled, the signal will never fire.
-
mouseWentOver
Event signal emitted when the mouse entered this widget.The signal is emitted as soon as the mouse enters the widget, or after some delay as configured by
setMouseOverDelay()
Note: When JavaScript is disabled, the signal will never fire.
-
mouseMoved
Event signal emitted when the mouse moved over this widget.The mouse event contains information on the button(s) currently pressed. If multiple buttons are currently pressed, only the button with smallest enum value is returned.
Note: When JavaScript is disabled, the signal will never fire.
-
mouseDragged
Event signal emitted when the mouse is dragged over this widget.The mouse event contains information on the button(s) currently pressed. If multiple buttons are currently pressed, only the button with smallest enum value is returned.
Note: When JavaScript is disabled, the signal will never fire.
-
mouseWheel
Event signal emitted when the mouse scroll wheel was used.The event details contains information such as the
wheel delta
, optionalkeyboard modifiers
, and mouse coordinates relative to theWMouseEvent.getWidget()
, the windowWMouseEvent.getWindow()
, or theWMouseEvent.getDocument()
.Note: When JavaScript is disabled, the signal will never fire.
-
touchStarted
Event signal emitted when a finger is placed on the screen.The event details contains information such as the
WTouchEvent.getTouches()
,target touches
andchanged touches
.Note: When JavaScript is disabled, the signal will never fire.
-
touchEnded
Event signal emitted when a finger is removed from the screen.The event details contains information such as the
WTouchEvent.getTouches()
,target touches
andchanged touches
.Note: When JavaScript is disabled, the signal will never fire.
-
touchMoved
Event signal emitted when a finger, which is already placed on the screen, is moved across the screen.The event details contains information such as the
WTouchEvent.getTouches()
,target touches
andchanged touches
.Note: When JavaScript is disabled, the signal will never fire.
-
gestureStarted
Event signal emitted when a gesture is started.The event details contains information about the
WGestureEvent.getScale()
and theWGestureEvent.getRotation()
.Note: When JavaScript is disabled, the signal will never fire.
-
gestureChanged
Event signal emitted when a gesture is changed.The event details contains information about the
WGestureEvent.getScale()
and theWGestureEvent.getRotation()
.Note: When JavaScript is disabled, the signal will never fire.
-
gestureEnded
Event signal emitted when a gesture is ended.The event details contains information about the
WGestureEvent.getScale()
and theWGestureEvent.getRotation()
.Note: When JavaScript is disabled, the signal will never fire.
-
setDraggable
public void setDraggable(String mimeType, WWidget dragWidget, boolean isDragWidgetOnly, WObject sourceObject) Configure dragging for drag and drop.Enable drag&drop for this widget. The mimeType is used to find a suitable drop target, which must accept dropping of this mimetype.
By default, the entire widget is dragged. One may specify another widget to be dragged (for example the parent as
dragWidget
) or adragWidget
whose function is only to represent the drag visually (whenisDragWidgetOnly
=true
).The widget to be identified as source in the dropEvent may be given explicitly, and will default to this widget otherwise.
When using a touch interface, the widget can also be dragged after a long press.
Note: When JavaScript is disabled, drag&drop does not work.
-
setDraggable
Configure dragging for drag and drop.Calls
setDraggable(mimeType, (WWidget)null, false, (WObject)null)
-
setDraggable
Configure dragging for drag and drop.Calls
setDraggable(mimeType, dragWidget, false, (WObject)null)
-
setDraggable
Configure dragging for drag and drop.Calls
setDraggable(mimeType, dragWidget, isDragWidgetOnly, (WObject)null)
-
unsetDraggable
public void unsetDraggable()Disable drag & drop for this widget. -
setMouseOverDelay
public void setMouseOverDelay(int delay) Sets a delay for the mouse over event.This sets a delay (in milliseconds) before the mouse over event is emitted.
The default value is 0.
- See Also:
-
getMouseOverDelay
public int getMouseOverDelay()Returns the mouse over signal delay.- See Also:
-
setPopup
public void setPopup(boolean popup) Description copied from class:WWidget
Lets the widget overlay over other sibling widgets.A widget that
isPopup()
will be rendered on top of any other sibling widget contained within the same parent (including other popup widgets previously added to the container).This will only have an effect when the widgetis either
PositionScheme.Absolute
orPositionScheme.Fixed
getPositionScheme()
.This applies to CSS-based layout, and configures the z-index property.
- Overrides:
setPopup
in classWWebWidget
-
load
public void load()Description copied from class:WWidget
Loads content just before the widget is used.This function is called when a widget is inserted in the widget hierarchy. Widgets that get inserted in the widget hierarchy will be rendered. Visible widgets are rendered immediately, and invisible widgets in the back-ground (or not for a plain HTML session). This method is called when the widget is directly or indirectly inserted into the widget tree.
The default implementation simply propagates the load signal to its children. You may want to override this method to delay loading of resource-intensive contents.
During the life-time of a widget, this method may be called multiple times, so you should make sure that you do a deferred initialization only once.
- Overrides:
load
in classWWebWidget
-
isEnabled
public boolean isEnabled()Description copied from class:WWidget
Returns whether the widget is enabled.A widget is enabled if it is not disabled, and none of its ancestors are disabled. This method returns whether the widget is rendered as enabled, while
isDisabled()
returns whether a widget has been explicitly disabled.Note that a widget may be at the same time not enabled, and not disabled, in case one of its ancestors was disabled.
- Overrides:
isEnabled
in classWWebWidget
- See Also:
-
propagateSetEnabled
protected void propagateSetEnabled(boolean enabled) Description copied from class:WWidget
Propagates that a widget was enabled or disabled through children.When enabling or disabling a widget, you usually also want to disable contained children. This method is called by
setDisabled()
to propagate its state to all children.You may want to reimplement this method if they wish to render differently when a widget is disabled. The default implementation will propagate the signal to all children.
- Overrides:
propagateSetEnabled
in classWWebWidget
-