Class EventHandler This class will be your command center... More...
#include <SDK_Manila_Sense.h>
Public Member Functions | |
EventHandler (HINSTANCE hInstance, wstring windowName, bool topmost=false, HMENU menu=NULL) | |
Constructor of EventHandler. | |
~EventHandler (void) | |
void | messageProc (void *src, UINT msg=EVENT_CLICK) |
not needed, used by components to send messages to our application | |
virtual void | messageTreatment (Element *src, int idEvent, void *lParam=NULL)=0 |
This method is called when event appends (clicks or value change). | |
void | runApp () |
main function. Will listen for messages and dispatch them. | |
void | showWindow (bool isVisible) |
Use this method to show or hide your window. | |
Static Public Member Functions | |
static void | msgExecute (MSG msg) |
Used by messageBox to access directly to message queue. | |
Protected Member Functions | |
virtual void | initApplication ()=0 |
This method should be used to init application (add item to our window -via GlobalInformations::window-, init var, etc. | |
Protected Attributes | |
HINSTANCE | gInstance |
instance from winMain |
Class EventHandler This class will be your command center...
All messages and windows content are created here You will have to create a class that inherits from EventHandler. You have to implement the two followings methods:
void messageTreatment(Element* src,UINT msg);
void initApplication();
Your constructor should have a HINSTANCE parameter.
So, you will have something like that:
class MyApp: public EventHandler { protected: //function to init application (add item to our window, init var, etc.) void initApplication(); public: MyApp(HINSTANCE hInstance); ~MyApp(void); //function which is called when events appends void messageTreatment(Element* src,UINT msg); };
Definition at line 1795 of file SDK_Manila_Sense.h.
EventHandler::EventHandler | ( | HINSTANCE | hInstance, | |
wstring | windowName, | |||
bool | topmost = false , |
|||
HMENU | menu = NULL | |||
) |
Constructor of EventHandler.
hInstance | instance from winMain | |
windowName | Name of your application | |
topmost | If true your app will be in fullscreen mode (no top bar) | |
menu | If wanted, the handle of menu created with CreateMenu (see http://msdn.microsoft.com/en-us/library/aa921327.aspx) |
Definition at line 4 of file EventHandler.cpp.
EventHandler::~EventHandler | ( | void | ) |
Definition at line 34 of file EventHandler.cpp.
virtual void EventHandler::initApplication | ( | ) | [protected, pure virtual] |
This method should be used to init application (add item to our window -via GlobalInformations::window-, init var, etc.
)
void EventHandler::messageProc | ( | void * | src, | |
UINT | msg = EVENT_CLICK | |||
) |
not needed, used by components to send messages to our application
virtual void EventHandler::messageTreatment | ( | Element * | src, | |
int | idEvent, | |||
void * | lParam = NULL | |||
) | [pure virtual] |
This method is called when event appends (clicks or value change).
The parameter src is a pointer on the active Element and idEvent is equal to EVENT_CLICK, EVENT_VALUE_CHANGED, EVENT_RIGHT_CLICK or wParam...
msg WM_USER and WM_COMMAND received by windows are send here. In this case src==NULL, idEvent=wParam and lParam=lParam
src | pointer on the Element which fire this event | |
idEvent | number to identify the event (EVENT_CLICK, EVENT_VALUE_CHANGED, EVENT_RIGHT_CLICK or wParam) | |
lParam | NULL in most of case, except when the message is from windows (WM_USER and WM_COMMAND) |
void EventHandler::msgExecute | ( | MSG | msg | ) | [static] |
Used by messageBox to access directly to message queue.
Definition at line 47 of file EventHandler.cpp.
void EventHandler::runApp | ( | ) |
main function. Will listen for messages and dispatch them.
Definition at line 87 of file EventHandler.cpp.
void EventHandler::showWindow | ( | bool | isVisible | ) |
Use this method to show or hide your window.
isVisible | if true show the window, else hide the window |
Definition at line 128 of file EventHandler.cpp.
HINSTANCE EventHandler::gInstance [protected] |
instance from winMain
Definition at line 1802 of file SDK_Manila_Sense.h.