Wt  3.3.9
Namespaces | Classes | Enumerations
Signal/slot system

Support for event handling using signals and slots. More...

Namespaces

 Wt::Signals
 Namespace for signal/slot implementation.
 

Classes

class  Wt::SignalBase
 Abstract base class of a signal. More...
 
class  Wt::EventSignalBase
 Abstract base class of an event signal. More...
 
class  Wt::WMouseEvent
 A class providing details for a mouse event. More...
 
class  Wt::WKeyEvent
 A class providing details for a keyboard event. More...
 
class  Wt::WDropEvent
 A class providing details for a drop event. More...
 
class  Wt::WScrollEvent
 A class providing details for a scroll event. More...
 
class  Wt::WTouchEvent
 A class providing details for a touch event. More...
 
class  Wt::WGestureEvent
 A class providing details for a gesture event. More...
 
class  Wt::JSignal< A1, A2, A3, A4, A5, A6 >
 A signal to relay JavaScript to C++ calls. More...
 
class  Wt::JSlot
 A slot that is only implemented in client side JavaScript code. More...
 
class  Wt::WObject
 A base class for objects that participate in the signal/slot system. More...
 
class  Wt::Signal< A1, A2, A3, A4, A5, A6 >
 A signal that propagates events to listeners. More...
 
class  Wt::EventSignal< E >
 A signal that conveys user-interface events. More...
 
class  Wt::WSignalMapper< T, A1 >
 A utility class to connect multiple senders to a single slot. More...
 

Enumerations

Detailed Description

Support for event handling using signals and slots.

To respond to user-interactivity events, or in general to communicate events from one widget to any other, Wt uses a signal/slot system.

A slot is any method of any descendant of WObject. To connect a signal with a slot, the only requirement is that the method signature of the slot must be compatible with the signal definition. In this way every method may be used as a slot, and it is not necessary to explicitly indicate a particular method to be a slot (as is needed in Qt), by putting them in a special section. Nevertheless, you may still do that if you wish to emphasize that these functions can be used as slots, or, if you have done extra work to optimize the implementation of these methods as client-side JavaScript code (see below).

A signal may be created by adding a Signal<X, ...> object to your class. You may specify up to 6 arguments which may be of arbitrary types that are Copyable, that may be passed through the signal to connected slots.

The library defines several user-event signals on various widgets, and it is easy and convenient to add signals and slots to widget classes to communicate events and trigger callbacks.

Event signals (EventSignal<E>) are signals that may be triggered internally by the library to respond to user interactivity events. The abstract base classes WInteractWidget and WFormWidget define most of these event signals. To react to one of these events, the programmer connects a self-defined or already existing slot to such a signal.

To connect a signal from multiple senders to a single slot, we recommend the use of boost::bind() to identify the sender (or otherwise the intention) of the signal. The use of class WSignalMapper<T> is discouraged.

Usage example:

std::vector<Wt::WPushButton*> buttons = ...;
for(unsigned i = 0; i < buttons.size(); ++i) {
buttons[i]->clicked().connect(boost::bind(&Keyboard::handleClick, i));
}
void Keyboard::handleClick(int i) {
t->setText(WString("You pressed button {1}").args(i));
}

Enumeration Type Documentation

enum Wt::Key

Enumeration for key codes.

These are key codes that identify a key on a keyboard. All keys listed here can be identified across all browsers and (Western) keyboards. A Key is returned by WKeyEvent::key(). If you want to identify a character, you should use the WKeyEvent::charCode() method instead.

See also
WInteractWidget::keyWentDown, WInteractWidget::keyWentUp
Enumerator
Key_unknown 

Unknown key.

Key_Enter 

Enter key.

Key_Tab 

Tab key.

Key_Backspace 

Backspace key.

Key_Shift 

Shift key.

Key_Control 

Control key.

Key_Alt 

Alt key.

Key_PageUp 

Page up key.

Key_PageDown 

Page down key.

Key_End 

End key.

Key_Home 

Home key.

Key_Left 

Left arrow key.

Key_Up 

Up arrow key.

Key_Right 

Right arrow key.

Key_Down 

Down arrow key.

Key_Insert 

Insert key.

Key_Delete 

Delete key.

Key_Escape 

Escape key.

Key_F1 

F1 function key.

Key_F2 

F2 function key.

Key_F3 

F3 function key.

Key_F4 

F4 function key.

Key_F5 

F5 function key.

Key_F6 

F6 function key.

Key_F7 

F7 function key.

Key_F8 

F8 function key.

Key_F9 

F9 function key.

Key_F10 

F10 function key.

Key_F11 

F11 function key.

Key_F12 

F12 function key.

Key_Space 

Space.

Key_A 

'A' key

Key_B 

'B' key

Key_C 

'C' key

Key_D 

'D' key

Key_E 

'E' key

Key_F 

'F' key

Key_G 

'G' key

Key_H 

'H' key

Key_I 

'I' key

Key_J 

'J' key

Key_K 

'K' key

Key_L 

'L' key

Key_M 

'M' key

Key_N 

'N' key

Key_O 

'O' key

Key_P 

'P' key

Key_Q 

'Q' key

Key_R 

'R' key

Key_S 

'S' key

Key_T 

'T' key

Key_U 

'U' key

Key_V 

'V' key

Key_W 

'W' key

Key_X 

'X' key

Key_Y 

'Y' key

Key_Z 

'Z' key

Key_1 

'1' key

Key_2 

'2' key

Key_3 

'3' key

Key_4 

'4' key

Key_5 

'5' key

Key_6 

'6' key

Key_7 

'7' key

Key_8 

'8' key

Key_9 

'9' key

Key_0 

'0' key

Enumeration for keyboard modifiers.

See also
WMouseEvent::modifiers(), WKeyEvent::modifiers()
Enumerator
NoModifier 

No modifiers.

ShiftModifier 

Shift key pressed.

ControlModifier 

Control key pressed.

AltModifier 

Alt key pressed.

MetaModifier 

Meta key pressed ("Windows" or "Command" (Mac) key)


Generated on Tue Nov 21 2017 for the C++ Web Toolkit (Wt) by doxygen 1.8.11