Lomse library. API documentation
0.30.0
|
#include <lomse_events.h>
Any object generating events must derive from Observable and must implement method "get_event_notifier()".
In order to allow for different event management models, responsibilities for event generation and event dispatching are decoupled. For this, the Observable pattern is split into two objects: the Observable itself is just a facade object providing the interface for adding/removing observers, and delegates in the EventNotifier object for doing the real work and event dispatching.
Public Types | |
enum | EObservedChild |
Public Member Functions | |
virtual | ~Observable () |
virtual EventNotifier * | get_event_notifier ()=0 |
virtual void | add_event_handler (int eventType, EventHandler *pHandler) |
virtual void | add_event_handler (int eventType, void *pThis, void(*pt2Func)(void *pObj, SpEventInfo event)) |
virtual void | add_event_handler (int eventType, void(*pt2Func)(SpEventInfo event)) |
void | add_event_handler (int childType, ImoId childId, int eventType, EventHandler *pHandler) |
void | add_event_handler (int childType, ImoId childId, int eventType, void *pThis, void(*pt2Func)(void *pObj, SpEventInfo event)) |
void | add_event_handler (int childType, ImoId childId, int eventType, void(*pt2Func)(SpEventInfo event)) |
virtual Observable * | get_observable_child (int UNUSED(childType), ImoId UNUSED(childId)) |
|
inlinevirtual |
Destructor.
|
virtual |
Register a notification handler (EventHandler object) for all events generated by this Observable object.
eventType | The type of event to be notified. It must be a value from enmu EEventType. |
pHandler | The object, derived from EventHandler, that will receive the notifications (by invoking its EventHandler::handle_event() method. |
|
virtual |
Register a notification handler (c++ method) for all events generated by this Observable object.
eventType | The type of event to be notified. It must be a value from enmu EEventType. |
pThis | Pointer to the object that will receive the notifications. |
pt2Func | The method in previous object that will be invoked to notify events. |
|
virtual |
Register a notification handler (c function) for all events generated by this Observable object.
eventType | The type of event to be notified. It must be a value from enmu EEventType. |
pt2Func | The function that will be invoked to notify events. |
void Observable::add_event_handler | ( | int | childType, |
ImoId | childId, | ||
int | eventType, | ||
EventHandler * | pHandler | ||
) |
Register an event handler (EventHandler object) for some events generated by children of this Observable object. Parameters childType and childId allows to filter the desired events.
childType | It must be value k_control or k_imo from enum EObservedChild, and selects the source of the events to be notified. |
childId | It is the ID of the ImoObj to observe. |
eventType | The type of event to be notified. It must be a value from enmu EEventType. |
pHandler | The object, derived from EventHandler, that will receive the notifications (by invoking its EventHandler::handle_event() method. |
void Observable::add_event_handler | ( | int | childType, |
ImoId | childId, | ||
int | eventType, | ||
void * | pThis, | ||
void(*)(void *pObj, SpEventInfo event) | pt2Func | ||
) |
Register an event handler (c++ method) for some events generated by children of this Observable object. Parameters childType and childId allows to filter the desired events.
childType | It must be value k_control or k_imo from enum EObservedChild, and selects the source of the events to be notified. |
childId | It is the ID of the ImoObj to observe. |
eventType | The type of event to be notified. It must be a value from enmu EEventType. |
pThis | Pointer to the object that will be notified. |
pt2Func | The method in previous object that will be invoked to notify events. |
void Observable::add_event_handler | ( | int | childType, |
ImoId | childId, | ||
int | eventType, | ||
void(*)(SpEventInfo event) | pt2Func | ||
) |
Register an event handler (c function) for some events generated by children of this Observable object. Parameters childType and childId allows to filter the desired events.
childType | It must be value k_control or k_imo from enum EObservedChild, and selects the source of the events to be notified. |
childId | It is the ID of the ImoObj to observe. |
eventType | The type of event to be notified. It must be a value from enmu EEventType. |
pt2Func | The method in previous object that will be invoked to notify events. |
|
pure virtual |
Returns the EventNotifier object associated to this Observable object.
|
inlinevirtual |
Returns a pointer to the observable child. */.