Wt
3.2.3
|
An abstract widget that can receive user-interface interaction. More...
#include <Wt/WInteractWidget>
Public Member Functions | |
WInteractWidget (WContainerWidget *parent=0) | |
Create an InteractWidget with optional parent. | |
EventSignal< WKeyEvent > & | keyWentDown () |
Event signal emitted when a keyboard key is pushed down. | |
EventSignal< WKeyEvent > & | keyPressed () |
Event signal emitted when a "character" was entered. | |
EventSignal< WKeyEvent > & | keyWentUp () |
Event signal emitted when a keyboard key is released. | |
EventSignal & | enterPressed () |
Event signal emitted when enter was pressed. | |
EventSignal & | escapePressed () |
Event signal emitted when escape was pressed. | |
EventSignal< WMouseEvent > & | clicked () |
Event signal emitted when a mouse key was clicked on this widget. | |
EventSignal< WMouseEvent > & | doubleClicked () |
Event signal emitted when a mouse key was double clicked on this widget. | |
EventSignal< WMouseEvent > & | mouseWentDown () |
Event signal emitted when a mouse key was pushed down on this widget. | |
EventSignal< WMouseEvent > & | mouseWentUp () |
Event signal emitted when a mouse key was released on this widget. | |
EventSignal< WMouseEvent > & | mouseWentOut () |
Event signal emitted when the mouse went out of this widget. | |
EventSignal< WMouseEvent > & | mouseWentOver () |
Event signal emitted when the mouse entered this widget. | |
EventSignal< WMouseEvent > & | mouseMoved () |
Event signal emitted when the mouse moved over this widget. | |
EventSignal< WMouseEvent > & | mouseDragged () |
Event signal emitted when the mouse is dragged over this widget. | |
EventSignal< WMouseEvent > & | mouseWheel () |
Event signal emitted when the mouse scroll wheel was used. | |
EventSignal< WTouchEvent > & | touchStarted () |
Event signal emitted when a finger is placed on the screen. | |
EventSignal< WTouchEvent > & | touchEnded () |
Event signal emitted when a finger is removed from the screen. | |
EventSignal< WTouchEvent > & | touchMoved () |
Event signal emitted when a finger, which is already placed on the screen, is moved across the screen. | |
EventSignal< WGestureEvent > & | gestureStarted () |
Event signal emitted when a gesture is started. | |
EventSignal< WGestureEvent > & | gestureChanged () |
Event signal emitted when a gesture is changed. | |
EventSignal< WGestureEvent > & | gestureEnded () |
Event signal emitted when a gesture is ended. | |
void | setDraggable (const std::string &mimeType, WWidget *dragWidget=0, bool isDragWidgetOnly=false, WObject *sourceWidget=0) |
Configure dragging for drag and drop. | |
void | setMouseOverDelay (int delay) |
Sets a delay for the mouse over event. | |
int | mouseOverDelay () const |
Returns the mouse over signal delay. | |
virtual void | load () |
Loads content just before the widget is used. | |
virtual bool | isEnabled () const |
Returns whether the widget is enabled. | |
Protected Member Functions | |
virtual void | propagateSetEnabled (bool enabled) |
Propagates that a widget was enabled or disabled through children. |
An abstract widget that can receive user-interface interaction.
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).
Styling through CSS is not applicable.
EventSignal< WMouseEvent > & Wt::WInteractWidget::clicked | ( | ) |
Event signal emitted when a mouse key was clicked on this widget.
The event details contains information such as the button, optional keyboard modifiers, and mouse coordinates relative to the widget, the window window, or the document.
EventSignal< WMouseEvent > & Wt::WInteractWidget::doubleClicked | ( | ) |
Event signal emitted when a mouse key was double clicked on this widget.
The event details contains information such as the button, optional keyboard modifiers, and mouse coordinates relative to the widget, the window window, or the document.
EventSignal & Wt::WInteractWidget::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()
EventSignal & Wt::WInteractWidget::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()
EventSignal< WGestureEvent > & Wt::WInteractWidget::gestureChanged | ( | ) |
EventSignal< WGestureEvent > & Wt::WInteractWidget::gestureEnded | ( | ) |
EventSignal< WGestureEvent > & Wt::WInteractWidget::gestureStarted | ( | ) |
bool Wt::WInteractWidget::isEnabled | ( | ) | const [virtual] |
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.
Reimplemented from Wt::WWebWidget.
EventSignal< WKeyEvent > & Wt::WInteractWidget::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()
EventSignal< WKeyEvent > & Wt::WInteractWidget::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()
EventSignal< WKeyEvent > & Wt::WInteractWidget::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()
void Wt::WInteractWidget::load | ( | ) | [virtual] |
Loads content just before the widget is used.
When the widget is inserted in the widget hierarchy, this method is called. 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 initializiation only once.
Reimplemented from Wt::WWebWidget.
EventSignal< WMouseEvent > & Wt::WInteractWidget::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.
EventSignal< WMouseEvent > & Wt::WInteractWidget::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.
int Wt::WInteractWidget::mouseOverDelay | ( | ) | const |
Returns the mouse over signal delay.
EventSignal< WMouseEvent > & Wt::WInteractWidget::mouseWentDown | ( | ) |
Event signal emitted when a mouse key was pushed down on this widget.
The event details contains information such as the button, optional keyboard modifiers, and mouse coordinates relative to the widget, the window window, or the document.
EventSignal< WMouseEvent > & Wt::WInteractWidget::mouseWentOut | ( | ) |
Event signal emitted when the mouse went out of this widget.
EventSignal< WMouseEvent > & Wt::WInteractWidget::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()
EventSignal< WMouseEvent > & Wt::WInteractWidget::mouseWentUp | ( | ) |
Event signal emitted when a mouse key was released on this widget.
The event details contains information such as the button, optional keyboard modifiers, and mouse coordinates relative to the widget, the window window, or the document.
EventSignal< WMouseEvent > & Wt::WInteractWidget::mouseWheel | ( | ) |
Event signal emitted when the mouse scroll wheel was used.
The event details contains information such as the wheel delta, optional keyboard modifiers, and mouse coordinates relative to the widget, the window window, or the document.
void Wt::WInteractWidget::propagateSetEnabled | ( | bool | enabled | ) | [protected, virtual] |
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.
Reimplemented from Wt::WWebWidget.
Reimplemented in Wt::WFormWidget, Wt::WLabel, and Wt::WGroupBox.
void Wt::WInteractWidget::setDraggable | ( | const std::string & | mimeType, |
WWidget * | dragWidget = 0 , |
||
bool | isDragWidgetOnly = false , |
||
WObject * | sourceWidget = 0 |
||
) |
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 a dragWidget
whose function is only to represent the drag visually (when isDragWidgetOnly
= true
).
The widget to be identified as source in the dropEvent may be given explicitly, and will default to this widget otherwise.
void Wt::WInteractWidget::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.
EventSignal< WTouchEvent > & Wt::WInteractWidget::touchEnded | ( | ) |
Event signal emitted when a finger is removed from the screen.
The event details contains information such as the touches, target touches and changed touches.
EventSignal< WTouchEvent > & Wt::WInteractWidget::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 touches, target touches and changed touches.
EventSignal< WTouchEvent > & Wt::WInteractWidget::touchStarted | ( | ) |
Event signal emitted when a finger is placed on the screen.
The event details contains information such as the touches, target touches and changed touches.