From: John L. <jr...@us...> - 2007-06-08 22:50:48
|
Update of /cvsroot/wxlua/wxLua/modules/wxbind/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv18758/wxLua/modules/wxbind/src Modified Files: wx_bind.cpp 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_bind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wx_bind.cpp,v retrieving revision 1.98 retrieving revision 1.99 diff -C2 -d -r1.98 -r1.99 *** wx_bind.cpp 8 Jun 2007 01:36:29 -0000 1.98 --- wx_bind.cpp 8 Jun 2007 22:50:09 -0000 1.99 *************** *** 570,573 **** --- 570,581 ---- { "WXK_TAB", WXK_TAB }, { "WXK_UP", WXK_UP }, + { "WXLUAMETHOD_CFUNCTION", WXLUAMETHOD_CFUNCTION }, + { "WXLUAMETHOD_CONSTRUCTOR", WXLUAMETHOD_CONSTRUCTOR }, + { "WXLUAMETHOD_GETPROP", WXLUAMETHOD_GETPROP }, + { "WXLUAMETHOD_METHOD", WXLUAMETHOD_METHOD }, + { "WXLUAMETHOD_OVERLOAD", WXLUAMETHOD_OVERLOAD }, + { "WXLUAMETHOD_OVERLOAD_BASE", WXLUAMETHOD_OVERLOAD_BASE }, + { "WXLUAMETHOD_SETPROP", WXLUAMETHOD_SETPROP }, + { "WXLUAMETHOD_STATIC", WXLUAMETHOD_STATIC }, #if wxLUA_USE_wxGLCanvas && wxUSE_GLCANVAS *************** *** 6199,6202 **** --- 6207,6270 ---- static wxLuaBindCFunc s_wxluafunc_wxLua_function_wxYield[1] = {{ wxLua_function_wxYield, WXLUAMETHOD_CFUNCTION, 0, 0, s_wxluaargArray_None }}; + static wxLuaArgTag s_wxluatagArray_wxLua_function_wxlua_iswxluatype[] = { &s_wxluaarg_Number, &s_wxluaarg_Number, NULL }; + // %function int wxlua_iswxluatype(int luatype, int wxluaarg_tag) + static int LUACALL wxLua_function_wxlua_iswxluatype(lua_State *L) + { + int returns; + // int wxluaarg_tag + int wxluaarg_tag = (int)wxlua_getnumbertype(L, 2); + // int luatype + int luatype = (int)wxlua_getnumbertype(L, 1); + // call wxlua_iswxluatype + returns = wxlua_iswxluatype(luatype, wxluaarg_tag); + // push the result number + lua_pushnumber(L, returns); + + return 1; + } + static wxLuaBindCFunc s_wxluafunc_wxLua_function_wxlua_iswxluatype[1] = {{ wxLua_function_wxlua_iswxluatype, WXLUAMETHOD_CFUNCTION, 2, 2, s_wxluatagArray_wxLua_function_wxlua_iswxluatype }}; + + static wxLuaArgTag s_wxluatagArray_wxLua_function_wxlua_type[] = { &s_wxluaarg_LightUserData, NULL }; + // %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; + } + + static wxLuaBindCFunc s_wxluafunc_wxLua_function_wxlua_type[1] = {{ wxLua_function_wxlua_type, WXLUAMETHOD_CFUNCTION, 1, 1, s_wxluatagArray_wxLua_function_wxlua_type }}; + + static wxLuaArgTag s_wxluatagArray_wxLua_function_wxlua_typename[] = { &s_wxluaarg_Number, NULL }; + // %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; + } + + static wxLuaBindCFunc s_wxluafunc_wxLua_function_wxlua_typename[1] = {{ wxLua_function_wxlua_typename, WXLUAMETHOD_CFUNCTION, 1, 1, s_wxluatagArray_wxLua_function_wxlua_typename }}; + // --------------------------------------------------------------------------- // wxLuaGetFunctionList_wx() is called to register global functions *************** *** 6484,6487 **** --- 6552,6558 ---- { "wxWakeUpIdle", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_wxWakeUpIdle, 1, NULL }, { "wxYield", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_wxYield, 1, NULL }, + { "wxlua_iswxluatype", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_wxlua_iswxluatype, 1, NULL }, + { "wxlua_type", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_wxlua_type, 1, NULL }, + { "wxlua_typename", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_wxlua_typename, 1, NULL }, { 0, 0, 0, 0 }, |