From: John L. <jr...@us...> - 2005-12-07 05:53:40
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2986/wxLua/modules/wxlua/include Modified Files: wxlcallb.h wxlstate.h Log Message: add getters for tracked events and destroy events make luastaterefdata lists not pointers Index: wxlcallb.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlcallb.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** wxlcallb.h 5 Dec 2005 06:11:14 -0000 1.6 --- wxlcallb.h 7 Dec 2005 05:53:30 -0000 1.7 *************** *** 40,47 **** --- 40,52 ---- // central event handler + // This function is called with "this" being of the type which the event is + // arriving at. The user data wxLuaCallback is used to route it to the + // correct place by calling CallFunction with the event. void EventHandler(wxEvent& event); protected: // event handler dispatcher back to Lua + // Call a lua function to handle an event. The lua function will receive + // a single parameter, the type of event. virtual void CallFunction(wxEvent *pEvent); *************** *** 51,58 **** // store the wxLuaState since we're added to a list of it's callbacks. wxLuaState m_wxlState; - wxEvtHandler *m_pHandler; wxWindowID m_id; wxEventType m_eventType; private: DECLARE_ABSTRACT_CLASS(wxLuaCallback) --- 56,63 ---- // store the wxLuaState since we're added to a list of it's callbacks. wxLuaState m_wxlState; wxEvtHandler *m_pHandler; wxWindowID m_id; wxEventType m_eventType; + private: DECLARE_ABSTRACT_CLASS(wxLuaCallback) *************** *** 85,92 **** void OnDestroy(); ! // Lua state instance ! wxLuaState m_wxlState; ! wxEvtHandler *m_pHandler; ! int m_id; private: --- 90,97 ---- void OnDestroy(); ! // store the wxLuaState since we're added to a list of it's callbacks. ! wxLuaState m_wxlState; ! wxEvtHandler *m_pHandler; ! int m_id; private: Index: wxlstate.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlstate.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** wxlstate.h 30 Nov 2005 04:46:17 -0000 1.8 --- wxlstate.h 7 Dec 2005 05:53:30 -0000 1.9 *************** *** 124,138 **** wxEventType m_inEventType; // wxEventType set when in event, else wxEVT_NULL ! wxHashTable* m_pDerivedList; // derived objects. ! wxHashTable* m_pTrackedList; // tracked objects. ! wxList* m_pAppHandlerList; // event objects associated with the application object ! wxList* m_pDestroyHandlerList; // wxLuaDestroyCallbacks installed ! wxList* m_pWindowList; // all wxWindow objects, wxWidgets will delete these ! // but for an embedded program they must be deleted before ! // shutting down the interpreter, else they dangle ! // used in destructor wxArrayInt m_usedIndexes; ! static wxLuaStateRefData* FindLuaStateRefData(lua_State* L); static wxHashMapLuaStateRefData s_wxHashMapLuaStateRefData; --- 124,138 ---- wxEventType m_inEventType; // wxEventType set when in event, else wxEVT_NULL ! wxHashTable* m_pDerivedList; // derived objects. ! wxHashTable* m_pTrackedList; // tracked objects. ! wxList m_eventHandlerList; // event objects for wxLuaCallback ! wxList m_destroyHandlerList; // wxLuaDestroyCallbacks installed ! wxList m_windowList; // all wxWindow objects, wxWidgets will delete these ! // but for an embedded program they must be deleted before ! // shutting down the interpreter, else they dangle ! // used in destructor wxArrayInt m_usedIndexes; ! static wxLuaStateRefData* GetLuaStateRefData(lua_State* L); static wxHashMapLuaStateRefData s_wxHashMapLuaStateRefData; *************** *** 216,220 **** // ----------------------------------------------------------------------- ! // memory tracking functions void addToTrackedMemoryList(wxObject *pObject); --- 216,220 ---- // ----------------------------------------------------------------------- ! // memory tracking functions (internal use) void addToTrackedMemoryList(wxObject *pObject); *************** *** 225,228 **** --- 225,238 ---- bool isWindowTracked(wxWindow *win, bool check_parents = true) const; + // add or remove a wxEvtHandler used by lua code, see usage in wxLuaCallback + void AddTrackedEventHandler(wxEvtHandler* evtHandler); + bool RemoveTrackedEventHandler(wxEvtHandler* evtHandler); + wxList* GetTrackedEventHandlerList(); + + // add or remove a wxEvtHandler used by lua code, see usage in wxLuaDestroyCallback + void AddTrackedDestroyEventHandler(wxEvtHandler* evtHandler); + bool RemoveTrackedDestroyEventHandler(wxEvtHandler* evtHandler); + wxList* GetTrackedDestroyEventHandlerList(); + // ----------------------------------------------------------------------- // wxLua Lua Registry Table Functions *************** *** 318,389 **** // ----------------------------------------------------------------------- ! // Raw lua Stack functions. // FIXME LuaStackObject Stack(int index) { return LuaStackObject(this, index); } ! int GetTop(); ! void SetTop(int index); ! void PushValue(int index); // FIXME void PushValue(LuaStackObject object); ! void PushNil(); ! void Remove(int index); ! void Pop(int count); ! int Next(int index); ! void Insert(int index); ! void Replace(int index); ! int CheckStack(int size); ! void XMove(const wxLuaState& to, int n); ! int Equal(int index1, int index2); ! int RawEqual(int index1, int index2); ! int LessThan(int index1, int index2); // ----------------------------------------------------------------------- ! // Raw lua Arg functions. ! void GetGlobals(); ! int GetN(int index); ! int Type(int index); ! double ToNumber(int index); ! int ToBoolean(int index); ! wxString TowxString(int index); ! const void *ToPointer(int index); ! bool IsCFunction(int index); ! const void *ToCFunction(int index); ! const void *ToUserData(int index); ! int TypeError(int narg, const char* tname); ! int TypeError(int narg, const wxString& tname) { return TypeError(narg, (const char*)wx2lua(tname)); } ! int ArgError(int narg, const char* extramsg); ! int ArgError(int narg, const wxString& extramsg) { return ArgError(narg, (const char*)wx2lua(extramsg)); } ! const char* CheckLString(int numArg, size_t* len); ! const char* OptLString(int numArg, const char *def, size_t* len); ! lua_Number CheckNumber(int numArg); ! lua_Number OptNumber(int nArg, lua_Number def); ! void ArgCheck(bool condition, int numarg, const char* extramsg); ! const char* CheckString(int numArg); ! const char* OptString(int numArg, const char* def); ! int CheckInt(int numArg); ! long CheckLong(int numArg); ! int OptInt(int numArg, int def); ! long OptLong(int numArg, int def); ! void CheckStack(int sz, const char* msg); ! void CheckType(int narg, int t); ! void CheckAny(int narg); ! void* CheckUData(int ud, const char* tname); // ----------------------------------------------------------------------- ! // Raw lua Debug functions. ! int GetStack(int level, lua_Debug* ar); ! int GetInfo(const char* what, lua_Debug* ar); ! int GetInfo(const wxString& str, lua_Debug* ar) { return GetInfo((const char*)wx2lua(str), ar); } ! const char* GetLocal(const lua_Debug* ar, int n); ! wxString GetLocalwxString(const lua_Debug* ar, int n) { return lua2wx(GetLocal(ar, n)); } ! const char* SetLocal(const lua_Debug* ar, int n); ! wxString SetLocalwxString(const lua_Debug* ar, int n) { return lua2wx(SetLocal(ar, n)); } ! int SetHook(lua_Hook func, int mask, int count); ! lua_Hook GetHook(); ! unsigned long GetHookMask(); // ----------------------------------------------------------------------- --- 328,527 ---- // ----------------------------------------------------------------------- ! // C++ interface for the lua_State functions ! // functions prepended by lua_XXX directly call the 'C' lua_XXX function ! // ----------------------------------------------------------------------- ! // Raw basic lua stack functions, lua.h // FIXME LuaStackObject Stack(int index) { return LuaStackObject(this, index); } ! int lua_GetTop(); ! void lua_SetTop(int index); ! void lua_PushValue(int index); // FIXME void PushValue(LuaStackObject object); ! void lua_Remove(int index); ! void lua_Pop(int count); ! void lua_Insert(int index); ! void lua_Replace(int index); ! int lua_CheckStack(int size); ! void lua_XMove(const wxLuaState& to, int n); // ----------------------------------------------------------------------- ! // Raw lua accesses functions (stack -> C), lua.h ! bool lua_IsNumber(int index); ! bool lua_IsString(int index); ! bool lua_IsCFunction(int index); ! bool lua_IsUserData(int index); ! int lua_Type(int index); ! wxString lua_TypeName(int type); ! int lua_Equal(int index1, int index2); ! int lua_RawEqual(int index1, int index2); ! int lua_LessThan(int index1, int index2); ! double lua_ToNumber(int index); ! int lua_ToBoolean(int index); ! wxString lua_ToString(int index); ! size_t lua_StrLen(int index); ! lua_CFunction lua_ToCFunction(int index); ! void* lua_ToUserData(int index); ! wxLuaState lua_ToThread(int index); ! const void* lua_ToPointer(int index); // ----------------------------------------------------------------------- ! // Raw lua push functions (C -> stack), lua.h ! void lua_PushNil(); ! void lua_PushNumber(lua_Number n); ! void lua_PushLString(const char* s, size_t len); ! void lua_PushLString(const wxString& s) { lua_PushLString(wx2lua(s), s.Len()); } ! void lua_PushString(const char* s); ! void lua_PushString(const wxString& s) { lua_PushString(wx2lua(s)); } ! //wxString lua_PushVfString(); ! //wxString lua_PushFString(); ! void lua_PushCClosure(lua_CFunction fn, int n); ! void lua_PushBoolean(bool b); ! void lua_PushLightUserData(void* p); ! // ----------------------------------------------------------------------- ! // Raw lua get functions (Lua -> stack), lua.h ! ! void lua_GetTable(int idx); ! void lua_RawGet(int idx); ! void lua_RawGeti(int idx, int n); ! void lua_NewTable(); ! void* lua_NewUserData(size_t sz); ! int lua_GetMetaTable(int objindex); ! void lua_GetFenv(int idx); ! ! // ----------------------------------------------------------------------- ! // Raw lua set functions (stack -> Lua), lua.h ! ! void lua_SetTable(int idx); ! void lua_RawSet(int idx); ! void lua_RawSeti(int idx, int n); ! int lua_SetMetaTable(int objindex); ! int lua_SetFenv(int idx); ! ! // ----------------------------------------------------------------------- ! // Raw lua `load' and `call' functions (load and run Lua code), lua.h ! ! void lua_Call(int nargs, int nresults); ! int lua_PCall(int nargs, int nresults, int errfunc); ! int lua_CPCall(lua_CFunction func, void *ud); ! int lua_Load(lua_Chunkreader reader, void *dt, const wxString& chunkname) ! { return lua_Load(reader, dt, wx2lua(chunkname)); } ! int lua_Load(lua_Chunkreader reader, void *dt, const char* chunkname); ! ! int lua_Dump (lua_State *L, lua_Chunkwriter writer, void *data); ! ! // ----------------------------------------------------------------------- ! // Raw lua coroutine functions, lua.h ! ! int lua_Yield(int nresults); ! int lua_Resume(int narg); ! ! // ----------------------------------------------------------------------- ! // Raw lua garbage-collection functions, lua.h ! ! int lua_GetGCThreshold(); ! int lua_GetGCCount(); ! void lua_SetGCThreshold(int newthreshold); ! ! // ----------------------------------------------------------------------- ! // Raw lua miscellaneous functions, lua.h ! ! wxString lua_Version(); ! int lua_Error(); ! int lua_Next(int idx); ! void lua_Concat(int n); ! ! // ----------------------------------------------------------------------- ! // Raw lua some useful "macros", lua.h ! ! //lua_boxpointer(L,u) ! //lua_unboxpointer(L,i) ! //lua_pop(L,n) lua_settop(L, -(n)-1) ! ! void lua_Register(const wxString& funcName, lua_CFunction f) { lua_Register(wx2lua(funcName), f); } ! void lua_Register(const char* funcName, lua_CFunction f); ! void lua_PushCFunction(lua_CFunction f); ! ! bool lua_IsFunction(int idx); ! bool lua_IsTable(int idx); ! bool lua_IsLightUserData(int idx); ! bool lua_IsNil(int idx); ! bool lua_IsBoolean(int idx); ! bool lua_IsNone(int idx); ! bool lua_IsNoneOrNil(int idx); ! ! //lua_pushliteral(L, s) lua_pushlstring(L, "" s, (sizeof(s)/sizeof(char))-1) ! ! // ----------------------------------------------------------------------- ! // Raw lua Debug functions, lua.h ! ! int lua_GetStack(int level, lua_Debug* ar); ! int lua_GetInfo(const wxString& what, lua_Debug* ar) { return lua_GetInfo(wx2lua(what), ar); } ! int lua_GetInfo(const char* what, lua_Debug* ar); ! const char* lua_GetLocal(const lua_Debug* ar, int n); ! wxString lua_GetLocalwxString(const lua_Debug* ar, int n) { return lua2wx(lua_GetLocal(ar, n)); } ! const char* lua_SetLocal(const lua_Debug* ar, int n); ! wxString lua_SetLocalwxString(const lua_Debug* ar, int n) { return lua2wx(lua_SetLocal(ar, n)); } ! const char* lua_GetUpValue(int funcindex, int n); ! wxString lua_GetUpValuewxString(int funcindex, int n) { return lua2wx(lua_GetUpValue(funcindex, n)); } ! const char* lua_SetUpValue(int funcindex, int n); ! wxString lua_SetUpValuewxString(int funcindex, int n) { return lua2wx(lua_SetUpValue(funcindex, n)); } ! ! int lua_SetHook(lua_Hook func, int mask, int count); ! lua_Hook lua_GetHook(); ! int lua_GetHookMask(); ! int lua_GetHookCount(); ! ! // ----------------------------------------------------------------------- ! // Raw lua auxlib functions, lauxlib.h ! ! void luaL_OpenLib(const char *libname, const luaL_reg *l, int nup); ! int luaL_GetMetaField(int obj, const char *e); ! int luaL_CallMeta(int obj, const char *e); ! int luaL_TypError(int narg, const char *tname); ! int luaL_ArgError(int numarg, const char *extramsg); ! const char *luaL_CheckLString(int numArg, size_t *l); ! const char *luaL_OptLString(int numArg, const char *def, size_t *len); ! lua_Number luaL_CheckNumber(int numArg); ! lua_Number luaL_OptNumber(int nArg, lua_Number def); ! ! void luaL_CheckStack(int sz, const char *msg); ! void luaL_CheckType(int narg, int t); ! void luaL_CheckAny(int narg); ! ! int luaL_NewMetatable(const char *tname); ! void luaL_GetMetatable(const char *tname); ! void *luaL_CheckUData(int ud, const char *tname); ! ! void luaL_Where(int lvl); ! int luaL_Error(const char *fmt, ...); ! ! int luaL_FindString(const char *st, const char *const lst[]); ! ! int luaL_Ref(int t); ! void luaL_Unref(int t, int ref); ! ! int luaL_Getn(int t); ! void luaL_Setn(int t, int n); ! ! int luaL_LoadFile(const char *filename); ! int luaL_LoadBuffer(const char *buff, size_t sz, const char *name); ! ! void luaL_ArgCheck(bool condition, int numarg, const char* extramsg); ! const char* luaL_CheckString(int numArg); ! const char* luaL_OptString(int numArg, const char* def); ! int luaL_CheckInt(int numArg); ! long luaL_CheckLong(int numArg); ! int luaL_OptInt(int numArg, int def); ! long luaL_OptLong(int numArg, int def); ! ! // ----------------------------------------------------------------------- ! // others ! ! void GetGlobals(); // ----------------------------------------------------------------------- |