Mercurial > LightClone
view LightClone/Source/GuiFunctor.h @ 33:06b151afc8d0
Cleaned up UI art; Completed drag and drop; Centered grid
author | koryspansel <koryspansel@bendbroadband.com> |
---|---|
date | Wed, 21 Sep 2011 00:50:20 -0700 |
parents | b4dc5d674e22 |
children |
line wrap: on
line source
/* * GuiFunctor */ #ifndef __GUIFUNCTOR_H__ #define __GUIFUNCTOR_H__ #include "Types.h" #include "ArrayList.h" /* * GuiEventArguments */ struct GuiEventArguments; /* * GuiFunctor */ class GuiFunctor { public: /* * List */ typedef ArrayList<GuiFunctor*> List; public: /* * ~GuiFunctor */ virtual ~GuiFunctor() { } /* * operator () */ virtual void operator()(GuiEventArguments&) = 0; }; /* * GuiFunction */ class GuiFunction : public GuiFunctor { /* * FunctorType */ typedef void (*FunctorType)(GuiEventArguments&); /* * pFunctor */ FunctorType pFunctor; public: /* * GuiFunction */ GuiFunction(FunctorType pFunction) : pFunctor(pFunction) { } /* * operator () */ virtual void operator()(GuiEventArguments& kArguments) { (*pFunctor)(kArguments); } }; /* * GuiMethod */ template <typename Object> class GuiMethod : public GuiFunctor { /* * FunctorType */ typedef void (Object::*FunctorType)(GuiEventArguments&); /* * pFunctor */ FunctorType pFunctor; /* * pObject */ Object* pObject; public: /* * GuiMethod */ GuiMethod(FunctorType pMethod, Object* pInstance) : pFunctor(pMethod), pObject(pInstance) { } /* * operator() */ void operator()(GuiEventArguments& kArguments) { (pObject->*pFunctor)(kArguments); } }; #endif //__GUIFUNCTOR_H__