Wt::EventSignal< E > Class Template Reference
[Signal/slot system]

A signal that conveys user-interface events. More...

#include <Wt/WSignal>

Inherits Wt::EventSignalBase.

List of all members.

Public Member Functions

virtual bool isConnected () const
 Returns whether the signal is connected.
template<class F >
boost::signals::connection connect (const F &function)
 Connects to a function.
template<class T , class V >
boost::signals::connection connect (T *target, void(V::*method)())
 Connects a slot that takes no arguments.
template<class T , class V >
boost::signals::connection connect (T *target, void(V::*method)(E))
 Connects a slot that takes one argument.
template<class T , class V >
boost::signals::connection connect (T *target, void(V::*method)(const E &))
 Connects a slot that takes a 'const argument&'.
void connect (JSlot &slot)
 Connects a slot that is specified as JavaScript only.
void emit (E e=NoClass::none)
 Emits the signal.
void operator() (E e)
 Emits the signal.

Detailed Description

template<typename E = NoClass>
class Wt::EventSignal< E >

A signal that conveys user-interface events.

An EventSignal is a special Signal that may be triggered by user interface events such as a mouse click, key press, or focus change. They are made available through the library in widgets like WInteractWidget, and should not be instantiated directly.

In addition to the behaviour of Signal, they are capable of both executing client-side and server-side slot code. They may learn JavaScript from C++ code, through stateless slot learning, when connected to a slot that has a stateless implementation, using WObject::implementStateless(). Or they may be connected to a JSlot which provides manual JavaScript code.

The typically relay UI event details, using event details objects like WKeyEvent or WMouseEvent.

See also:
Signal, JSignal

Member Function Documentation

template<typename E >
void Wt::EventSignal< E >::connect ( JSlot slot  )  [inline]

Connects a slot that is specified as JavaScript only.

This will provide a client-side connection between the event and some JavaScript code as implemented by the slot. Unlike other connects, this does not cause the event to propagated to the application, and thus the state changes caused by the JavaScript slot are not tracked client-side.

template<typename E >
template<class T , class V >
boost::signals::connection Wt::EventSignal< E >::connect ( T *  target,
void(V::*)(const E &)  method 
) [inline]

Connects a slot that takes a 'const argument&'.

This is only possible for signals that take at least one argument.

template<typename E >
template<class T , class V >
boost::signals::connection Wt::EventSignal< E >::connect ( T *  target,
void(V::*)(E)  method 
) [inline]

Connects a slot that takes one argument.

This is only possible for signals that take at least one argument.

template<typename E >
template<class T , class V >
boost::signals::connection Wt::EventSignal< E >::connect ( T *  target,
void(V::*)()  method 
) [inline]

Connects a slot that takes no arguments.

If a stateless implementation is specified for the slot, then the visual behaviour will be learned in terms of JavaScript, and will be cached on the client side for instant feed-back, in addition running the slot on the server.

The slot is as a method of an object target of class T, which equals class V, or is a base class of class V. In addition, to check for stateless implementations, class T must be also be a descendant of WObject. Thus, the following statement must return a non-null pointer:

 WObject *o = dynamic_cast<WObject *>(dynamic_cast<V *>(target));
template<typename E >
template<class F >
boost::signals::connection Wt::EventSignal< E >::connect ( const F &  function  )  [inline]

Connects to a function.

This variant of the overloaded connect() method supports a template function object (which supports operator ()).

When the receiver function is an object method, the signal will automatically be disconnected when the object is deleted, as long as the object inherits from WObject or boost::signals::trackable.

The function may leave 1 parameters unbound (e.g. using boost::bind placeholders _1) that may be bound to the event detail object passed by the signal.

template<typename E >
void Wt::EventSignal< E >::emit ( e = NoClass::none  )  [inline]

Emits the signal.

This will cause all connected slots to be triggered, with the given argument.

template<typename E >
void Wt::EventSignal< E >::operator() ( e  )  [inline]

Emits the signal.

This is equivalent to emit().

See also:
emit()

Generated on Thu May 13 05:16:17 2010 for Wt by doxygen 1.6.3