Mercurial > LightClone
view LightClone/Source/GuiEvent.h @ 70:ffaeccdc105e
Work on screen manager
author | koryspansel |
---|---|
date | Tue, 11 Oct 2011 12:09:04 -0700 |
parents | 3a63df04f3c0 |
children |
line wrap: on
line source
/* * GuiEvent */ #ifndef __GUIEVENT_H__ #define __GUIEVENT_H__ #include "Core.h" #include "FixedString.h" #include "GuiFunctor.h" /* * GuiElement */ class GuiElement; /* * GuiEventArguments */ struct GuiEventArguments { /* * pSource */ GuiElement* pSource; /* * GuiEventArguments */ GuiEventArguments(GuiElement* pInstance) : pSource(pInstance) { } }; /* * GuiEvent */ class GuiEvent { /* * kName */ FixedString<> kName; /* * kSubscriptions */ GuiFunctor::List kSubscriptions; public: /* * GuiEvent */ GuiEvent(const char* pEventName); /* * ~GuiEvent */ ~GuiEvent(); /* * Subscribe */ ErrorCode Subscribe(void (*pFunction)(GuiEventArguments&)) { return kSubscriptions.Add(new GuiFunction(pFunction)); } /* * Subscribe */ template<typename Type> ErrorCode Subscribe(void (Type::*pFunction)(GuiEventArguments&), Type* pInstance) { return kSubscriptions.Add(new GuiMethod<Type>(pFunction, pInstance)); } /* * Fire */ void Fire(GuiEventArguments&); }; #endif //__GUIEVENT_H__