00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef _CEGUILuaFunctor_h_
00031 #define _CEGUILuaFunctor_h_
00032
00033 #include "CEGUIEventSet.h"
00034 #include "CEGUIScriptWindowHelper.h"
00035
00036 struct lua_State;
00037
00038
00039 namespace CEGUI
00040 {
00041
00042
00043 class LuaScriptModule;
00044
00049 class LuaFunctor
00050 {
00051 public:
00052 LuaFunctor(lua_State* state, int func, int selfIndex);
00053 LuaFunctor(lua_State* state, const String& func, int selfIndex);
00054
00055 LuaFunctor(lua_State* state, const int func, const int selfIndex,
00056 const String& error_handler);
00057 LuaFunctor(lua_State* state, const String& func, const int selfIndex,
00058 const String& error_handler);
00059 LuaFunctor(lua_State* state, const int func, const int selfIndex,
00060 const int error_handler);
00061 LuaFunctor(lua_State* state, const String& func, const int selfIndex,
00062 const int error_handler);
00063
00064 LuaFunctor(const LuaFunctor& cp);
00065 ~LuaFunctor();
00066
00067 bool operator()(const EventArgs& args) const;
00068
00075 static Event::Connection SubscribeEvent(EventSet* self,
00076 const String& eventName,
00077 const int funcIndex,
00078 const int selfIndex,
00079 const int error_handler,
00080 lua_State* L);
00081
00087 static void pushNamedFunction(lua_State* L, const String& name);
00088
00089 private:
00090 lua_State* L;
00091 mutable int index;
00092 int self;
00093 mutable bool needs_lookup;
00094 mutable String function_name;
00095
00097 mutable String d_errFuncName;
00099 mutable int d_errFuncIndex;
00101 mutable bool d_ourErrFuncIndex;
00102
00103 friend class LuaScriptModule;
00104 };
00105
00106 }
00107
00108 #endif // end of guard _CEGUILuaFunctor_h_