This reference page is linked to from the following overview topics: Attributes, Node Events.
This class represents an event receiver/triggerer point.
This is a special attribute, by linking these gates together you can receive events. If a class wants to emit one type of event and want to receive 5 events then it needs 6 EventGate attributes. The receiver eventgates must be linked to emitter evengates (See Connect()). It is also possible to link a receiver to another receiver, then the event will travel along the chain and all receiver will receive the event.
class MyClass : public Node { aevent m_eLowMemory; MyClass( void ) { m_eLowMemory.Connect( Kernel()->LowMemoryEvent ); }; void OnEvent( const EventGate &cEvent ) { if ( cEvent == m_eLowMemory ) { // free some buffers }; }; };
In the example above, the class MyClass has an EventGate member variable. The class connects this variable to the LowMemoryEvent variable in Kernel, so when the LowMemoryEvent event in kernel is triggered, the m_eLowMemory event object will be triggered also. The class can catch the even with the OnEvent() function as seen above.
#include <node.h>
Public Member Functions |
|
EventGate (Node *pOwner, const QString &sID="") | |
Standard constructor. |
|
void | Trigger (void) |
Fire the event. Connected evengates will
receive the event (See
Node::OnEvent()). |
|
void | Connect (EventGate &cEvent) |
Connect this eventgate to another one to
receive events from that. |
|
bool | operator== (const EventGate &cEvent) const |
Compare two eventgates. |
void Trigger | ( | void | ) |
Fire the event. Connected evengates will receive the event (See Node::OnEvent()).
void Connect | ( | EventGate & | cEvent | ) |
Connect this eventgate to another one to receive events from that.
bool operator== | ( | const EventGate & | cEvent | ) | const |
Compare two eventgates.