00001
00002
00003
00004
00005
00006
00007 #ifdef __BORLANDC__
00008 #pragma hdrstop
00009 #endif
00010
00011 #include "wx/wxprec.h"
00012
00013 #ifndef WX_PRECOMP
00014 #include "wx/wx.h"
00015 #endif
00016
00017
00018 #include "wxlua/include/wxlstate.h"
00019 #include "wxlua/include/wxlua_bind.h"
00020 #ifdef Above
00021 #undef Above
00022 #endif
00023 #ifdef Below
00024 #undef Below
00025 #endif
00026
00027
00028
00029
00030
00031
00032
00033 int wxluatype_wxLuaState = WXLUA_TUNKNOWN;
00034
00035 static wxLuaArgType s_wxluatypeArray_wxLua_wxLuaState_delete[] = { &wxluatype_wxLuaState, NULL };
00036 static wxLuaBindCFunc s_wxluafunc_wxLua_wxLuaState_delete[1] = {{ wxlua_userdata_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatypeArray_wxLua_wxLuaState_delete }};
00037
00038
00039
00040
00041 wxLuaBindMethod wxLuaState_methods[] = {
00042 { "delete", WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, s_wxluafunc_wxLua_wxLuaState_delete, 1, NULL },
00043 { 0, 0, 0, 0 },
00044 };
00045
00046 int wxLuaState_methodCount = sizeof(wxLuaState_methods)/sizeof(wxLuaBindMethod) - 1;
00047
00048
00049
00050
00051
00052
00053
00054 int wxluatype_wxLuaObject = WXLUA_TUNKNOWN;
00055
00056 static wxLuaArgType s_wxluatypeArray_wxLua_wxLuaObject_GetAllocationFlag[] = { &wxluatype_wxLuaObject, NULL };
00057 static int LUACALL wxLua_wxLuaObject_GetAllocationFlag(lua_State *L);
00058 static wxLuaBindCFunc s_wxluafunc_wxLua_wxLuaObject_GetAllocationFlag[1] = {{ wxLua_wxLuaObject_GetAllocationFlag, WXLUAMETHOD_METHOD, 1, 1, s_wxluatypeArray_wxLua_wxLuaObject_GetAllocationFlag }};
00059
00060 static int LUACALL wxLua_wxLuaObject_GetAllocationFlag(lua_State *L)
00061 {
00062
00063 wxLuaObject * self = (wxLuaObject *)wxluaT_getuserdatatype(L, 1, wxluatype_wxLuaObject);
00064
00065 int returns = (self->GetAllocationFlag());
00066
00067 lua_pushnumber(L, returns);
00068
00069 return 1;
00070 }
00071
00072 static wxLuaArgType s_wxluatypeArray_wxLua_wxLuaObject_GetObject[] = { &wxluatype_wxLuaObject, NULL };
00073 static int LUACALL wxLua_wxLuaObject_GetObject(lua_State *L);
00074 static wxLuaBindCFunc s_wxluafunc_wxLua_wxLuaObject_GetObject[1] = {{ wxLua_wxLuaObject_GetObject, WXLUAMETHOD_METHOD, 1, 1, s_wxluatypeArray_wxLua_wxLuaObject_GetObject }};
00075
00076
00077 static int LUACALL wxLua_wxLuaObject_GetObject(lua_State *L)
00078 {
00079
00080 wxLuaObject *self = (wxLuaObject *)wxluaT_getuserdatatype(L, 1, wxluatype_wxLuaObject);
00081
00082 if (self->GetObject())
00083 return 1;
00084
00085 return 0;
00086 }
00087
00088
00089 static wxLuaArgType s_wxluatypeArray_wxLua_wxLuaObject_SetObject[] = { &wxluatype_wxLuaObject, NULL };
00090 static int LUACALL wxLua_wxLuaObject_SetObject(lua_State *L);
00091 static wxLuaBindCFunc s_wxluafunc_wxLua_wxLuaObject_SetObject[1] = {{ wxLua_wxLuaObject_SetObject, WXLUAMETHOD_METHOD, 1, 1, s_wxluatypeArray_wxLua_wxLuaObject_SetObject }};
00092
00093
00094 static int LUACALL wxLua_wxLuaObject_SetObject(lua_State *L)
00095 {
00096
00097 wxLuaObject *self = (wxLuaObject *)wxluaT_getuserdatatype(L, 1, wxluatype_wxLuaObject);
00098
00099 self->SetObject(1);
00100
00101 return 0;
00102 }
00103
00104
00105 static wxLuaArgType s_wxluatypeArray_wxLua_wxLuaObject_delete[] = { &wxluatype_wxLuaObject, NULL };
00106 static wxLuaBindCFunc s_wxluafunc_wxLua_wxLuaObject_delete[1] = {{ wxlua_userdata_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatypeArray_wxLua_wxLuaObject_delete }};
00107
00108 static int LUACALL wxLua_wxLuaObject_constructor(lua_State *L);
00109 static wxLuaBindCFunc s_wxluafunc_wxLua_wxLuaObject_constructor[1] = {{ wxLua_wxLuaObject_constructor, WXLUAMETHOD_CONSTRUCTOR, 0, 0, g_wxluaargtypeArray_None }};
00110
00111
00112 static int LUACALL wxLua_wxLuaObject_constructor(lua_State *L)
00113 {
00114 wxLuaState wxlState(L);
00115
00116 wxLuaObject *returns;
00117
00118 returns = new wxLuaObject(wxlState, 1);
00119
00120 wxluaO_addgcobject(L, returns);
00121
00122 wxluaT_pushuserdatatype(L, returns, wxluatype_wxLuaObject);
00123
00124 return 1;
00125 }
00126
00127
00128
00129
00130
00131 wxLuaBindMethod wxLuaObject_methods[] = {
00132 { "GetAllocationFlag", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxLuaObject_GetAllocationFlag, 1, NULL },
00133 { "GetObject", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxLuaObject_GetObject, 1, NULL },
00134 { "SetObject", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxLuaObject_SetObject, 1, NULL },
00135 { "delete", WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, s_wxluafunc_wxLua_wxLuaObject_delete, 1, NULL },
00136 { "wxLuaObject", WXLUAMETHOD_CONSTRUCTOR, s_wxluafunc_wxLua_wxLuaObject_constructor, 1, NULL },
00137 { 0, 0, 0, 0 },
00138 };
00139
00140 int wxLuaObject_methodCount = sizeof(wxLuaObject_methods)/sizeof(wxLuaBindMethod) - 1;
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156 wxLuaBindEvent* wxLuaGetEventList_wxlua(size_t &count)
00157 {
00158 static wxLuaBindEvent eventList[] =
00159 {
00160
00161 { 0, 0, 0 },
00162 };
00163 count = sizeof(eventList)/sizeof(wxLuaBindEvent) - 1;
00164 return eventList;
00165 }
00166
00167
00168
00169
00170
00171 wxLuaBindNumber* wxLuaGetDefineList_wxlua(size_t &count)
00172 {
00173 static wxLuaBindNumber numberList[] =
00174 {
00175 { "LUA_TBOOLEAN", LUA_TBOOLEAN },
00176 { "LUA_TFUNCTION", LUA_TFUNCTION },
00177 { "LUA_TLIGHTUSERDATA", LUA_TLIGHTUSERDATA },
00178 { "LUA_TNIL", LUA_TNIL },
00179 { "LUA_TNONE", LUA_TNONE },
00180 { "LUA_TNUMBER", LUA_TNUMBER },
00181 { "LUA_TSTRING", LUA_TSTRING },
00182 { "LUA_TTABLE", LUA_TTABLE },
00183 { "LUA_TTHREAD", LUA_TTHREAD },
00184 { "LUA_TUSERDATA", LUA_TUSERDATA },
00185 { "WXLUAMETHOD_CFUNCTION", WXLUAMETHOD_CFUNCTION },
00186 { "WXLUAMETHOD_CHECKED_OVERLOAD", WXLUAMETHOD_CHECKED_OVERLOAD },
00187 { "WXLUAMETHOD_CONSTRUCTOR", WXLUAMETHOD_CONSTRUCTOR },
00188 { "WXLUAMETHOD_DELETE", WXLUAMETHOD_DELETE },
00189 { "WXLUAMETHOD_GETPROP", WXLUAMETHOD_GETPROP },
00190 { "WXLUAMETHOD_METHOD", WXLUAMETHOD_METHOD },
00191 { "WXLUAMETHOD_SETPROP", WXLUAMETHOD_SETPROP },
00192 { "WXLUAMETHOD_STATIC", WXLUAMETHOD_STATIC },
00193 { "WXLUA_TBOOLEAN", WXLUA_TBOOLEAN },
00194 { "WXLUA_TCFUNCTION", WXLUA_TCFUNCTION },
00195 { "WXLUA_TFUNCTION", WXLUA_TFUNCTION },
00196 { "WXLUA_TINTEGER", WXLUA_TINTEGER },
00197 { "WXLUA_TLIGHTUSERDATA", WXLUA_TLIGHTUSERDATA },
00198 { "WXLUA_TNIL", WXLUA_TNIL },
00199 { "WXLUA_TNONE", WXLUA_TNONE },
00200 { "WXLUA_TNUMBER", WXLUA_TNUMBER },
00201 { "WXLUA_TSTRING", WXLUA_TSTRING },
00202 { "WXLUA_TTABLE", WXLUA_TTABLE },
00203 { "WXLUA_TTHREAD", WXLUA_TTHREAD },
00204 { "WXLUA_TUSERDATA", WXLUA_TUSERDATA },
00205 { "WXLUA_T_MAX", WXLUA_T_MAX },
00206 { "wxLUAOBJECT_ARRAYINT", wxLUAOBJECT_ARRAYINT },
00207 { "wxLUAOBJECT_BOOL", wxLUAOBJECT_BOOL },
00208 { "wxLUAOBJECT_INT", wxLUAOBJECT_INT },
00209 { "wxLUAOBJECT_NONE", wxLUAOBJECT_NONE },
00210 { "wxLUAOBJECT_STRING", wxLUAOBJECT_STRING },
00211 { "wxLUA_MAJOR_VERSION", wxLUA_MAJOR_VERSION },
00212 { "wxLUA_MINOR_VERSION", wxLUA_MINOR_VERSION },
00213 { "wxLUA_RELEASE_NUMBER", wxLUA_RELEASE_NUMBER },
00214 { "wxLUA_SUBRELEASE_NUMBER", wxLUA_SUBRELEASE_NUMBER },
00215
00216 { 0, 0 },
00217 };
00218 count = sizeof(numberList)/sizeof(wxLuaBindNumber) - 1;
00219 return numberList;
00220 }
00221
00222
00223
00224
00225
00226
00227 wxLuaBindString* wxLuaGetStringList_wxlua(size_t &count)
00228 {
00229 static wxLuaBindString stringList[] =
00230 {
00231 { "wxLUA_VERSION_STRING", wxLUA_VERSION_STRING },
00232
00233 { 0, 0 },
00234 };
00235 count = sizeof(stringList)/sizeof(wxLuaBindString) - 1;
00236 return stringList;
00237 }
00238
00239
00240
00241
00242
00243 wxLuaBindObject* wxLuaGetObjectList_wxlua(size_t &count)
00244 {
00245 static wxLuaBindObject objectList[] =
00246 {
00247
00248 { 0, 0, 0, 0 },
00249 };
00250 count = sizeof(objectList)/sizeof(wxLuaBindObject) - 1;
00251 return objectList;
00252 }
00253
00254
00255
00256
00257
00258 static wxLuaArgType s_wxluatypeArray_wxLua_function_CompileLuaScript[] = { &wxluatype_TSTRING, &wxluatype_TSTRING, NULL };
00259
00260
00261 static int LUACALL wxLua_function_CompileLuaScript(lua_State *L)
00262 {
00263 int returns;
00264
00265 const wxString fileName = wxlua_getwxStringtype(L, 2);
00266
00267 const wxString luaScript = wxlua_getwxStringtype(L, 1);
00268 wxString errMsg;
00269 int line_num = -1;
00270 wxLuaState wxlState2(true);
00271 returns = wxlState2.CompileString(luaScript, fileName, &errMsg, &line_num);
00272
00273 lua_pushnumber(L, returns);
00274 wxlua_pushwxString(L, errMsg);
00275 lua_pushnumber(L, line_num);
00276 return 3;
00277 }
00278
00279 static wxLuaBindCFunc s_wxluafunc_wxLua_function_CompileLuaScript[1] = {{ wxLua_function_CompileLuaScript, WXLUAMETHOD_CFUNCTION, 2, 2, s_wxluatypeArray_wxLua_function_CompileLuaScript }};
00280
00281
00282
00283 int LUACALL wxluabind_wxLuaBinding__index(lua_State* L);
00284
00285
00286 static int LUACALL wxLua_function_GetBindings(lua_State *L)
00287 {
00288 lua_newtable(L);
00289
00290 int idx = 1;
00291 wxLuaBindingList::compatibility_iterator node;
00292 for (node = wxLuaBinding::GetBindingList()->GetFirst(); node; node = node->GetNext(), idx++)
00293 {
00294 wxLuaBinding* binding = node->GetData();
00295
00296
00297 const void **ptr = (const void **)lua_newuserdata(L, sizeof(void *));
00298 *ptr = binding;
00299 lua_newtable(L);
00300 lua_pushstring(L, "__index");
00301 lua_pushlightuserdata(L, binding);
00302 lua_pushcclosure(L, wxluabind_wxLuaBinding__index, 1);
00303 lua_rawset(L, -3);
00304
00305
00306
00307
00308
00309 lua_setmetatable(L, -2);
00310
00311 lua_rawseti(L, -2, idx);
00312 }
00313
00314 return 1;
00315 }
00316
00317
00318
00319
00320 int LUACALL wxluabind_wxLuaBindClass__index(lua_State* L);
00321
00322 int LUACALL wxluabind_wxLuaBindCFunc__index(lua_State* L)
00323 {
00324 void **ptr = (void **)lua_touserdata(L, 1);
00325 wxLuaBindCFunc* wxlCFunc= (wxLuaBindCFunc*)*ptr;
00326 wxLuaBinding *wxlBinding = (wxLuaBinding *)lua_touserdata(L, lua_upvalueindex(1));
00327
00328 int idx_type = lua_type(L, 2);
00329
00330 if (idx_type == LUA_TSTRING)
00331 {
00332 const char* idx_str = lua_tostring(L, 2);
00333
00334 if (strcmp(idx_str, "lua_cfunc") == 0)
00335 {
00336 lua_pushcfunction(L, wxlCFunc->lua_cfunc);
00337 return 1;
00338 }
00339 else if (strcmp(idx_str, "method_type") == 0)
00340 {
00341 lua_pushnumber(L, wxlCFunc->method_type);
00342 return 1;
00343 }
00344 else if (strcmp(idx_str, "minargs") == 0)
00345 {
00346 lua_pushnumber(L, wxlCFunc->minargs);
00347 return 1;
00348 }
00349 else if (strcmp(idx_str, "maxargs") == 0)
00350 {
00351 lua_pushnumber(L, wxlCFunc->maxargs);
00352 return 1;
00353 }
00354 else if (strcmp(idx_str, "argtypes") == 0)
00355 {
00356 size_t idx, count = wxlCFunc->maxargs;
00357 lua_createtable(L, count, 0);
00358
00359
00360 for (idx = 0; (idx < count) && wxlCFunc->argtypes[idx]; ++idx)
00361 {
00362 lua_pushnumber(L, *wxlCFunc->argtypes[idx]);
00363 lua_rawseti(L, -2, idx + 1);
00364 }
00365
00366 return 1;
00367 }
00368 else if (strcmp(idx_str, "class") == 0)
00369 {
00370 const wxLuaBindClass* c = wxlBinding->GetBindClass(wxlCFunc);
00371 if (c != NULL)
00372 {
00373 const void **ptr = (const void **)lua_newuserdata(L, sizeof(void *));
00374 *ptr = c;
00375 lua_newtable(L);
00376 lua_pushstring(L, "__index");
00377 lua_pushlightuserdata(L, wxlBinding);
00378 lua_pushcclosure(L, wxluabind_wxLuaBindClass__index, 1);
00379 lua_rawset(L, -3);
00380 lua_setmetatable(L, -2);
00381
00382 return 1;
00383 }
00384 }
00385 else if (strcmp(idx_str, "class_name") == 0)
00386 {
00387 const wxLuaBindClass* c = wxlBinding->GetBindClass(wxlCFunc);
00388 if (c != NULL)
00389 {
00390 lua_pushstring(L, c->name);
00391 return 1;
00392 }
00393 }
00394 }
00395
00396 return 0;
00397 }
00398
00399
00400
00401
00402
00403 int LUACALL wxluabind_wxLuaBindMethod__index(lua_State* L)
00404 {
00405 void **ptr = (void **)lua_touserdata(L, 1);
00406 wxLuaBindMethod* wxlMethod = (wxLuaBindMethod*)*ptr;
00407 wxLuaBinding *wxlBinding = (wxLuaBinding *)lua_touserdata(L, lua_upvalueindex(1));
00408
00409 int idx_type = lua_type(L, 2);
00410
00411 if (idx_type == LUA_TSTRING)
00412 {
00413 const char* idx_str = lua_tostring(L, 2);
00414
00415 if (strcmp(idx_str, "name") == 0)
00416 {
00417 lua_pushstring(L, wxlMethod->name);
00418 return 1;
00419 }
00420 else if (strcmp(idx_str, "method_type") == 0)
00421 {
00422 lua_pushnumber(L, wxlMethod->method_type);
00423 return 1;
00424 }
00425 else if (strcmp(idx_str, "wxluacfuncs") == 0)
00426 {
00427 wxLuaBindCFunc* wxlCFunc = wxlMethod->wxluacfuncs;
00428 size_t idx, count = wxlMethod->wxluacfuncs_n;
00429 lua_createtable(L, count, 0);
00430
00431 for (idx = 0; idx < count; ++idx, ++wxlCFunc)
00432 {
00433 const void **ptr = (const void **)lua_newuserdata(L, sizeof(void *));
00434 *ptr = wxlCFunc;
00435 lua_newtable(L);
00436 lua_pushstring(L, "__index");
00437 lua_pushlightuserdata(L, wxlBinding);
00438 lua_pushcclosure(L, wxluabind_wxLuaBindCFunc__index, 1);
00439 lua_rawset(L, -3);
00440 lua_setmetatable(L, -2);
00441
00442 lua_rawseti(L, -2, idx + 1);
00443 }
00444
00445 return 1;
00446 }
00447 else if (strcmp(idx_str, "wxluacfuncs_n") == 0)
00448 {
00449 lua_pushnumber(L, wxlMethod->wxluacfuncs_n);
00450 return 1;
00451 }
00452 else if (strcmp(idx_str, "basemethod") == 0)
00453 {
00454 if (wxlMethod->basemethod)
00455 {
00456 const void **ptr = (const void **)lua_newuserdata(L, sizeof(void *));
00457 *ptr = wxlMethod->basemethod;
00458 lua_newtable(L);
00459 lua_pushstring(L, "__index");
00460 lua_pushlightuserdata(L, wxlBinding);
00461 lua_pushcclosure(L, wxluabind_wxLuaBindMethod__index, 1);
00462 lua_rawset(L, -3);
00463 lua_setmetatable(L, -2);
00464
00465 return 1;
00466 }
00467
00468 return 0;
00469 }
00470 else if (strcmp(idx_str, "class") == 0)
00471 {
00472 const wxLuaBindClass* c = wxlBinding->GetBindClass(wxlMethod);
00473 if (c != NULL)
00474 {
00475 const void **ptr = (const void **)lua_newuserdata(L, sizeof(void *));
00476 *ptr = c;
00477 lua_newtable(L);
00478 lua_pushstring(L, "__index");
00479 lua_pushlightuserdata(L, wxlBinding);
00480 lua_pushcclosure(L, wxluabind_wxLuaBindClass__index, 1);
00481 lua_rawset(L, -3);
00482 lua_setmetatable(L, -2);
00483
00484 return 1;
00485 }
00486 }
00487 else if (strcmp(idx_str, "class_name") == 0)
00488 {
00489 const wxLuaBindClass* c = wxlBinding->GetBindClass(wxlMethod);
00490 if (c != NULL)
00491 {
00492 lua_pushstring(L, c->name);
00493 return 1;
00494 }
00495 }
00496 }
00497
00498 return 0;
00499 }
00500
00501
00502
00503
00504
00505 int LUACALL wxluabind_wxLuaBindClass__index(lua_State* L)
00506 {
00507 void **ptr = (void **)lua_touserdata(L, 1);
00508 wxLuaBindClass* wxlClass = (wxLuaBindClass*)*ptr;
00509 wxLuaBinding *wxlBinding = (wxLuaBinding *)lua_touserdata(L, lua_upvalueindex(1));
00510
00511 int idx_type = lua_type(L, 2);
00512
00513 if (idx_type == LUA_TSTRING)
00514 {
00515 const char* idx_str = lua_tostring(L, 2);
00516
00517 if (strcmp(idx_str, "name") == 0)
00518 {
00519 lua_pushstring(L, wxlClass->name);
00520 return 1;
00521 }
00522 else if (strcmp(idx_str, "wxluamethods") == 0)
00523 {
00524 if (wxlClass->wxluamethods_n > 0)
00525 {
00526 wxLuaBindMethod* wxlMethod = wxlClass->wxluamethods;
00527 size_t idx, count = wxlClass->wxluamethods_n;
00528 lua_createtable(L, count, 0);
00529
00530 for (idx = 0; idx < count; ++idx, ++wxlMethod)
00531 {
00532
00533 const void **ptr = (const void **)lua_newuserdata(L, sizeof(void *));
00534 *ptr = wxlMethod;
00535 lua_newtable(L);
00536 lua_pushstring(L, "__index");
00537 lua_pushlightuserdata(L, wxlBinding);
00538 lua_pushcclosure(L, wxluabind_wxLuaBindMethod__index, 1);
00539 lua_rawset(L, -3);
00540 lua_setmetatable(L, -2);
00541
00542 lua_rawseti(L, -2, idx + 1);
00543 }
00544
00545 lua_pushstring(L, "wxLuaBindClass");
00546 lua_pushvalue(L, 1);
00547 lua_rawset(L, -3);
00548
00549 return 1;
00550 }
00551
00552 return 0;
00553 }
00554 else if (strcmp(idx_str, "wxluamethods_n") == 0)
00555 {
00556 lua_pushnumber(L, wxlClass->wxluamethods_n);
00557 return 1;
00558 }
00559 else if (strcmp(idx_str, "classInfo") == 0)
00560 {
00561 if (wxlClass->classInfo)
00562 {
00563 const wxLuaBindClass* classInfoClass = wxluaT_getclass(L, "wxClassInfo");
00564 if (classInfoClass)
00565 {
00566 wxluaT_pushuserdatatype(L, wxlClass->classInfo, *classInfoClass->wxluatype);
00567 return 1;
00568 }
00569 }
00570
00571 return 0;
00572 }
00573 else if (strcmp(idx_str, "wxluatype") == 0)
00574 {
00575 lua_pushnumber(L, *wxlClass->wxluatype);
00576 return 1;
00577 }
00578 else if (strcmp(idx_str, "baseclassNames") == 0)
00579 {
00580 if (wxlClass->baseclassNames)
00581 {
00582 lua_newtable(L);
00583 for (size_t i = 0; wxlClass->baseclassNames[i]; ++i)
00584 {
00585 lua_pushstring(L, wxlClass->baseclassNames[i]);
00586 lua_rawseti(L, -2, i + 1);
00587 }
00588 return 1;
00589 }
00590
00591 return 0;
00592 }
00593 else if (strcmp(idx_str, "baseBindClasses") == 0)
00594 {
00595 if (wxlClass->baseBindClasses)
00596 {
00597 lua_newtable(L);
00598 for (size_t i = 0; wxlClass->baseclassNames[i]; ++i)
00599 {
00600 if (wxlClass->baseBindClasses[i] == NULL)
00601 {
00602 lua_pushnil(L);
00603 }
00604 else
00605 {
00606 const void **ptr = (const void **)lua_newuserdata(L, sizeof(void *));
00607 *ptr = wxlClass->baseBindClasses[i];
00608 lua_newtable(L);
00609 lua_pushstring(L, "__index");
00610 lua_pushlightuserdata(L, wxlBinding);
00611 lua_pushcclosure(L, wxluabind_wxLuaBindClass__index, 1);
00612 lua_rawset(L, -3);
00613 lua_setmetatable(L, -2);
00614 }
00615
00616 lua_rawseti(L, -2, i + 1);
00617 }
00618
00619 return 1;
00620 }
00621
00622 return 0;
00623 }
00624 else if (strcmp(idx_str, "enums") == 0)
00625 {
00626 if (wxlClass->enums_n > 0)
00627 {
00628 wxLuaBindNumber* wxlNumber = wxlClass->enums;
00629 size_t idx, count = wxlClass->enums_n;
00630 lua_createtable(L, count, 0);
00631
00632 for (idx = 0; idx < count; ++idx, ++wxlNumber)
00633 {
00634
00635 lua_createtable(L, 0, 2);
00636 lua_pushstring(L, "name");
00637 lua_pushstring(L, wxlNumber->name);
00638 lua_rawset(L, -3);
00639 lua_pushstring(L, "value");
00640 lua_pushnumber(L, wxlNumber->value);
00641 lua_rawset(L, -3);
00642
00643 lua_rawseti(L, -2, idx + 1);
00644 }
00645
00646 lua_pushstring(L, "wxLuaBindClass");
00647 lua_pushvalue(L, 1);
00648 lua_rawset(L, -3);
00649
00650 return 1;
00651 }
00652
00653 return 0;
00654 }
00655 else if (strcmp(idx_str, "enums_n") == 0)
00656 {
00657 lua_pushnumber(L, wxlClass->enums_n);
00658 return 1;
00659 }
00660 }
00661
00662 return 0;
00663 }
00664
00665
00666
00667
00668
00669 int LUACALL wxluabind_wxLuaBinding__index(lua_State* L)
00670 {
00671 void **ptr = (void **)lua_touserdata(L, 1);
00672 wxLuaBinding* wxlBinding = (wxLuaBinding*)*ptr;
00673
00674 int idx_type = lua_type(L, 2);
00675
00676 if (idx_type == LUA_TSTRING)
00677 {
00678 const char* idx_str = lua_tostring(L, 2);
00679
00680 if (strcmp(idx_str, "GetBindingName") == 0)
00681 {
00682 lua_pushstring(L, wx2lua(wxlBinding->GetBindingName()));
00683 return 1;
00684 }
00685 else if (strcmp(idx_str, "GetLuaNamespace") == 0)
00686 {
00687 lua_pushstring(L, wx2lua(wxlBinding->GetLuaNamespace()));
00688 return 1;
00689 }
00690 else if (strcmp(idx_str, "GetClassCount") == 0)
00691 {
00692 lua_pushnumber(L, wxlBinding->GetClassCount());
00693 return 1;
00694 }
00695 else if (strcmp(idx_str, "GetNumberCount") == 0)
00696 {
00697 lua_pushnumber(L, wxlBinding->GetNumberCount());
00698 return 1;
00699 }
00700 else if (strcmp(idx_str, "GetStringCount") == 0)
00701 {
00702 lua_pushnumber(L, wxlBinding->GetStringCount());
00703 return 1;
00704 }
00705 else if (strcmp(idx_str, "GetEventCount") == 0)
00706 {
00707 lua_pushnumber(L, wxlBinding->GetEventCount());
00708 return 1;
00709 }
00710 else if (strcmp(idx_str, "GetObjectCount") == 0)
00711 {
00712 lua_pushnumber(L, wxlBinding->GetObjectCount());
00713 return 1;
00714 }
00715 else if (strcmp(idx_str, "GetFunctionCount") == 0)
00716 {
00717 lua_pushnumber(L, wxlBinding->GetFunctionCount());
00718 return 1;
00719 }
00720 else if (strcmp(idx_str, "GetClassArray") == 0)
00721 {
00722 wxLuaBindClass* wxlClass = wxlBinding->GetClassArray();
00723 size_t idx, count = wxlBinding->GetClassCount();
00724 lua_createtable(L, count, 0);
00725
00726 for (idx = 0; idx < count; ++idx, ++wxlClass)
00727 {
00728
00729 const void **ptr = (const void **)lua_newuserdata(L, sizeof(void *));
00730 *ptr = wxlClass;
00731 lua_newtable(L);
00732 lua_pushstring(L, "__index");
00733 lua_pushlightuserdata(L, wxlBinding);
00734 lua_pushcclosure(L, wxluabind_wxLuaBindClass__index, 1);
00735 lua_rawset(L, -3);
00736 lua_setmetatable(L, -2);
00737
00738 lua_rawseti(L, -2, idx + 1);
00739 }
00740
00741 return 1;
00742 }
00743 else if (strcmp(idx_str, "GetFunctionArray") == 0)
00744 {
00745 wxLuaBindMethod* wxlMethod = wxlBinding->GetFunctionArray();
00746 size_t idx, count = wxlBinding->GetFunctionCount();
00747 lua_createtable(L, count, 0);
00748
00749 for (idx = 0; idx < count; ++idx, ++wxlMethod)
00750 {
00751
00752 const void **ptr = (const void **)lua_newuserdata(L, sizeof(void *));
00753 *ptr = wxlMethod;
00754 lua_newtable(L);
00755 lua_pushstring(L, "__index");
00756 lua_pushlightuserdata(L, wxlBinding);
00757 lua_pushcclosure(L, wxluabind_wxLuaBindMethod__index, 1);
00758 lua_rawset(L, -3);
00759 lua_setmetatable(L, -2);
00760
00761 lua_rawseti(L, -2, idx + 1);
00762 }
00763
00764 return 1;
00765 }
00766 else if (strcmp(idx_str, "GetNumberArray") == 0)
00767 {
00768 wxLuaBindNumber* wxlNumber = wxlBinding->GetNumberArray();
00769 size_t idx, count = wxlBinding->GetNumberCount();
00770 lua_createtable(L, count, 0);
00771
00772 for (idx = 0; idx < count; ++idx, ++wxlNumber)
00773 {
00774
00775 lua_createtable(L, 0, 2);
00776 lua_pushstring(L, "name");
00777 lua_pushstring(L, wxlNumber->name);
00778 lua_rawset(L, -3);
00779 lua_pushstring(L, "value");
00780 lua_pushnumber(L, wxlNumber->value);
00781 lua_rawset(L, -3);
00782
00783 lua_rawseti(L, -2, idx + 1);
00784 }
00785
00786 return 1;
00787 }
00788 else if (strcmp(idx_str, "GetStringArray") == 0)
00789 {
00790 wxLuaBindString* wxlString = wxlBinding->GetStringArray();
00791 size_t idx, count = wxlBinding->GetStringCount();
00792 lua_createtable(L, count, 0);
00793
00794 for (idx = 0; idx < count; ++idx, ++wxlString)
00795 {
00796
00797 lua_createtable(L, 0, 2);
00798 lua_pushstring(L, "name");
00799 lua_pushstring(L, wxlString->name);
00800 lua_rawset(L, -3);
00801 lua_pushstring(L, "value");
00802 lua_pushstring(L, wx2lua(wxlString->value));
00803 lua_rawset(L, -3);
00804
00805 lua_rawseti(L, -2, idx + 1);
00806 }
00807
00808 return 1;
00809 }
00810 else if (strcmp(idx_str, "GetEventArray") == 0)
00811 {
00812 wxLuaBindEvent* wxlEvent = wxlBinding->GetEventArray();
00813 size_t idx, count = wxlBinding->GetEventCount();
00814 lua_createtable(L, count, 0);
00815
00816 for (idx = 0; idx < count; ++idx, ++wxlEvent)
00817 {
00818
00819 lua_createtable(L, 0, 3);
00820 lua_pushstring(L, "name");
00821 lua_pushstring(L, wxlEvent->name);
00822 lua_rawset(L, -3);
00823 lua_pushstring(L, "eventType");
00824 lua_pushnumber(L, *wxlEvent->eventType);
00825 lua_rawset(L, -3);
00826 lua_pushstring(L, "wxluatype");
00827 lua_pushnumber(L, *wxlEvent->wxluatype);
00828 lua_rawset(L, -3);
00829
00830 lua_pushstring(L, "wxLuaBindClass");
00831 const wxLuaBindClass* wxlClass = wxlBinding->GetBindClass(*wxlEvent->wxluatype);
00832 if (wxlClass == NULL)
00833 {
00834 lua_pushnil(L);
00835 }
00836 else
00837 {
00838 const void **ptr = (const void **)lua_newuserdata(L, sizeof(void *));
00839 *ptr = wxlClass;
00840 lua_newtable(L);
00841 lua_pushstring(L, "__index");
00842 lua_pushlightuserdata(L, wxlBinding);
00843 lua_pushcclosure(L, wxluabind_wxLuaBindClass__index, 1);
00844 lua_rawset(L, -3);
00845 lua_setmetatable(L, -2);
00846 }
00847 lua_rawset(L, -3);
00848
00849 lua_rawseti(L, -2, idx + 1);
00850 }
00851
00852 return 1;
00853 }
00854 else if (strcmp(idx_str, "GetObjectArray") == 0)
00855 {
00856 wxLuaBindObject* wxlObject = wxlBinding->GetObjectArray();
00857 size_t idx, count = wxlBinding->GetObjectCount();
00858 lua_createtable(L, count, 0);
00859
00860 for (idx = 0; idx < count; ++idx, ++wxlObject)
00861 {
00862
00863 lua_createtable(L, 0, 3);
00864 lua_pushstring(L, "name");
00865 lua_pushstring(L, wxlObject->name);
00866 lua_rawset(L, -3);
00867
00868 lua_pushstring(L, "object");
00869 if (wxlObject->objPtr != 0)
00870 wxluaT_pushuserdatatype(L, wxlObject->objPtr, *wxlObject->wxluatype, false);
00871 else
00872 wxluaT_pushuserdatatype(L, *wxlObject->pObjPtr, *wxlObject->wxluatype, false);
00873 lua_rawset(L, -3);
00874
00875 lua_pushstring(L, "wxluatype");
00876 lua_pushnumber(L, *wxlObject->wxluatype);
00877 lua_rawset(L, -3);
00878
00879 lua_pushstring(L, "wxLuaBindClass");
00880 const wxLuaBindClass* wxlClass = wxlBinding->GetBindClass(*wxlObject->wxluatype);
00881 if (wxlClass == NULL)
00882 {
00883 lua_pushnil(L);
00884 }
00885 else
00886 {
00887 const void **ptr = (const void **)lua_newuserdata(L, sizeof(void *));
00888 *ptr = wxlClass;
00889 lua_newtable(L);
00890 lua_pushstring(L, "__index");
00891 lua_pushlightuserdata(L, wxlBinding);
00892 lua_pushcclosure(L, wxluabind_wxLuaBindClass__index, 1);
00893 lua_rawset(L, -3);
00894 lua_setmetatable(L, -2);
00895 }
00896 lua_rawset(L, -3);
00897
00898 lua_rawseti(L, -2, idx + 1);
00899 }
00900
00901 return 1;
00902 }
00903 }
00904
00905 return 0;
00906 }
00907
00908
00909 static wxLuaBindCFunc s_wxluafunc_wxLua_function_GetBindings[1] = {{ wxLua_function_GetBindings, WXLUAMETHOD_CFUNCTION, 0, 0, g_wxluaargtypeArray_None }};
00910
00911 static wxLuaArgType s_wxluatypeArray_wxLua_function_GetGCUserdataInfo[] = { &wxluatype_TBOOLEAN, NULL };
00912
00913
00914 static int LUACALL wxLua_function_GetGCUserdataInfo(lua_State *L)
00915 {
00916 bool as_string = lua_toboolean(L, 1);
00917 if (as_string)
00918 wxlua_pushwxString(L, wxlua_concatwxArrayString(wxluaO_getgcobjectinfo(L)));
00919 else
00920 wxlua_pushwxArrayStringtable(L, wxluaO_getgcobjectinfo(L));
00921
00922 return 1;
00923 }
00924
00925 static wxLuaBindCFunc s_wxluafunc_wxLua_function_GetGCUserdataInfo[1] = {{ wxLua_function_GetGCUserdataInfo, WXLUAMETHOD_CFUNCTION, 0, 1, s_wxluatypeArray_wxLua_function_GetGCUserdataInfo }};
00926
00927 static wxLuaArgType s_wxluatypeArray_wxLua_function_GetTrackedEventCallbackInfo[] = { &wxluatype_TBOOLEAN, NULL };
00928
00929
00930 static int LUACALL wxLua_function_GetTrackedEventCallbackInfo(lua_State *L)
00931 {
00932 wxLuaState wxlState(L);
00933 bool as_string = lua_toboolean(L, 1);
00934 if (as_string)
00935 wxlua_pushwxString(L, wxlua_concatwxArrayString(wxlState.GetTrackedEventCallbackInfo()));
00936 else
00937 wxlua_pushwxArrayStringtable(L, wxlState.GetTrackedEventCallbackInfo());
00938
00939 return 1;
00940 }
00941
00942 static wxLuaBindCFunc s_wxluafunc_wxLua_function_GetTrackedEventCallbackInfo[1] = {{ wxLua_function_GetTrackedEventCallbackInfo, WXLUAMETHOD_CFUNCTION, 0, 1, s_wxluatypeArray_wxLua_function_GetTrackedEventCallbackInfo }};
00943
00944 static wxLuaArgType s_wxluatypeArray_wxLua_function_GetTrackedObjectInfo[] = { &wxluatype_TBOOLEAN, NULL };
00945
00946
00947 static int LUACALL wxLua_function_GetTrackedObjectInfo(lua_State *L)
00948 {
00949 bool as_string = lua_toboolean(L, 1);
00950 if (as_string)
00951 wxlua_pushwxString(L, wxlua_concatwxArrayString(wxluaO_gettrackedweakobjectinfo(L)));
00952 else
00953 wxlua_pushwxArrayStringtable(L, wxluaO_gettrackedweakobjectinfo(L));
00954
00955 return 1;
00956 }
00957
00958 static wxLuaBindCFunc s_wxluafunc_wxLua_function_GetTrackedObjectInfo[1] = {{ wxLua_function_GetTrackedObjectInfo, WXLUAMETHOD_CFUNCTION, 0, 1, s_wxluatypeArray_wxLua_function_GetTrackedObjectInfo }};
00959
00960 static wxLuaArgType s_wxluatypeArray_wxLua_function_GetTrackedWinDestroyCallbackInfo[] = { &wxluatype_TBOOLEAN, NULL };
00961
00962
00963 static int LUACALL wxLua_function_GetTrackedWinDestroyCallbackInfo(lua_State *L)
00964 {
00965 wxLuaState wxlState(L);
00966 bool as_string = lua_toboolean(L, 1);
00967 if (as_string)
00968 wxlua_pushwxString(L, wxlua_concatwxArrayString(wxlState.GetTrackedWinDestroyCallbackInfo()));
00969 else
00970 wxlua_pushwxArrayStringtable(L, wxlState.GetTrackedWinDestroyCallbackInfo());
00971
00972 return 1;
00973 }
00974
00975 static wxLuaBindCFunc s_wxluafunc_wxLua_function_GetTrackedWinDestroyCallbackInfo[1] = {{ wxLua_function_GetTrackedWinDestroyCallbackInfo, WXLUAMETHOD_CFUNCTION, 0, 1, s_wxluatypeArray_wxLua_function_GetTrackedWinDestroyCallbackInfo }};
00976
00977 static wxLuaArgType s_wxluatypeArray_wxLua_function_GetTrackedWindowInfo[] = { &wxluatype_TBOOLEAN, NULL };
00978
00979
00980 static int LUACALL wxLua_function_GetTrackedWindowInfo(lua_State *L)
00981 {
00982 bool as_string = lua_toboolean(L, 1);
00983 if (as_string)
00984 wxlua_pushwxString(L, wxlua_concatwxArrayString(wxluaW_gettrackedwindowinfo(L)));
00985 else
00986 wxlua_pushwxArrayStringtable(L, wxluaW_gettrackedwindowinfo(L));
00987
00988 return 1;
00989 }
00990
00991 static wxLuaBindCFunc s_wxluafunc_wxLua_function_GetTrackedWindowInfo[1] = {{ wxLua_function_GetTrackedWindowInfo, WXLUAMETHOD_CFUNCTION, 0, 1, s_wxluatypeArray_wxLua_function_GetTrackedWindowInfo }};
00992
00993 static wxLuaArgType s_wxluatypeArray_wxLua_function_isgcobject[] = { &wxluatype_TLIGHTUSERDATA, NULL };
00994
00995
00996 static int LUACALL wxLua_function_isgcobject(lua_State *L)
00997 {
00998 bool ret = false;
00999 if (wxlua_iswxuserdatatype(wxluaT_type(L, 1)))
01000 {
01001 void* obj_ptr = wxlua_touserdata(L, 1, false);
01002 ret = wxluaO_isgcobject(L, obj_ptr);
01003 }
01004
01005 lua_pushboolean(L, ret);
01006 return 1;
01007 }
01008
01009 static wxLuaBindCFunc s_wxluafunc_wxLua_function_isgcobject[1] = {{ wxLua_function_isgcobject, WXLUAMETHOD_CFUNCTION, 1, 1, s_wxluatypeArray_wxLua_function_isgcobject }};
01010
01011 static wxLuaArgType s_wxluatypeArray_wxLua_function_isrefed[] = { &wxluatype_TLIGHTUSERDATA, NULL };
01012
01013
01014 static int LUACALL wxLua_function_isrefed(lua_State *L)
01015 {
01016 bool ret = wxluaR_isrefed(L, 1, &wxlua_lreg_refs_key) != LUA_NOREF;
01017
01018 lua_pushboolean(L, ret);
01019 return 1;
01020 }
01021
01022 static wxLuaBindCFunc s_wxluafunc_wxLua_function_isrefed[1] = {{ wxLua_function_isrefed, WXLUAMETHOD_CFUNCTION, 1, 1, s_wxluatypeArray_wxLua_function_isrefed }};
01023
01024 static wxLuaArgType s_wxluatypeArray_wxLua_function_istrackedobject[] = { &wxluatype_TLIGHTUSERDATA, NULL };
01025
01026
01027 static int LUACALL wxLua_function_istrackedobject(lua_State *L)
01028 {
01029 bool ret = false;
01030 int wxl_type = wxluaT_type(L, 1);
01031
01032 if (wxlua_iswxuserdatatype(wxl_type))
01033 {
01034 void* obj_ptr = wxlua_touserdata(L, 1, false);
01035 ret = wxluaO_istrackedweakobject(L, obj_ptr, wxl_type, false);
01036 }
01037
01038 lua_pushboolean(L, ret);
01039 return 1;
01040 }
01041
01042 static wxLuaBindCFunc s_wxluafunc_wxLua_function_istrackedobject[1] = {{ wxLua_function_istrackedobject, WXLUAMETHOD_CFUNCTION, 1, 1, s_wxluatypeArray_wxLua_function_istrackedobject }};
01043
01044 static wxLuaArgType s_wxluatypeArray_wxLua_function_iswxluatype[] = { &wxluatype_TNUMBER, &wxluatype_TNUMBER, NULL };
01045
01046 static int LUACALL wxLua_function_iswxluatype(lua_State *L)
01047 {
01048
01049 int wxluaarg_tag = (int)wxlua_getnumbertype(L, 2);
01050
01051 int luatype = (int)wxlua_getnumbertype(L, 1);
01052
01053 int returns = (wxlua_iswxluatype(luatype, wxluaarg_tag));
01054
01055 lua_pushnumber(L, returns);
01056
01057 return 1;
01058 }
01059 static wxLuaBindCFunc s_wxluafunc_wxLua_function_iswxluatype[1] = {{ wxLua_function_iswxluatype, WXLUAMETHOD_CFUNCTION, 2, 2, s_wxluatypeArray_wxLua_function_iswxluatype }};
01060
01061 static wxLuaArgType s_wxluatypeArray_wxLua_function_type[] = { &wxluatype_TLIGHTUSERDATA, NULL };
01062
01063
01064 static int LUACALL wxLua_function_type(lua_State *L)
01065 {
01066 int ltype = lua_type(L, 1);
01067 const char* ltypename = lua_typename(L, ltype);
01068
01069 int wxl_type = wxluaT_type(L, 1);
01070 wxString wxltypeName = wxluaT_typename(L, wxl_type);
01071
01072
01073 lua_pushstring(L, wx2lua(wxltypeName));
01074 lua_pushnumber(L, wxl_type);
01075
01076 lua_pushstring(L, ltypename);
01077 lua_pushnumber(L, ltype);
01078
01079 return 4;
01080 }
01081
01082 static wxLuaBindCFunc s_wxluafunc_wxLua_function_type[1] = {{ wxLua_function_type, WXLUAMETHOD_CFUNCTION, 1, 1, s_wxluatypeArray_wxLua_function_type }};
01083
01084 static wxLuaArgType s_wxluatypeArray_wxLua_function_typename[] = { &wxluatype_TNUMBER, NULL };
01085
01086
01087 static int LUACALL wxLua_function_typename(lua_State *L)
01088 {
01089
01090 int wxl_type = (int)wxlua_getnumbertype(L, 1);
01091
01092 wxString returns = wxluaT_typename(L, wxl_type);
01093
01094 wxlua_pushwxString(L, returns);
01095
01096 return 1;
01097 }
01098
01099 static wxLuaBindCFunc s_wxluafunc_wxLua_function_typename[1] = {{ wxLua_function_typename, WXLUAMETHOD_CFUNCTION, 1, 1, s_wxluatypeArray_wxLua_function_typename }};
01100
01101 static wxLuaArgType s_wxluatypeArray_wxLua_function_ungcobject[] = { &wxluatype_TLIGHTUSERDATA, NULL };
01102
01103
01104 static int LUACALL wxLua_function_ungcobject(lua_State *L)
01105 {
01106 bool ret = false;
01107
01108 int l_type = lua_type(L, 1);
01109
01110 if (!wxlua_iswxluatype(l_type, WXLUA_TUSERDATA))
01111 wxlua_argerror(L, 1, wxT("a 'userdata'"));
01112
01113 void* o = wxlua_touserdata(L, 1, false);
01114
01115 if (wxluaO_isgcobject(L, o))
01116 {
01117 ret = wxluaO_undeletegcobject(L, o);
01118 }
01119
01120 lua_pushboolean(L, ret);
01121 return 1;
01122 }
01123
01124 static wxLuaBindCFunc s_wxluafunc_wxLua_function_ungcobject[1] = {{ wxLua_function_ungcobject, WXLUAMETHOD_CFUNCTION, 1, 1, s_wxluatypeArray_wxLua_function_ungcobject }};
01125
01126 static wxLuaArgType s_wxluatypeArray_wxLua_function_wxLUA_CHECK_VERSION[] = { &wxluatype_TNUMBER, &wxluatype_TNUMBER, &wxluatype_TNUMBER, NULL };
01127
01128 static int LUACALL wxLua_function_wxLUA_CHECK_VERSION(lua_State *L)
01129 {
01130
01131 int release = (int)wxlua_getnumbertype(L, 3);
01132
01133 int minor = (int)wxlua_getnumbertype(L, 2);
01134
01135 int major = (int)wxlua_getnumbertype(L, 1);
01136
01137 bool returns = (wxLUA_CHECK_VERSION(major, minor, release));
01138
01139 lua_pushboolean(L, returns);
01140
01141 return 1;
01142 }
01143 static wxLuaBindCFunc s_wxluafunc_wxLua_function_wxLUA_CHECK_VERSION[1] = {{ wxLua_function_wxLUA_CHECK_VERSION, WXLUAMETHOD_CFUNCTION, 3, 3, s_wxluatypeArray_wxLua_function_wxLUA_CHECK_VERSION }};
01144
01145 static wxLuaArgType s_wxluatypeArray_wxLua_function_wxLUA_CHECK_VERSION_FULL[] = { &wxluatype_TNUMBER, &wxluatype_TNUMBER, &wxluatype_TNUMBER, &wxluatype_TNUMBER, NULL };
01146
01147 static int LUACALL wxLua_function_wxLUA_CHECK_VERSION_FULL(lua_State *L)
01148 {
01149
01150 int subrel = (int)wxlua_getnumbertype(L, 4);
01151
01152 int release = (int)wxlua_getnumbertype(L, 3);
01153
01154 int minor = (int)wxlua_getnumbertype(L, 2);
01155
01156 int major = (int)wxlua_getnumbertype(L, 1);
01157
01158 bool returns = (wxLUA_CHECK_VERSION_FULL(major, minor, release, subrel));
01159
01160 lua_pushboolean(L, returns);
01161
01162 return 1;
01163 }
01164 static wxLuaBindCFunc s_wxluafunc_wxLua_function_wxLUA_CHECK_VERSION_FULL[1] = {{ wxLua_function_wxLUA_CHECK_VERSION_FULL, WXLUAMETHOD_CFUNCTION, 4, 4, s_wxluatypeArray_wxLua_function_wxLUA_CHECK_VERSION_FULL }};
01165
01166
01167
01168
01169
01170 wxLuaBindMethod* wxLuaGetFunctionList_wxlua(size_t &count)
01171 {
01172 static wxLuaBindMethod functionList[] =
01173 {
01174 { "CompileLuaScript", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_CompileLuaScript, 1, NULL },
01175 { "GetBindings", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_GetBindings, 1, NULL },
01176 { "GetGCUserdataInfo", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_GetGCUserdataInfo, 1, NULL },
01177 { "GetTrackedEventCallbackInfo", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_GetTrackedEventCallbackInfo, 1, NULL },
01178 { "GetTrackedObjectInfo", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_GetTrackedObjectInfo, 1, NULL },
01179 { "GetTrackedWinDestroyCallbackInfo", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_GetTrackedWinDestroyCallbackInfo, 1, NULL },
01180 { "GetTrackedWindowInfo", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_GetTrackedWindowInfo, 1, NULL },
01181 { "isgcobject", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_isgcobject, 1, NULL },
01182 { "isrefed", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_isrefed, 1, NULL },
01183 { "istrackedobject", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_istrackedobject, 1, NULL },
01184 { "iswxluatype", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_iswxluatype, 1, NULL },
01185 { "type", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_type, 1, NULL },
01186 { "typename", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_typename, 1, NULL },
01187 { "ungcobject", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_ungcobject, 1, NULL },
01188 { "wxLUA_CHECK_VERSION", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_wxLUA_CHECK_VERSION, 1, NULL },
01189 { "wxLUA_CHECK_VERSION_FULL", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_wxLUA_CHECK_VERSION_FULL, 1, NULL },
01190
01191 { 0, 0, 0, 0 },
01192 };
01193 count = sizeof(functionList)/sizeof(wxLuaBindMethod) - 1;
01194 return functionList;
01195 }
01196
01197
01198
01199
01200
01201
01202
01203 static const char* wxluaclassname_wxLuaObject = "wxLuaObject";
01204 static const char* wxluaclassname_wxLuaState = "wxLuaState";
01205 static const char* wxluaclassname_wxObject = "wxObject";
01206
01207 static const char* wxluabaseclassnames_wxLuaObject[] = { wxluaclassname_wxObject, NULL };
01208 static wxLuaBindClass* wxluabaseclassbinds_wxLuaObject[] = { NULL };
01209 static const char* wxluabaseclassnames_wxLuaState[] = { wxluaclassname_wxObject, NULL };
01210 static wxLuaBindClass* wxluabaseclassbinds_wxLuaState[] = { NULL };
01211
01212
01213
01214
01215 extern wxLuaBindMethod wxLuaObject_methods[];
01216 extern int wxLuaObject_methodCount;
01217 extern wxLuaBindMethod wxLuaState_methods[];
01218 extern int wxLuaState_methodCount;
01219
01220
01221
01222
01223 wxLuaBindClass* wxLuaGetClassList_wxlua(size_t &count)
01224 {
01225 static wxLuaBindClass classList[] =
01226 {
01227 { wxluaclassname_wxLuaObject, wxLuaObject_methods, wxLuaObject_methodCount, CLASSINFO(wxLuaObject), &wxluatype_wxLuaObject, wxluabaseclassnames_wxLuaObject, wxluabaseclassbinds_wxLuaObject, g_wxluanumberArray_None, 0, },
01228 { wxluaclassname_wxLuaState, wxLuaState_methods, wxLuaState_methodCount, CLASSINFO(wxLuaState), &wxluatype_wxLuaState, wxluabaseclassnames_wxLuaState, wxluabaseclassbinds_wxLuaState, g_wxluanumberArray_None, 0, },
01229
01230 { 0, 0, 0, 0, 0, 0, 0 },
01231 };
01232 count = sizeof(classList)/sizeof(wxLuaBindClass) - 1;
01233
01234 return classList;
01235 }
01236
01237
01238
01239
01240
01241 IMPLEMENT_DYNAMIC_CLASS(wxLuaBinding_wxlua, wxLuaBinding)
01242
01243 wxLuaBinding_wxlua::wxLuaBinding_wxlua() : wxLuaBinding()
01244 {
01245 m_bindingName = wxT("wxlua");
01246 m_nameSpace = wxT("wxlua");
01247 m_classArray = wxLuaGetClassList_wxlua(m_classCount);
01248 m_numberArray = wxLuaGetDefineList_wxlua(m_numberCount);
01249 m_stringArray = wxLuaGetStringList_wxlua(m_stringCount);
01250 m_eventArray = wxLuaGetEventList_wxlua(m_eventCount);
01251 m_objectArray = wxLuaGetObjectList_wxlua(m_objectCount);
01252 m_functionArray = wxLuaGetFunctionList_wxlua(m_functionCount);
01253 }
01254
01255 bool wxLuaBinding_wxlua::RegisterBinding(const wxLuaState& wxlState)
01256 {
01257 bool ret = wxLuaBinding::RegisterBinding(wxlState);
01258
01259 lua_State* L = wxlState.GetLuaState();
01260
01261 lua_pushlstring(L, "NULL", 4);
01262 wxluaT_pushuserdatatype(L, NULL, wxluatype_NULL, true, true);
01263 lua_rawset(L, -3);
01264
01265 return ret;
01266 }
01267
01268
01269
01270
01271 bool wxLuaBinding_wxlua_init()
01272 {
01273 static wxLuaBinding_wxlua m_binding;
01274 if (wxLuaBinding::GetBindingList()->Find(&m_binding)) return false;
01275
01276 wxLuaBinding::GetBindingList()->Append(&m_binding);
01277 return true;
01278 }
01279
01280