Wt
4.11.1
|
Abstract base class for interactive areas in a widget. More...
#include <Wt/WAbstractArea.h>
Public Member Functions | |
virtual | ~WAbstractArea () |
Destructor. More... | |
void | setHole (bool hole) |
Specifies that this area specifies a hole for another area. More... | |
bool | isHole () const |
Returns whether this area specifies a hole. More... | |
void | setLink (const WLink &link) |
Sets a link. More... | |
WLink | link () const |
Returns the link. More... | |
void | setAlternateText (const WString &text) |
Sets an alternate text. More... | |
const WString | alternateText () const |
Returns the alternate text. More... | |
void | setToolTip (const WString &text) |
Sets the tooltip. More... | |
WString | toolTip () const |
Returns the tooltip text. More... | |
void | setStyleClass (const WString &styleClass) |
Defines a style class. More... | |
WString | styleClass () const |
Returns the style class. More... | |
void | addStyleClass (const WString &styleClass, bool force=false) |
Adds a style class. More... | |
void | removeStyleClass (const WString &styleClass, bool force=false) |
Removes a style class. | |
void | setCursor (Cursor cursor) |
Sets the cursor. More... | |
void | setCursor (std::string cursorImage, Cursor fallback=Cursor::Arrow) |
Sets a custom cursor image URL. More... | |
Cursor | cursor () const |
Returns the cursor. More... | |
EventSignal< WKeyEvent > & | keyWentDown () |
Event signal emitted when a keyboard key is pushed down. More... | |
EventSignal< WKeyEvent > & | keyPressed () |
Event signal emitted when a "character" was entered. More... | |
EventSignal< WKeyEvent > & | keyWentUp () |
Event signal emitted when a keyboard key is released. More... | |
EventSignal & | enterPressed () |
Event signal emitted when enter was pressed. More... | |
EventSignal & | escapePressed () |
Event signal emitted when escape was pressed. More... | |
EventSignal< WMouseEvent > & | clicked () |
Event signal emitted when a mouse key was clicked on this widget. More... | |
EventSignal< WMouseEvent > & | doubleClicked () |
Event signal emitted when a mouse key was double clicked on this widget. More... | |
EventSignal< WMouseEvent > & | mouseWentDown () |
Event signal emitted when a mouse key was pushed down on this widget. More... | |
EventSignal< WMouseEvent > & | mouseWentUp () |
Event signal emitted when a mouse key was released on this widget. More... | |
EventSignal< WMouseEvent > & | mouseWentOut () |
Event signal emitted when the mouse went out of this widget. More... | |
EventSignal< WMouseEvent > & | mouseWentOver () |
Event signal emitted when the mouse entered this widget. More... | |
EventSignal< WMouseEvent > & | mouseMoved () |
Event signal emitted when the mouse moved over this widget. More... | |
EventSignal< WMouseEvent > & | mouseDragged () |
Event signal emitted when the mouse is dragged over this widget. More... | |
EventSignal< WMouseEvent > & | mouseWheel () |
Event signal emitted when the mouse scroll wheel was used. More... | |
Public Member Functions inherited from Wt::WObject | |
void | addChild (std::unique_ptr< WObject > child) |
Add a child WObject whose lifetime is determined by this WObject. | |
template<typename Child > | |
Child * | addChild (std::unique_ptr< Child > child) |
Add a child WObject, returning a raw pointer. More... | |
std::unique_ptr< WObject > | removeChild (WObject *child) |
Remove a child WObject, so its lifetime is no longer determined by this WObject. | |
template<typename Child > | |
std::unique_ptr< Child > | removeChild (Child *child) |
Remove a child WObject, so its lifetime is no longer determined by this WObject. More... | |
virtual const std::string | id () const |
Returns the (unique) identifier for this object. More... | |
virtual void | setObjectName (const std::string &name) |
Sets an object name. More... | |
virtual std::string | objectName () const |
Returns the object name. More... | |
void | resetLearnedSlots () |
Resets learned stateless slot implementations. More... | |
template<class T > | |
void | resetLearnedSlot (void(T::*method)()) |
Resets a learned stateless slot implementation. More... | |
template<class T > | |
WStatelessSlot * | implementStateless (void(T::*method)()) |
Declares a slot to be stateless and learn client-side behaviour on first invocation. More... | |
template<class T > | |
WStatelessSlot * | implementStateless (void(T::*method)(), void(T::*undoMethod)()) |
Declares a slot to be stateless and learn client-side behaviour in advance. More... | |
void | isNotStateless () |
Marks the current function as not stateless. More... | |
template<class T > | |
WStatelessSlot * | implementJavaScript (void(T::*method)(), const std::string &jsCode) |
Provides a JavaScript implementation for a method. More... | |
Public Member Functions inherited from Wt::Core::observable | |
observable () noexcept | |
Default constructor. | |
virtual | ~observable () |
Destructor. More... | |
template<typename... Args, typename C > | |
auto | bindSafe (void(C::*method)(Args...)) noexcept |
Protects a method call against object destruction. More... | |
template<typename... Args, typename C > | |
auto | bindSafe (void(C::*method)(Args...) const) const noexcept |
Protects a const method call against object destruction. More... | |
template<typename Function > | |
auto | bindSafe (const Function &function) noexcept |
Protects a function against object destruction. More... | |
Additional Inherited Members | |
Public Types inherited from Wt::WObject | |
typedef void(WObject::* | Method) () |
Typedef for a WObject method without arguments. | |
Protected Member Functions inherited from Wt::WObject | |
virtual WStatelessSlot * | getStateless (Method method) |
On-demand stateless slot implementation. More... | |
Abstract base class for interactive areas in a widget.
Use an WAbstractArea (or rather, one of its concrete implementations), to define interactivity that applies on a part of a WImage or WPaintedWidget. The area may be defined using different shapes through WRectArea, WCircleArea or WPolygonArea.
|
virtual |
Destructor.
The area is automatically removed from the WImage or WPaintedWidget to which it was added.
void Wt::WAbstractArea::addStyleClass | ( | const WString & | styleClass, |
bool | force = false |
||
) |
Adds a style class.
const WString Wt::WAbstractArea::alternateText | ( | ) | const |
Returns the alternate text.
EventSignal< WMouseEvent > & Wt::WAbstractArea::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.
Cursor Wt::WAbstractArea::cursor | ( | ) | const |
Returns the cursor.
EventSignal< WMouseEvent > & Wt::WAbstractArea::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::WAbstractArea::enterPressed | ( | ) |
Event signal emitted when enter was pressed.
This signal is emitted when the Enter or Return key was pressed.
EventSignal & Wt::WAbstractArea::escapePressed | ( | ) |
Event signal emitted when escape was pressed.
This signal is emitted when the Escape key was pressed.
bool Wt::WAbstractArea::isHole | ( | ) | const |
Returns whether this area specifies a hole.
EventSignal< WKeyEvent > & Wt::WAbstractArea::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.
EventSignal< WKeyEvent > & Wt::WAbstractArea::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.
EventSignal< WKeyEvent > & Wt::WAbstractArea::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.
EventSignal< WMouseEvent > & Wt::WAbstractArea::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::WAbstractArea::mouseMoved | ( | ) |
Event signal emitted when the mouse moved over this widget.
EventSignal< WMouseEvent > & Wt::WAbstractArea::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::WAbstractArea::mouseWentOut | ( | ) |
Event signal emitted when the mouse went out of this widget.
EventSignal< WMouseEvent > & Wt::WAbstractArea::mouseWentOver | ( | ) |
Event signal emitted when the mouse entered this widget.
EventSignal< WMouseEvent > & Wt::WAbstractArea::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::WAbstractArea::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::WAbstractArea::setAlternateText | ( | const WString & | text | ) |
Sets an alternate text.
The alternate text should provide a fallback for browsers that do not display an image. If no sensible fallback text can be provided, an empty text is preferred over nonsense.
This should not be confused with toolTip() text, which provides additional information that is displayed when the mouse hovers over the area.
The default alternate text is an empty text ("").
void Wt::WAbstractArea::setCursor | ( | Cursor | cursor | ) |
Sets the cursor.
This sets the mouse cursor that is shown when the mouse pointer is over the area. Most browsers only support Cursor::PointingHand, which is activated by a non-empty ref.
void Wt::WAbstractArea::setCursor | ( | std::string | cursorImage, |
Cursor | fallback = Cursor::Arrow |
||
) |
Sets a custom cursor image URL.
The URL should point to a .cur file. For optimal portability, make sure that the .cur file is proparly constructed. A renamed .ico file will not work on Internet Explorer.
void Wt::WAbstractArea::setHole | ( | bool | hole | ) |
Specifies that this area specifies a hole for another area.
When set to true
, this area will define an area that does not provide interactivity. When it preceeds other, overlapping, areas, it acts as if it cuts a hole in those areas.
The default value is false
.
void Wt::WAbstractArea::setLink | ( | const WLink & | link | ) |
Sets a link.
By setting a link, the area behaves like a WAnchor.
By default, no destination link is set.
void Wt::WAbstractArea::setStyleClass | ( | const WString & | styleClass | ) |
Defines a style class.
void Wt::WAbstractArea::setToolTip | ( | const WString & | text | ) |
Sets the tooltip.
The tooltip is displayed when the cursor hovers over the area.
WString Wt::WAbstractArea::styleClass | ( | ) | const |
Returns the style class.
WString Wt::WAbstractArea::toolTip | ( | ) | const |
Returns the tooltip text.