From: John L. <jr...@us...> - 2007-12-18 01:03:41
|
Update of /cvsroot/wxlua/wxLua/modules/wxbind/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv19598/wxLua/modules/wxbind/src Modified Files: wxaui_aui.cpp wxbase_bind.cpp wxbase_datetime.cpp wxbase_file.cpp wxcore_appframe.cpp wxcore_bind.cpp wxcore_gdi.cpp wxcore_image.cpp wxstc_stc.cpp Log Message: Cleanup: lua to Lua Fix various binding errors, wrong params for static wxFile functions Bump version to 2.8.7 Add wxImage::GetData(), wxMemoryInputStream Index: wxaui_aui.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxaui_aui.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** wxaui_aui.cpp 13 Dec 2007 06:23:54 -0000 1.11 --- wxaui_aui.cpp 18 Dec 2007 01:03:34 -0000 1.12 *************** *** 1661,1668 **** } static wxLuaArgTag s_wxluatagArray_wxLua_wxAuiTabCtrl_IsDragging[] = { &s_wxluatag_wxAuiTabCtrl, NULL }; static int LUACALL wxLua_wxAuiTabCtrl_IsDragging(lua_State *L); static wxLuaBindCFunc s_wxluafunc_wxLua_wxAuiTabCtrl_IsDragging[1] = {{ wxLua_wxAuiTabCtrl_IsDragging, WXLUAMETHOD_METHOD, 1, 1, s_wxluatagArray_wxLua_wxAuiTabCtrl_IsDragging }}; ! // bool IsDragging() const static int LUACALL wxLua_wxAuiTabCtrl_IsDragging(lua_State *L) { --- 1661,1670 ---- } + + #if (wxCHECK_VERSION(2,8,5)) && (wxLUA_USE_wxAUI && wxCHECK_VERSION(2,8,0) && wxUSE_AUI) static wxLuaArgTag s_wxluatagArray_wxLua_wxAuiTabCtrl_IsDragging[] = { &s_wxluatag_wxAuiTabCtrl, NULL }; static int LUACALL wxLua_wxAuiTabCtrl_IsDragging(lua_State *L); static wxLuaBindCFunc s_wxluafunc_wxLua_wxAuiTabCtrl_IsDragging[1] = {{ wxLua_wxAuiTabCtrl_IsDragging, WXLUAMETHOD_METHOD, 1, 1, s_wxluatagArray_wxLua_wxAuiTabCtrl_IsDragging }}; ! // %wxchkver_2_8_5 bool IsDragging() const static int LUACALL wxLua_wxAuiTabCtrl_IsDragging(lua_State *L) { *************** *** 1677,1680 **** --- 1679,1683 ---- } + #endif // (wxCHECK_VERSION(2,8,5)) && (wxLUA_USE_wxAUI && wxCHECK_VERSION(2,8,0) && wxUSE_AUI) #if (wxLUA_USE_wxAUI && wxCHECK_VERSION(2,8,0) && wxUSE_AUI) && (wxLUA_USE_wxDC) *************** *** 2068,2072 **** --- 2071,2078 ---- { "GetWindowFromIdx", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxAuiTabCtrl_GetWindowFromIdx, 1, NULL }, { "InsertPage", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxAuiTabCtrl_InsertPage, 1, NULL }, + + #if (wxCHECK_VERSION(2,8,5)) && (wxLUA_USE_wxAUI && wxCHECK_VERSION(2,8,0) && wxUSE_AUI) { "IsDragging", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxAuiTabCtrl_IsDragging, 1, NULL }, + #endif // (wxCHECK_VERSION(2,8,5)) && (wxLUA_USE_wxAUI && wxCHECK_VERSION(2,8,0) && wxUSE_AUI) #if (wxLUA_USE_wxAUI && wxCHECK_VERSION(2,8,0) && wxUSE_AUI) && (wxLUA_USE_wxDC) Index: wxbase_bind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxbase_bind.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** wxbase_bind.cpp 13 Dec 2007 00:47:49 -0000 1.8 --- wxbase_bind.cpp 18 Dec 2007 01:03:34 -0000 1.9 *************** *** 2281,2284 **** --- 2281,2288 ---- #endif // wxLUA_USE_wxConfig && wxUSE_CONFIG + #if wxUSE_STREAMS + { "wxMemoryInputStream", wxMemoryInputStream_methods, wxMemoryInputStream_methodCount, NULL, &s_wxluatag_wxMemoryInputStream, "wxInputStream", NULL ,s_wxluadefineArray_None, 0, }, + #endif // wxUSE_STREAMS + { "wxMimeTypesManager", wxMimeTypesManager_methods, wxMimeTypesManager_methodCount, NULL, &s_wxluatag_wxMimeTypesManager, NULL, NULL ,s_wxluadefineArray_None, 0, }, *************** *** 2534,2537 **** --- 2538,2542 ---- wxLUA_IMPLEMENT_ENCAPSULATION(wxFileInputStream, wxFileInputStream) wxLUA_IMPLEMENT_ENCAPSULATION(wxFileOutputStream, wxFileOutputStream) + wxLUA_IMPLEMENT_ENCAPSULATION(wxMemoryInputStream, wxMemoryInputStream) #endif // wxUSE_STREAMS Index: wxcore_appframe.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxcore_appframe.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** wxcore_appframe.cpp 13 Dec 2007 00:47:49 -0000 1.5 --- wxcore_appframe.cpp 18 Dec 2007 01:03:34 -0000 1.6 *************** *** 175,181 **** --- 175,195 ---- } + static int LUACALL wxLua_wxApp_IsMainLoopRunning(lua_State *L); + static wxLuaBindCFunc s_wxluafunc_wxLua_wxApp_IsMainLoopRunning[1] = {{ wxLua_wxApp_IsMainLoopRunning, WXLUAMETHOD_METHOD|WXLUAMETHOD_STATIC, 0, 0, s_wxluaargArray_None }}; + // static bool IsMainLoopRunning() + static int LUACALL wxLua_wxApp_IsMainLoopRunning(lua_State *L) + { + // call IsMainLoopRunning + bool returns = (wxApp::IsMainLoopRunning()); + // push the result flag + lua_pushboolean(L, returns); + + return 1; + } + static wxLuaArgTag s_wxluatagArray_wxLua_wxApp_MainLoop[] = { &s_wxluatag_wxApp, NULL }; static int LUACALL wxLua_wxApp_MainLoop(lua_State *L); static wxLuaBindCFunc s_wxluafunc_wxLua_wxApp_MainLoop[1] = {{ wxLua_wxApp_MainLoop, WXLUAMETHOD_METHOD, 1, 1, s_wxluatagArray_wxLua_wxApp_MainLoop }}; + // %override wxLua_wxApp_MainLoop // int MainLoop() static int LUACALL wxLua_wxApp_MainLoop(lua_State *L) *************** *** 184,188 **** wxApp * self = (wxApp *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxApp); // call MainLoop ! int returns = (self->MainLoop()); // push the result number lua_pushnumber(L, returns); --- 198,202 ---- wxApp * self = (wxApp *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxApp); // call MainLoop ! int returns = !wxApp::IsMainLoopRunning() ? (self->MainLoop()) : 0; // push the result number lua_pushnumber(L, returns); *************** *** 191,194 **** --- 205,209 ---- } + static wxLuaArgTag s_wxluatagArray_wxLua_wxApp_Pending[] = { &s_wxluatag_wxApp, NULL }; static int LUACALL wxLua_wxApp_Pending(lua_State *L); *************** *** 341,344 **** --- 356,360 ---- { "GetVendorName", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxApp_GetVendorName, 1, NULL }, { "IsActive", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxApp_IsActive, 1, NULL }, + { "IsMainLoopRunning", WXLUAMETHOD_METHOD|WXLUAMETHOD_STATIC, s_wxluafunc_wxLua_wxApp_IsMainLoopRunning, 1, NULL }, { "MainLoop", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxApp_MainLoop, 1, NULL }, { "Pending", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxApp_Pending, 1, NULL }, Index: wxstc_stc.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxstc_stc.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** wxstc_stc.cpp 13 Dec 2007 00:47:51 -0000 1.8 --- wxstc_stc.cpp 18 Dec 2007 01:03:34 -0000 1.9 *************** *** 5892,5896 **** { // const wxString &styleBytes ! wxCharBuffer styleBytes(lua_tostring(L, 3)); // int length int length = (int)lua_tonumber(L, 2); --- 5892,5896 ---- { // const wxString &styleBytes ! char* styleBytes = (char*)lua_tostring(L, 3); // int length int length = (int)lua_tonumber(L, 2); *************** *** 5898,5906 **** wxStyledTextCtrl *self = (wxStyledTextCtrl *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxStyledTextCtrl); // call SetStyleBytes ! self->SetStyleBytes(length, styleBytes.data()); ! // push result ! lua_pushstring(L, styleBytes); // return the number of parameters ! return 1; } --- 5898,5904 ---- wxStyledTextCtrl *self = (wxStyledTextCtrl *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxStyledTextCtrl); // call SetStyleBytes ! self->SetStyleBytes(length, styleBytes); // return the number of parameters ! return 0; } Index: wxbase_datetime.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxbase_datetime.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** wxbase_datetime.cpp 13 Dec 2007 00:47:49 -0000 1.7 --- wxbase_datetime.cpp 18 Dec 2007 01:03:34 -0000 1.8 *************** *** 798,802 **** static int LUACALL wxLua_wxDateTime_Set(lua_State *L); static wxLuaBindCFunc s_wxluafunc_wxLua_wxDateTime_Set[1] = {{ wxLua_wxDateTime_Set, WXLUAMETHOD_METHOD, 2, 2, s_wxluatagArray_wxLua_wxDateTime_Set }}; ! // wxDateTime& Set(time_t time) // use with lua's os.time() on MSW, Linux, others? static int LUACALL wxLua_wxDateTime_Set(lua_State *L) { --- 798,802 ---- static int LUACALL wxLua_wxDateTime_Set(lua_State *L); static wxLuaBindCFunc s_wxluafunc_wxLua_wxDateTime_Set[1] = {{ wxLua_wxDateTime_Set, WXLUAMETHOD_METHOD, 2, 2, s_wxluatagArray_wxLua_wxDateTime_Set }}; ! // wxDateTime& Set(time_t time) // use with Lua's os.time() on MSW, Linux, others? static int LUACALL wxLua_wxDateTime_Set(lua_State *L) { *************** *** 1300,1304 **** static int LUACALL wxLua_wxDateTime_constructor1(lua_State *L); // static wxLuaBindCFunc s_wxluafunc_wxLua_wxDateTime_constructor1[1] = {{ wxLua_wxDateTime_constructor1, WXLUAMETHOD_CONSTRUCTOR, 1, 1, s_wxluatagArray_wxLua_wxDateTime_constructor1 }}; ! // wxDateTime(time_t dateTime) // use with lua's os.time() on MSW, Linux, others? static int LUACALL wxLua_wxDateTime_constructor1(lua_State *L) { --- 1300,1304 ---- static int LUACALL wxLua_wxDateTime_constructor1(lua_State *L); // static wxLuaBindCFunc s_wxluafunc_wxLua_wxDateTime_constructor1[1] = {{ wxLua_wxDateTime_constructor1, WXLUAMETHOD_CONSTRUCTOR, 1, 1, s_wxluatagArray_wxLua_wxDateTime_constructor1 }}; ! // wxDateTime(time_t dateTime) // use with Lua's os.time() on MSW, Linux, others? static int LUACALL wxLua_wxDateTime_constructor1(lua_State *L) { Index: wxcore_bind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxcore_bind.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** wxcore_bind.cpp 13 Dec 2007 00:47:49 -0000 1.10 --- wxcore_bind.cpp 18 Dec 2007 01:03:34 -0000 1.11 *************** *** 2595,2598 **** --- 2595,2605 ---- #if (wxLUA_USE_wxImage && wxUSE_IMAGE) && (wxUSE_LIBTIFF) { "wxIMAGE_OPTION_BITSPERSAMPLE", _T("BitsPerSample") }, + #endif // (wxLUA_USE_wxImage && wxUSE_IMAGE) && (wxUSE_LIBTIFF) + + #if wxLUA_USE_wxImage && wxUSE_IMAGE + { "wxIMAGE_OPTION_BMP_FORMAT", wxIMAGE_OPTION_BMP_FORMAT }, + #endif // wxLUA_USE_wxImage && wxUSE_IMAGE + + #if (wxLUA_USE_wxImage && wxUSE_IMAGE) && (wxUSE_LIBTIFF) { "wxIMAGE_OPTION_COMPRESSION", _T("Compression") }, #endif // (wxLUA_USE_wxImage && wxUSE_IMAGE) && (wxUSE_LIBTIFF) Index: wxbase_file.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxbase_file.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** wxbase_file.cpp 13 Dec 2007 00:47:49 -0000 1.7 --- wxbase_file.cpp 18 Dec 2007 01:03:34 -0000 1.8 *************** *** 2014,2023 **** int argCount = lua_gettop(L); // wxPathFormat format = wxPATH_NATIVE ! wxPathFormat format = (argCount >= 2 ? (wxPathFormat)wxlua_getintegertype(L, 3) : wxPATH_NATIVE); wxString ext; wxString name; wxString path; // const wxString& fullpath ! wxString fullpath = wxlua_getwxStringtype(L, 2); // call SplitPath wxFileName::SplitPath(fullpath, &path, &name, &ext, format); --- 2014,2023 ---- int argCount = lua_gettop(L); // wxPathFormat format = wxPATH_NATIVE ! wxPathFormat format = (argCount >= 2 ? (wxPathFormat)wxlua_getintegertype(L, 2) : wxPATH_NATIVE); wxString ext; wxString name; wxString path; // const wxString& fullpath ! wxString fullpath = wxlua_getwxStringtype(L, 1); // call SplitPath wxFileName::SplitPath(fullpath, &path, &name, &ext, format); *************** *** 2041,2045 **** int argCount = lua_gettop(L); // wxPathFormat format = wxPATH_NATIVE ! wxPathFormat format = (argCount >= 2 ? (wxPathFormat)wxlua_getintegertype(L, 3) : wxPATH_NATIVE); wxString ext; wxString name; --- 2041,2045 ---- int argCount = lua_gettop(L); // wxPathFormat format = wxPATH_NATIVE ! wxPathFormat format = (argCount >= 2 ? (wxPathFormat)wxlua_getintegertype(L, 2) : wxPATH_NATIVE); wxString ext; wxString name; *************** *** 2047,2051 **** wxString volume; // const wxString& fullpath ! wxString fullpath = wxlua_getwxStringtype(L, 2); // call SplitPath wxFileName::SplitPath(fullpath, &volume, &path, &name, &ext, format); --- 2047,2051 ---- wxString volume; // const wxString& fullpath ! wxString fullpath = wxlua_getwxStringtype(L, 1); // call SplitPath wxFileName::SplitPath(fullpath, &volume, &path, &name, &ext, format); *************** *** 2070,2076 **** int argCount = lua_gettop(L); // wxPathFormat format = wxPATH_NATIVE ! wxPathFormat format = (argCount >= 3 ? (wxPathFormat)wxlua_getintegertype(L, 3) : wxPATH_NATIVE); // const wxString fullpath ! const wxString fullpath = wxlua_getwxStringtype(L, 2); wxString volume; wxString path; --- 2070,2076 ---- int argCount = lua_gettop(L); // wxPathFormat format = wxPATH_NATIVE ! wxPathFormat format = (argCount >= 2 ? (wxPathFormat)wxlua_getintegertype(L, 2) : wxPATH_NATIVE); // const wxString fullpath ! const wxString fullpath = wxlua_getwxStringtype(L, 1); wxString volume; wxString path; *************** *** 2918,2922 **** // push the result number lua_pushnumber(L, returns); ! lua_pushlstring(L, (const char *) buffer, count); free(buffer); // return the number of parameters --- 2918,2922 ---- // push the result number lua_pushnumber(L, returns); ! lua_pushlstring(L, (const char *) buffer, returns); free(buffer); // return the number of parameters *************** *** 5696,5699 **** --- 5696,5749 ---- #if wxUSE_STREAMS // --------------------------------------------------------------------------- + // Bind class wxMemoryInputStream + // --------------------------------------------------------------------------- + + // Lua MetaTable Tag for Class 'wxMemoryInputStream' + int s_wxluatag_wxMemoryInputStream = -1; + + static wxLuaArgTag s_wxluatagArray_wxLua_wxMemoryInputStream_delete[] = { &s_wxluatag_wxMemoryInputStream, NULL }; + static wxLuaBindCFunc s_wxluafunc_wxLua_wxMemoryInputStream_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxMemoryInputStream_delete }}; + + static wxLuaArgTag s_wxluatagArray_wxLua_wxMemoryInputStream_constructor[] = { &s_wxluaarg_String, &s_wxluaarg_Number, NULL }; + static int LUACALL wxLua_wxMemoryInputStream_constructor(lua_State *L); + static wxLuaBindCFunc s_wxluafunc_wxLua_wxMemoryInputStream_constructor[1] = {{ wxLua_wxMemoryInputStream_constructor, WXLUAMETHOD_CONSTRUCTOR, 2, 2, s_wxluatagArray_wxLua_wxMemoryInputStream_constructor }}; + // %override wxLua_wxMemoryInputStream_constructor + // wxMemoryInputStream(const char *data, size_t length) + static int LUACALL wxLua_wxMemoryInputStream_constructor(lua_State *L) + { + wxluabind_removetableforcall(L); + // size_t length + size_t length = (size_t)wxlua_getnumbertype(L, 2); + // const char data + const char* data = (const char*)wxlua_getstringtype(L, 1); + // call constructor + wxMemoryInputStream* returns = new wxMemoryInputStream(data, length); + // add to tracked memory list + wxluaO_addgcobject(L, (void*)returns, new wxLua_wxObject_wxMemoryInputStream((wxMemoryInputStream*)returns)); + // push the constructed class pointer + wxluaT_pushuserdatatype(L, s_wxluatag_wxMemoryInputStream, returns); + + return 1; + } + + + + + + // Map Lua Class Methods to C Binding Functions + wxLuaBindMethod wxMemoryInputStream_methods[] = { + { "delete", WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, s_wxluafunc_wxLua_wxMemoryInputStream_delete, 1, NULL }, + { "wxMemoryInputStream", WXLUAMETHOD_CONSTRUCTOR, s_wxluafunc_wxLua_wxMemoryInputStream_constructor, 1, NULL }, + + { 0, 0, 0, 0 }, + }; + + int wxMemoryInputStream_methodCount = sizeof(wxMemoryInputStream_methods)/sizeof(wxLuaBindMethod) - 1; + + #endif // wxUSE_STREAMS + + + #if wxUSE_STREAMS + // --------------------------------------------------------------------------- // Bind class wxDataInputStream // --------------------------------------------------------------------------- Index: wxcore_gdi.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxcore_gdi.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** wxcore_gdi.cpp 13 Dec 2007 06:23:54 -0000 1.10 --- wxcore_gdi.cpp 18 Dec 2007 01:03:34 -0000 1.11 *************** *** 8071,8078 **** #if (wxLUA_USE_wxBitmap) && ((defined(__WXMSW__)) && (wxLUA_USE_wxBitmap)) ! #define wxLua_wxBitmap_constructor6 wxLua_wxBitmapFromData_constructor ! static wxLuaArgTag s_wxluatagArray_wxLua_wxBitmap_constructor6[] = { &s_wxluaarg_String, &s_wxluaarg_Number, &s_wxluaarg_Number, &s_wxluaarg_Number, &s_wxluaarg_Number, NULL }; ! static int LUACALL wxLua_wxBitmap_constructor6(lua_State *L); ! // static wxLuaBindCFunc s_wxluafunc_wxLua_wxBitmap_constructor6[1] = {{ wxLua_wxBitmap_constructor6, WXLUAMETHOD_CONSTRUCTOR, 4, 5, s_wxluatagArray_wxLua_wxBitmap_constructor6 }}; // %override wxLua_wxBitmapFromData_constructor // %win wxBitmap(void* data, int type, int width, int height, int depth = -1) --- 8071,8078 ---- #if (wxLUA_USE_wxBitmap) && ((defined(__WXMSW__)) && (wxLUA_USE_wxBitmap)) ! #define wxLua_wxBitmap_constructor7 wxLua_wxBitmapFromData_constructor ! static wxLuaArgTag s_wxluatagArray_wxLua_wxBitmap_constructor7[] = { &s_wxluaarg_String, &s_wxluaarg_Number, &s_wxluaarg_Number, &s_wxluaarg_Number, &s_wxluaarg_Number, NULL }; ! static int LUACALL wxLua_wxBitmap_constructor7(lua_State *L); ! // static wxLuaBindCFunc s_wxluafunc_wxLua_wxBitmap_constructor7[1] = {{ wxLua_wxBitmap_constructor7, WXLUAMETHOD_CONSTRUCTOR, 5, 5, s_wxluatagArray_wxLua_wxBitmap_constructor7 }}; // %override wxLua_wxBitmapFromData_constructor // %win wxBitmap(void* data, int type, int width, int height, int depth = -1) *************** *** 8108,8115 **** #endif // (wxLUA_USE_wxBitmap) && ((defined(__WXMSW__)) && (wxLUA_USE_wxBitmap)) ! #define wxLua_wxBitmap_constructor5 wxLua_wxBitmapFromXPMData_constructor ! static wxLuaArgTag s_wxluatagArray_wxLua_wxBitmap_constructor5[] = { &s_wxluaarg_Table, NULL }; ! static int LUACALL wxLua_wxBitmap_constructor5(lua_State *L); ! // static wxLuaBindCFunc s_wxluafunc_wxLua_wxBitmap_constructor5[1] = {{ wxLua_wxBitmap_constructor5, WXLUAMETHOD_CONSTRUCTOR, 1, 1, s_wxluatagArray_wxLua_wxBitmap_constructor5 }}; // %override wxLua_wxBitmapFromXPMData_constructor // %constructor wxXmlResourceGetDefault() --- 8108,8115 ---- #endif // (wxLUA_USE_wxBitmap) && ((defined(__WXMSW__)) && (wxLUA_USE_wxBitmap)) ! #define wxLua_wxBitmap_constructor6 wxLua_wxBitmapFromXPMData_constructor ! static wxLuaArgTag s_wxluatagArray_wxLua_wxBitmap_constructor6[] = { &s_wxluaarg_Table, NULL }; ! static int LUACALL wxLua_wxBitmap_constructor6(lua_State *L); ! // static wxLuaBindCFunc s_wxluafunc_wxLua_wxBitmap_constructor6[1] = {{ wxLua_wxBitmap_constructor6, WXLUAMETHOD_CONSTRUCTOR, 1, 1, s_wxluatagArray_wxLua_wxBitmap_constructor6 }}; // %override wxLua_wxBitmapFromXPMData_constructor // %constructor wxXmlResourceGetDefault() *************** *** 8138,8141 **** --- 8138,8172 ---- + #define wxLua_wxBitmap_constructor5 wxLua_wxBitmapFromBits_constructor + static wxLuaArgTag s_wxluatagArray_wxLua_wxBitmap_constructor5[] = { &s_wxluaarg_String, &s_wxluaarg_Number, &s_wxluaarg_Number, &s_wxluaarg_Number, NULL }; + static int LUACALL wxLua_wxBitmap_constructor5(lua_State *L); + // static wxLuaBindCFunc s_wxluafunc_wxLua_wxBitmap_constructor5[1] = {{ wxLua_wxBitmap_constructor5, WXLUAMETHOD_CONSTRUCTOR, 4, 4, s_wxluatagArray_wxLua_wxBitmap_constructor5 }}; + // %override wxLua_wxBitmapFromBits_constructor + // %win wxBitmap(const char* bits, int width, int height, int depth = -1) + static int LUACALL wxLua_wxBitmapFromBits_constructor(lua_State *L) + { + wxluabind_removetableforcall(L); + + // get number of arguments + int argCount = lua_gettop(L); + // int depth = -1 + int depth = (argCount >= 4 ? (int)wxlua_getintegertype(L, 4) : -1); + // int height + int height = (int)wxlua_getintegertype(L, 3); + // int width + int width = (int)wxlua_getintegertype(L, 2); + // const char* bits + const char *bits = (const char *)lua_tostring(L, 1); + // call constructor + wxBitmap *returns = new wxBitmap(bits, width, height, depth); + // add to tracked memory list + wxluaO_addgcobject(L, returns); + // push the constructed class pointer + wxluaT_pushuserdatatype(L, s_wxluatag_wxBitmap, returns); + // return the number of parameters + return 1; + } + + #if (wxLUA_USE_wxImage && wxUSE_IMAGE) && (wxLUA_USE_wxBitmap) *************** *** 8259,8265 **** #if (wxLUA_USE_wxBitmap) && ((defined(__WXMSW__)) && (wxLUA_USE_wxBitmap)) ! { wxLua_wxBitmap_constructor6, WXLUAMETHOD_CONSTRUCTOR, 4, 5, s_wxluatagArray_wxLua_wxBitmap_constructor6 }, #endif // (wxLUA_USE_wxBitmap) && ((defined(__WXMSW__)) && (wxLUA_USE_wxBitmap)) ! { wxLua_wxBitmap_constructor5, WXLUAMETHOD_CONSTRUCTOR, 1, 1, s_wxluatagArray_wxLua_wxBitmap_constructor5 }, #if (wxLUA_USE_wxImage && wxUSE_IMAGE) && (wxLUA_USE_wxBitmap) --- 8290,8297 ---- #if (wxLUA_USE_wxBitmap) && ((defined(__WXMSW__)) && (wxLUA_USE_wxBitmap)) ! { wxLua_wxBitmap_constructor7, WXLUAMETHOD_CONSTRUCTOR, 5, 5, s_wxluatagArray_wxLua_wxBitmap_constructor7 }, #endif // (wxLUA_USE_wxBitmap) && ((defined(__WXMSW__)) && (wxLUA_USE_wxBitmap)) ! { wxLua_wxBitmap_constructor6, WXLUAMETHOD_CONSTRUCTOR, 1, 1, s_wxluatagArray_wxLua_wxBitmap_constructor6 }, ! { wxLua_wxBitmap_constructor5, WXLUAMETHOD_CONSTRUCTOR, 4, 4, s_wxluatagArray_wxLua_wxBitmap_constructor5 }, #if (wxLUA_USE_wxImage && wxUSE_IMAGE) && (wxLUA_USE_wxBitmap) Index: wxcore_image.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxcore_image.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** wxcore_image.cpp 13 Dec 2007 06:23:54 -0000 1.9 --- wxcore_image.cpp 18 Dec 2007 01:03:34 -0000 1.10 *************** *** 393,396 **** --- 393,414 ---- } + static wxLuaArgTag s_wxluatagArray_wxLua_wxImage_GetData[] = { &s_wxluatag_wxImage, NULL }; + static int LUACALL wxLua_wxImage_GetData(lua_State *L); + static wxLuaBindCFunc s_wxluafunc_wxLua_wxImage_GetData[1] = {{ wxLua_wxImage_GetData, WXLUAMETHOD_METHOD, 1, 1, s_wxluatagArray_wxLua_wxImage_GetData }}; + // %override wxLua_wxImage_GetData + // unsigned char* GetData() const + static int LUACALL wxLua_wxImage_GetData(lua_State *L) + { + // get this + wxImage * self = (wxImage *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxImage); + // call GetData + char* returns = (char*)self->GetData(); + // push the result pointer + lua_pushlstring(L, returns, self->GetWidth()*self->GetHeight()*3); + + return 1; + } + + static wxLuaArgTag s_wxluatagArray_wxLua_wxImage_GetGreen[] = { &s_wxluatag_wxImage, &s_wxluaarg_Number, &s_wxluaarg_Number, NULL }; static int LUACALL wxLua_wxImage_GetGreen(lua_State *L); *************** *** 833,840 **** #if (wxUSE_STREAMS) && (wxLUA_USE_wxImage && wxUSE_IMAGE) static wxLuaArgTag s_wxluatagArray_wxLua_wxImage_LoadFile2[] = { &s_wxluatag_wxImage, &s_wxluatag_wxInputStream, &s_wxluaarg_Number, &s_wxluaarg_Number, NULL }; static int LUACALL wxLua_wxImage_LoadFile2(lua_State *L); ! // static wxLuaBindCFunc s_wxluafunc_wxLua_wxImage_LoadFile2[1] = {{ wxLua_wxImage_LoadFile2, WXLUAMETHOD_METHOD, 3, 4, s_wxluatagArray_wxLua_wxImage_LoadFile2 }}; ! // bool LoadFile(wxInputStream& stream, long type, int index = -1) static int LUACALL wxLua_wxImage_LoadFile2(lua_State *L) { --- 851,882 ---- #if (wxUSE_STREAMS) && (wxLUA_USE_wxImage && wxUSE_IMAGE) + static wxLuaArgTag s_wxluatagArray_wxLua_wxImage_LoadFile3[] = { &s_wxluatag_wxImage, &s_wxluatag_wxInputStream, &s_wxluaarg_String, &s_wxluaarg_Number, NULL }; + static int LUACALL wxLua_wxImage_LoadFile3(lua_State *L); + // static wxLuaBindCFunc s_wxluafunc_wxLua_wxImage_LoadFile3[1] = {{ wxLua_wxImage_LoadFile3, WXLUAMETHOD_METHOD, 3, 4, s_wxluatagArray_wxLua_wxImage_LoadFile3 }}; + // bool LoadFile(wxInputStream& stream, const wxString& mimetype, int index = -1) + static int LUACALL wxLua_wxImage_LoadFile3(lua_State *L) + { + // get number of arguments + int argCount = lua_gettop(L); + // int index = -1 + int index = (argCount >= 4 ? (int)wxlua_getnumbertype(L, 4) : -1); + // const wxString mimetype + const wxString mimetype = wxlua_getwxStringtype(L, 3); + // wxInputStream stream + wxInputStream * stream = (wxInputStream *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxInputStream); + // get this + wxImage * self = (wxImage *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxImage); + // call LoadFile + bool returns = (self->LoadFile(*stream, mimetype, index)); + // push the result flag + lua_pushboolean(L, returns); + + return 1; + } + static wxLuaArgTag s_wxluatagArray_wxLua_wxImage_LoadFile2[] = { &s_wxluatag_wxImage, &s_wxluatag_wxInputStream, &s_wxluaarg_Number, &s_wxluaarg_Number, NULL }; static int LUACALL wxLua_wxImage_LoadFile2(lua_State *L); ! // static wxLuaBindCFunc s_wxluafunc_wxLua_wxImage_LoadFile2[1] = {{ wxLua_wxImage_LoadFile2, WXLUAMETHOD_METHOD, 2, 4, s_wxluatagArray_wxLua_wxImage_LoadFile2 }}; ! // bool LoadFile(wxInputStream& stream, long type = wxBITMAP_TYPE_ANY, int index = -1) static int LUACALL wxLua_wxImage_LoadFile2(lua_State *L) { *************** *** 843,848 **** // int index = -1 int index = (argCount >= 4 ? (int)wxlua_getnumbertype(L, 4) : -1); ! // long type ! long type = (long)wxlua_getnumbertype(L, 3); // wxInputStream stream wxInputStream * stream = (wxInputStream *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxInputStream); --- 885,890 ---- // int index = -1 int index = (argCount >= 4 ? (int)wxlua_getnumbertype(L, 4) : -1); ! // long type = wxBITMAP_TYPE_ANY ! long type = (argCount >= 3 ? (long)wxlua_getnumbertype(L, 3) : wxBITMAP_TYPE_ANY); // wxInputStream stream wxInputStream * stream = (wxInputStream *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxInputStream); *************** *** 859,868 **** #endif // (wxUSE_STREAMS) && (wxLUA_USE_wxImage && wxUSE_IMAGE) ! static wxLuaArgTag s_wxluatagArray_wxLua_wxImage_LoadFile1[] = { &s_wxluatag_wxImage, &s_wxluaarg_String, &s_wxluaarg_String, NULL }; static int LUACALL wxLua_wxImage_LoadFile1(lua_State *L); ! // static wxLuaBindCFunc s_wxluafunc_wxLua_wxImage_LoadFile1[1] = {{ wxLua_wxImage_LoadFile1, WXLUAMETHOD_METHOD, 3, 3, s_wxluatagArray_wxLua_wxImage_LoadFile1 }}; ! // bool LoadFile(const wxString& name, const wxString& mimetype) static int LUACALL wxLua_wxImage_LoadFile1(lua_State *L) { // const wxString mimetype const wxString mimetype = wxlua_getwxStringtype(L, 3); --- 901,914 ---- #endif // (wxUSE_STREAMS) && (wxLUA_USE_wxImage && wxUSE_IMAGE) ! static wxLuaArgTag s_wxluatagArray_wxLua_wxImage_LoadFile1[] = { &s_wxluatag_wxImage, &s_wxluaarg_String, &s_wxluaarg_String, &s_wxluaarg_Number, NULL }; static int LUACALL wxLua_wxImage_LoadFile1(lua_State *L); ! // static wxLuaBindCFunc s_wxluafunc_wxLua_wxImage_LoadFile1[1] = {{ wxLua_wxImage_LoadFile1, WXLUAMETHOD_METHOD, 3, 4, s_wxluatagArray_wxLua_wxImage_LoadFile1 }}; ! // bool LoadFile(const wxString& name, const wxString& mimetype, int index = -1) static int LUACALL wxLua_wxImage_LoadFile1(lua_State *L) { + // get number of arguments + int argCount = lua_gettop(L); + // int index = -1 + int index = (argCount >= 4 ? (int)wxlua_getnumbertype(L, 4) : -1); // const wxString mimetype const wxString mimetype = wxlua_getwxStringtype(L, 3); *************** *** 872,876 **** wxImage * self = (wxImage *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxImage); // call LoadFile ! bool returns = (self->LoadFile(name, mimetype)); // push the result flag lua_pushboolean(L, returns); --- 918,922 ---- wxImage * self = (wxImage *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxImage); // call LoadFile ! bool returns = (self->LoadFile(name, mimetype, index)); // push the result flag lua_pushboolean(L, returns); *************** *** 879,890 **** } ! static wxLuaArgTag s_wxluatagArray_wxLua_wxImage_LoadFile[] = { &s_wxluatag_wxImage, &s_wxluaarg_String, &s_wxluaarg_Number, NULL }; static int LUACALL wxLua_wxImage_LoadFile(lua_State *L); ! // static wxLuaBindCFunc s_wxluafunc_wxLua_wxImage_LoadFile[1] = {{ wxLua_wxImage_LoadFile, WXLUAMETHOD_METHOD, 2, 3, s_wxluatagArray_wxLua_wxImage_LoadFile }}; ! // bool LoadFile(const wxString& name, long type = wxBITMAP_TYPE_ANY) static int LUACALL wxLua_wxImage_LoadFile(lua_State *L) { // get number of arguments int argCount = lua_gettop(L); // long type = wxBITMAP_TYPE_ANY long type = (argCount >= 3 ? (long)wxlua_getnumbertype(L, 3) : wxBITMAP_TYPE_ANY); --- 925,938 ---- } ! static wxLuaArgTag s_wxluatagArray_wxLua_wxImage_LoadFile[] = { &s_wxluatag_wxImage, &s_wxluaarg_String, &s_wxluaarg_Number, &s_wxluaarg_Number, NULL }; static int LUACALL wxLua_wxImage_LoadFile(lua_State *L); ! // static wxLuaBindCFunc s_wxluafunc_wxLua_wxImage_LoadFile[1] = {{ wxLua_wxImage_LoadFile, WXLUAMETHOD_METHOD, 2, 4, s_wxluatagArray_wxLua_wxImage_LoadFile }}; ! // bool LoadFile(const wxString& name, long type = wxBITMAP_TYPE_ANY, int index = -1) static int LUACALL wxLua_wxImage_LoadFile(lua_State *L) { // get number of arguments int argCount = lua_gettop(L); + // int index = -1 + int index = (argCount >= 4 ? (int)wxlua_getnumbertype(L, 4) : -1); // long type = wxBITMAP_TYPE_ANY long type = (argCount >= 3 ? (long)wxlua_getnumbertype(L, 3) : wxBITMAP_TYPE_ANY); *************** *** 894,898 **** wxImage * self = (wxImage *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxImage); // call LoadFile ! bool returns = (self->LoadFile(name, type)); // push the result flag lua_pushboolean(L, returns); --- 942,946 ---- wxImage * self = (wxImage *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxImage); // call LoadFile ! bool returns = (self->LoadFile(name, type, index)); // push the result flag lua_pushboolean(L, returns); *************** *** 1800,1807 **** #if (wxUSE_STREAMS) && (wxLUA_USE_wxImage && wxUSE_IMAGE) ! { wxLua_wxImage_LoadFile2, WXLUAMETHOD_METHOD, 3, 4, s_wxluatagArray_wxLua_wxImage_LoadFile2 }, #endif // (wxUSE_STREAMS) && (wxLUA_USE_wxImage && wxUSE_IMAGE) ! { wxLua_wxImage_LoadFile1, WXLUAMETHOD_METHOD, 3, 3, s_wxluatagArray_wxLua_wxImage_LoadFile1 }, ! { wxLua_wxImage_LoadFile, WXLUAMETHOD_METHOD, 2, 3, s_wxluatagArray_wxLua_wxImage_LoadFile }, }; static int s_wxluafunc_wxLua_wxImage_LoadFile_overload_count = sizeof(s_wxluafunc_wxLua_wxImage_LoadFile_overload)/sizeof(wxLuaBindCFunc); --- 1848,1859 ---- #if (wxUSE_STREAMS) && (wxLUA_USE_wxImage && wxUSE_IMAGE) ! { wxLua_wxImage_LoadFile3, WXLUAMETHOD_METHOD, 3, 4, s_wxluatagArray_wxLua_wxImage_LoadFile3 }, #endif // (wxUSE_STREAMS) && (wxLUA_USE_wxImage && wxUSE_IMAGE) ! ! #if (wxUSE_STREAMS) && (wxLUA_USE_wxImage && wxUSE_IMAGE) ! { wxLua_wxImage_LoadFile2, WXLUAMETHOD_METHOD, 2, 4, s_wxluatagArray_wxLua_wxImage_LoadFile2 }, ! #endif // (wxUSE_STREAMS) && (wxLUA_USE_wxImage && wxUSE_IMAGE) ! { wxLua_wxImage_LoadFile1, WXLUAMETHOD_METHOD, 3, 4, s_wxluatagArray_wxLua_wxImage_LoadFile1 }, ! { wxLua_wxImage_LoadFile, WXLUAMETHOD_METHOD, 2, 4, s_wxluatagArray_wxLua_wxImage_LoadFile }, }; static int s_wxluafunc_wxLua_wxImage_LoadFile_overload_count = sizeof(s_wxluafunc_wxLua_wxImage_LoadFile_overload)/sizeof(wxLuaBindCFunc); *************** *** 1998,2001 **** --- 2050,2054 ---- { "GetAlpha", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxImage_GetAlpha, 1, NULL }, { "GetBlue", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxImage_GetBlue, 1, NULL }, + { "GetData", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxImage_GetData, 1, NULL }, { "GetGreen", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxImage_GetGreen, 1, NULL }, |