mudbox::EventGate Class Reference
#include <node.h>
Inheritance diagram for mudbox::EventGate:
[legend]
List of all
members.
Detailed Description
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()->m_eLowMemory );
};
void OnEvent( const EventGate &cEvent )
{
if ( cEvent == m_eLowMemory )
{
};
};
};
In the example above, the class MyClass has an EventGate member variable.
The class connects this variable to the m_eLowMemory variable in
Kernel, so
when the m_eLowMemory 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.
|
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.
|
Constructor & Destructor Documentation
mudbox::EventGate::EventGate |
( |
Node * |
pOwner, |
|
|
const QString & |
sID =
"" |
|
) |
|
|
Member Function Documentation
void
mudbox::EventGate::Trigger |
( |
void |
|
) |
|
|
|
Fire the event. Connected evengates will receive the event (See
Node::OnEvent()).
|
void
mudbox::EventGate::Connect |
( |
EventGate & |
cEvent |
) |
|
|
|
Connect this eventgate to another one to receive events from
that.
|
bool
mudbox::EventGate::operator== |
( |
const EventGate
& |
cEvent |
) |
const |
|
mudbox::EventGate mudbox::EventGate
mudbox::EventGate mudbox::EventGate mudbox::EventGate
mudbox::EventGate mudbox::EventGate mudbox::EventGate
mudbox::EventGate mudbox::EventGate
mudbox::EventGate mudbox::EventGate
mudbox::EventGate mudbox::EventGate mudbox::EventGate
mudbox::EventGate mudbox::EventGate mudbox::EventGate
mudbox::EventGate mudbox::EventGate