GUI::EventsDispatcher Class Reference

Handle events dispatching. More...

#include <EventsDispatcher.h>

Inheritance diagram for GUI::EventsDispatcher:

GUI::Singleton< T > List of all members.

Public Member Functions

int startListen () throw (GuiException)
 Start the message loop.
void registerController (WidgetController *controller_ptr)
 Register a new controller object for event handling.

Static Public Member Functions

static LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 Standard window procedure, called by the system.

Detailed Description

Handle events dispatching.

From messages to events
Event handling mecanism start from widget factory. When a widget factory was registered it create the Windows-Class using the static member EventsDispatcher::WindowProcedure for window procedure. In this way the system know to notify all messages at this static member.
When a new widget is instantiated the relative factory create a widget controller and register this object in the EventsDispatcher using the method EventsDispatcher::registerController.
When a Windows message is notified to the function EventsDispatcher::WindowProcedure the function search for a registered controller (using the window handle), if a controller is registered (all controller must be registered) the message was translated in an event. The message translation is delegated to the MessageTranslator class. When we have the event this was notified to the controller using the function WidgetController::eventNotify
See also:
GUI::WidgetController

GUI::MessageTranslator


Member Function Documentation

void GUI::EventsDispatcher::registerController ( WidgetController controller_ptr  ) 

Register a new controller object for event handling.

The relative widget factory register the controller after creation.

Parameters:
controller_ptr pointer to the desired controller

int GUI::EventsDispatcher::startListen (  )  throw (GuiException)

Start the message loop.

This method start a message loop and exit only if an exception was throw or if the apllication terminate

Returns:
the application exit code
See also:
GUI::Application::quit

LRESULT CALLBACK GUI::EventsDispatcher::WindowProcedure ( HWND  hwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
) [static]

Standard window procedure, called by the system.

This callback is called by the system, if there is a widget controller registered for the corresponding handle the message was notified to the controller object.


The documentation for this class was generated from the following files:
Generated on Wed Nov 15 22:21:10 2006 for Win32 by  doxygen 1.4.7