From: John L. <jr...@us...> - 2007-06-08 22:50:44
|
Update of /cvsroot/wxlua/wxLua/bindings/wxwidgets In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv18758/wxLua/bindings/wxwidgets Modified Files: override.hpp wx_datatypes.lua wxlua.i Log Message: Add some functions to compare the wxlua tags type to lua_type() within lua also get the tag number for any object in lua Cleanup the bindings.wx.lua to make it more useful Index: wx_datatypes.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wx_datatypes.lua,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** wx_datatypes.lua 8 Jun 2007 01:36:22 -0000 1.63 --- wx_datatypes.lua 8 Jun 2007 22:50:08 -0000 1.64 *************** *** 2087,2090 **** --- 2087,2095 ---- Name = "wxLuaHtmlWindow", }, + wxLuaMethod_Type = { + DefType = "enum", + IsNumber = true, + Name = "wxLuaMethod_Type", + }, wxLuaObject = { BaseClass = "wxObject", Index: wxlua.i =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxlua.i,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** wxlua.i 31 May 2007 17:18:47 -0000 1.21 --- wxlua.i 8 Jun 2007 22:50:09 -0000 1.22 *************** *** 13,16 **** --- 13,126 ---- %function int CompileLuaScript(const wxString& luaScript, const wxString& fileName) + + %enum wxLuaMethod_Type // The type of a Lua method + WXLUAMETHOD_CONSTRUCTOR // constructor + WXLUAMETHOD_METHOD // class member function + WXLUAMETHOD_CFUNCTION // global C function (not part of a class) + WXLUAMETHOD_GETPROP // Get %property funcName, read + WXLUAMETHOD_SETPROP // Set %property funcName, write + + WXLUAMETHOD_STATIC // Class member function is static + WXLUAMETHOD_OVERLOAD // This is an overload function that will call others + // and the min/maxargs for it are not valid, + // but are the min and max of all functions + + WXLUAMETHOD_OVERLOAD_BASE // Class method has been checked to see if it is + // overloaded from the base class. + // Check WXLUAMETHOD::basemethod and if !NULL + // this method is an overload from the base class + %endenum + + %function int wxlua_iswxluatype(int luatype, int wxluaarg_tag) + + // %override wxString wxlua_typename(int wxluaarg_tag) + // C++ Func: wxString wxlua_getwxluatypename(int wxluaarg_tag) + // Returns the tag name for both the predefined (negative) as well as the + // binding class tags. (C function only does predefined tags) + %function wxString wxlua_typename(int wxluaarg_tag) + + + // %override int wxlua_type(void* object) + // Get the wxlua type (tag) of the object, this is the arg tags number + %function int wxlua_type(void* object) + + //----------------------------------------------------------------------------- + // wxLuaBinding - This is NOT wrapped, but implemented in wxlbind.cpp + + // These items follow the structure below and ALL items are called as if they + // were table members. + // Example : wxLuaBinding_wx.GetClassCount + // Example : print(wxLuaBinding_wx.GetClassArray[1].methods[1].name) + // Note: Use only '.' and NO () to make it a function call, also check to see + // if the item exists first! + + /* + + %class wxLuaBinding_XXX - where XXX is the name of the binding + // No constructor as this is read only + + wxString GetBindingName + wxString GetLuaNamespace + + int GetClassCount + int GetDefineCount + int GetStringCount + int GetEventCount + int GetObjectCount + int GetFunctionCount + + {wxLuaBindClass*} GetClassArray + {wxLuaBindMethod*} GetFunctionArray + {name, value} GetDefineArray + {name, value} GetStringArray + {name, eventType, class_tag} GetEventArray + {name, object, class_tag} GetObjectArray + + %endclass + + %class wxLuaBindClass + // No constructor as this is read only + + wxString name + {wxLuaBindMethod*} methods + int methods_n + wxClassInfo* classInfo + int class_tag + wxString baseclassName + wxLuaBindClass* baseclass + {name, value} enums + int enums_n + + %endclass + + %class wxLuaBindMethod + // No constructor as this is read only + + wxString name + int type + {wxLuaBindCFunc*} funcs + int funcs_n + wxLuaBindMethod* basemethod + + wxString class_name // added, not in struct + + %endclass + + %class wxLuaBindCFunc + // No constructor as this is read only + + cfunction func + int type + int minargs + int maxargs + {int} argtags + + wxString class_name // added, not in struct + + %endclass + + */ + + //----------------------------------------------------------------------------- // wxLuaState *************** *** 19,22 **** --- 129,153 ---- %class %delete wxLuaState, wxObject + /* + wxLuaState(bool create = false) + wxLuaState(wxEvtHandler *handler, wxWindowID id = wxID_ANY) + + bool Ok() const + void Destroy() + bool CloseLuaState(bool force) + bool IsClosing() const + wxEventType GetInEventType() const + void SetEventHandler(wxEvtHandler *evtHandler) + wxEvtHandler *GetEventHandler() const + void SetId(wxWindowID id) + wxWindowID GetId() const + void SendEvent( wxLuaEvent &event ) const + + int RunFile(const wxString &fileName) + int RunString(const wxString &script, const wxString& name = "") + bool IsRunning() const + + wxString GetLuaTagName(int tag) const + */ %endclass Index: override.hpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/override.hpp,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** override.hpp 8 Jun 2007 03:40:50 -0000 1.71 --- override.hpp 8 Jun 2007 22:50:08 -0000 1.72 *************** *** 4349,4352 **** --- 4349,4390 ---- %end + %override wxLua_function_wxlua_typename + // %function wxString wxlua_getwxluatypename(int wxluaarg_tag) + static int LUACALL wxLua_function_wxlua_typename(lua_State *L) + { + wxLuaState wxlState(L); + wxString returns; + // int wxluaarg_tag + int wxluaarg_tag = (int)wxlua_getnumbertype(L, 1); + // call wxlua_getwxluatypename + returns = wxlState.GetLuaTagName(wxluaarg_tag); //wxlua_getwxluatypename(wxluaarg_tag); + // push the result string + wxlState.lua_PushString(returns); + + return 1; + } + %end + + %override wxLua_function_wxlua_type + // %function int wxlua_wxluatype(int wxluaarg_tag) + static int LUACALL wxLua_function_wxlua_type(lua_State *L) + { + wxLuaState wxlState(L); + wxString returns; + // int wxluaarg_tag + int wxluaarg_tag = wxlua_ttag(L, 1); + if (wxluaarg_tag == TLUA_NOTAG) + { + int ltype = lua_type(L, 1); + wxluaarg_tag = wxlua_getwxluatype(ltype); + } + + // push the result number + lua_pushnumber(L, wxluaarg_tag); + + return 1; + } + %end + %override wxLua_wxLuaObject_constructor // wxLuaObject(void *object) |