Custom Event Types
The term “custom event types” is a misnomer. The Events package makes no distinction between its own event types and other derived event types. In fact, events do not even need to correspond to Windows messages. The first step in creating your own event type is to derive a class from the base IEvent interface. If you are implementing a Windows message, then derive the class from IWinEvent. The class can be either a pure virtual class (for example, an interface) or a concrete class. Next, derive an event listener interface from the IEventListener base interface and add your callback functions to it. Implement the Dispatch() function in your concrete event class by querying for the event listener interface and then invoking the appropriate callback function.
If you are implementing a Windows message (for example, WM_XXX) as an event class, the mouse event and mouse listener classes in the Events package are a good model to follow. If your custom event is not a Windows message, then do not derive your event from IWinEvent.