Each object that is capable of handling events has a CP_EventHandler associated with that class that is responsible for maintining the interaction between the list of events that you want to be notified of, and the underlying OS.
In your class, you will want to register for the events you desire to handle as shown here:
void CP_MyClass::InitEventHandler( CP_EventHandler& inEventHandler ) { // install base events first in case we want to override them CP_BaseClass::InitEventHandler( inEventHandler ); // install events for this class CP_EventSignal *clickSignal = CP_new CP_EventSignal(); clickSignal->connect( CPLAT::CP_SigSlot::slot(this, &CP_MyClass::HandleMouseUp) ); inEventHandler.Add( kCP_EventClassMouse, kCP_Event_MouseUp, clickSignal, GetOSControl() ); }
Then whenever the user releases the mouse in your view, the method HandleMouseUp will be called.
void CP_MyClass::InitEventHandler( CP_EventHandler& inEventHandler ) { // install base events first in case we want to override them CP_BaseClass::InitEventHandler( inEventHandler ); // first remove the existing mouse up handler inEventHandler.Remove( kCP_EventClassMouse, kCP_Event_MouseUp ); // install events for this class CP_EventSignal *clickSignal = CP_new CP_EventSignal(); clickSignal->connect( CPLAT::CP_SigSlot::slot(this, &CP_MyClass::HandleMouseUp) ); inEventHandler.Add( kCP_EventClassMouse, kCP_Event_MouseUp, clickSignal, GetOSControl() ); }
If you need to find out if a handler exists for the class, you can check with the HasHandler() method.