From: John L. <jr...@us...> - 2006-09-20 04:07:41
|
Update of /cvsroot/wxlua/wxLua/modules/wxbind/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv10976/wxLua/modules/wxbind/src Modified Files: html.cpp wx_bind.cpp Log Message: add wxVERSION and WXLUA_XXX_VERSION bindings and use them in the About dialog for the samples Cleanup samples for readability Index: html.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/html.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** html.cpp 24 Aug 2006 05:12:27 -0000 1.18 --- html.cpp 20 Sep 2006 04:07:37 -0000 1.19 *************** *** 1909,1912 **** --- 1909,1931 ---- + #if (wxCHECK_VERSION(2,7,0)) && (wxLUA_USE_wxHTML) + // %wxchkver27 wxHtmlWindowInterface *GetWindowInterface() + static int LUACALL wxLua_wxHtmlWinParser_GetWindowInterface(lua_State *L) + { + wxLuaState wxlState(L); + wxHtmlWindowInterface *returns; + // get this + wxHtmlWinParser * self = (wxHtmlWinParser *)wxlState.GetUserDataType(1, s_wxluatag_wxHtmlWinParser); + // call GetWindowInterface + returns = self->GetWindowInterface(); + // push the result datatype + wxlState.PushUserDataType(s_wxluatag_wxHtmlWindowInterface, returns); + + return 1; + } + + #endif // (wxCHECK_VERSION(2,7,0)) && (wxLUA_USE_wxHTML) + + #if (wxLUA_USE_wxColourPenBrush) && (wxLUA_USE_wxHTML) // wxColour GetActualColor() const *************** *** 2447,2450 **** --- 2466,2474 ---- + #if (wxCHECK_VERSION(2,7,0)) && (wxLUA_USE_wxHTML) + { LuaMethod, "GetWindowInterface", wxLua_wxHtmlWinParser_GetWindowInterface, 0, 0, { 0 } }, + #endif // (wxCHECK_VERSION(2,7,0)) && (wxLUA_USE_wxHTML) + + #if (wxLUA_USE_wxColourPenBrush) && (wxLUA_USE_wxHTML) { LuaMethod, "GetActualColor", wxLua_wxHtmlWinParser_GetActualColor, 0, 0, { 0 } }, *************** *** 2522,2525 **** --- 2546,2771 ---- + #if (wxCHECK_VERSION(2,7,0)) && (wxLUA_USE_wxHTML) + // ------------------------------------------------------------------------------------------------- + // Bind class wxHtmlWindowInterface + // ------------------------------------------------------------------------------------------------- + + // Lua MetaTable Tag for Class 'wxHtmlWindowInterface' + int s_wxluatag_wxHtmlWindowInterface = -1; + + + #if ((wxCHECK_VERSION(2,7,0)) && (wxLUA_USE_wxHTML)) && (wxLUA_USE_wxBitmap) + // virtual void SetHTMLBackgroundImage(const wxBitmap& bmpBg) + static int LUACALL wxLua_wxHtmlWindowInterface_SetHTMLBackgroundImage(lua_State *L) + { + wxLuaState wxlState(L); + // const wxBitmap bmpBg + const wxBitmap * bmpBg = (const wxBitmap *)wxlState.GetUserDataType(2, s_wxluatag_wxBitmap); + // get this + wxHtmlWindowInterface * self = (wxHtmlWindowInterface *)wxlState.GetUserDataType(1, s_wxluatag_wxHtmlWindowInterface); + // call SetHTMLBackgroundImage + self->SetHTMLBackgroundImage(*bmpBg); + + return 0; + } + + #endif // ((wxCHECK_VERSION(2,7,0)) && (wxLUA_USE_wxHTML)) && (wxLUA_USE_wxBitmap) + + + #if ((wxCHECK_VERSION(2,7,0)) && (wxLUA_USE_wxHTML)) && (wxLUA_USE_wxColourPenBrush) + // virtual wxColour GetHTMLBackgroundColour() const + static int LUACALL wxLua_wxHtmlWindowInterface_GetHTMLBackgroundColour(lua_State *L) + { + wxLuaState wxlState(L); + wxColour *returns; + // get this + wxHtmlWindowInterface * self = (wxHtmlWindowInterface *)wxlState.GetUserDataType(1, s_wxluatag_wxHtmlWindowInterface); + // call GetHTMLBackgroundColour + // allocate a new object using the copy constructor + returns = new wxColour(self->GetHTMLBackgroundColour()); + // add the new object to the tracked memory list + wxLua_AddToTrackedMemoryList(wxlState, (wxColour *)returns); + // push the result datatype + wxlState.PushUserDataType(s_wxluatag_wxColour, returns); + + return 1; + } + + // virtual void SetHTMLBackgroundColour(const wxColour& clr) + static int LUACALL wxLua_wxHtmlWindowInterface_SetHTMLBackgroundColour(lua_State *L) + { + wxLuaState wxlState(L); + // const wxColour clr + const wxColour * clr = (const wxColour *)wxlState.GetUserDataType(2, s_wxluatag_wxColour); + // get this + wxHtmlWindowInterface * self = (wxHtmlWindowInterface *)wxlState.GetUserDataType(1, s_wxluatag_wxHtmlWindowInterface); + // call SetHTMLBackgroundColour + self->SetHTMLBackgroundColour(*clr); + + return 0; + } + + #endif // ((wxCHECK_VERSION(2,7,0)) && (wxLUA_USE_wxHTML)) && (wxLUA_USE_wxColourPenBrush) + + + #if ((wxCHECK_VERSION(2,7,0)) && (wxLUA_USE_wxHTML)) && (wxLUA_USE_wxCursor) + // virtual wxCursor GetHTMLCursor(wxHtmlWindowInterface::HTMLCursor type) const + static int LUACALL wxLua_wxHtmlWindowInterface_GetHTMLCursor(lua_State *L) + { + wxLuaState wxlState(L); + wxCursor *returns; + // wxHtmlWindowInterface::HTMLCursor type + wxHtmlWindowInterface::HTMLCursor type = (wxHtmlWindowInterface::HTMLCursor)wxlState.GetEnumerationType(2); + // get this + wxHtmlWindowInterface * self = (wxHtmlWindowInterface *)wxlState.GetUserDataType(1, s_wxluatag_wxHtmlWindowInterface); + // call GetHTMLCursor + // allocate a new object using the copy constructor + returns = new wxCursor(self->GetHTMLCursor(type)); + // add the new object to the tracked memory list + wxLua_AddToTrackedMemoryList(wxlState, (wxCursor *)returns); + // push the result datatype + wxlState.PushUserDataType(s_wxluatag_wxCursor, returns); + + return 1; + } + + #endif // ((wxCHECK_VERSION(2,7,0)) && (wxLUA_USE_wxHTML)) && (wxLUA_USE_wxCursor) + + + #if ((wxCHECK_VERSION(2,7,0)) && (wxLUA_USE_wxHTML)) && (wxLUA_USE_wxHTML) + // virtual void OnHTMLLinkClicked(const wxHtmlLinkInfo& link) + static int LUACALL wxLua_wxHtmlWindowInterface_OnHTMLLinkClicked(lua_State *L) + { + wxLuaState wxlState(L); + // const wxHtmlLinkInfo link + const wxHtmlLinkInfo * link = (const wxHtmlLinkInfo *)wxlState.GetUserDataType(2, s_wxluatag_wxHtmlLinkInfo); + // get this + wxHtmlWindowInterface * self = (wxHtmlWindowInterface *)wxlState.GetUserDataType(1, s_wxluatag_wxHtmlWindowInterface); + // call OnHTMLLinkClicked + self->OnHTMLLinkClicked(*link); + + return 0; + } + + #endif // ((wxCHECK_VERSION(2,7,0)) && (wxLUA_USE_wxHTML)) && (wxLUA_USE_wxHTML) + + + #if ((wxLUA_USE_wxHTML) && ((wxCHECK_VERSION(2,7,0)) && (wxLUA_USE_wxHTML))) && (wxLUA_USE_wxPointSizeRect) + // virtual wxPoint HTMLCoordsToWindow(wxHtmlCell *cell, const wxPoint& pos) const + static int LUACALL wxLua_wxHtmlWindowInterface_HTMLCoordsToWindow(lua_State *L) + { + wxLuaState wxlState(L); + wxPoint *returns; + // const wxPoint pos + const wxPoint * pos = (const wxPoint *)wxlState.GetUserDataType(3, s_wxluatag_wxPoint); + // wxHtmlCell cell + wxHtmlCell * cell = (wxHtmlCell *)wxlState.GetUserDataType(2, s_wxluatag_wxHtmlCell); + // get this + wxHtmlWindowInterface * self = (wxHtmlWindowInterface *)wxlState.GetUserDataType(1, s_wxluatag_wxHtmlWindowInterface); + // call HTMLCoordsToWindow + // allocate a new object using the copy constructor + returns = new wxPoint(self->HTMLCoordsToWindow(cell, *pos)); + // add the new object to the tracked memory list + wxLua_AddToTrackedMemoryList(wxlState, (wxPoint *)returns); + // push the result datatype + wxlState.PushUserDataType(s_wxluatag_wxPoint, returns); + + return 1; + } + + #endif // ((wxLUA_USE_wxHTML) && ((wxCHECK_VERSION(2,7,0)) && (wxLUA_USE_wxHTML))) && (wxLUA_USE_wxPointSizeRect) + + // virtual void SetHTMLWindowTitle(const wxString& title) + static int LUACALL wxLua_wxHtmlWindowInterface_SetHTMLWindowTitle(lua_State *L) + { + wxLuaState wxlState(L); + // const wxString title + const wxString title = lua2wx(wxlState.GetStringType(2)); + // get this + wxHtmlWindowInterface * self = (wxHtmlWindowInterface *)wxlState.GetUserDataType(1, s_wxluatag_wxHtmlWindowInterface); + // call SetHTMLWindowTitle + self->SetHTMLWindowTitle(title); + + return 0; + } + + // virtual wxWindow* GetHTMLWindow() + static int LUACALL wxLua_wxHtmlWindowInterface_GetHTMLWindow(lua_State *L) + { + wxLuaState wxlState(L); + wxWindow *returns; + // get this + wxHtmlWindowInterface * self = (wxHtmlWindowInterface *)wxlState.GetUserDataType(1, s_wxluatag_wxHtmlWindowInterface); + // call GetHTMLWindow + returns = self->GetHTMLWindow(); + // push the result datatype + wxlState.PushUserDataType(s_wxluatag_wxWindow, returns); + + return 1; + } + + // virtual void SetHTMLStatusText(const wxString& text) + static int LUACALL wxLua_wxHtmlWindowInterface_SetHTMLStatusText(lua_State *L) + { + wxLuaState wxlState(L); + // const wxString text + const wxString text = lua2wx(wxlState.GetStringType(2)); + // get this + wxHtmlWindowInterface * self = (wxHtmlWindowInterface *)wxlState.GetUserDataType(1, s_wxluatag_wxHtmlWindowInterface); + // call SetHTMLStatusText + self->SetHTMLStatusText(text); + + return 0; + } + + static int LUACALL wxLua_wxHtmlWindowInterface_destructor(lua_State *) + { + return 0; + } + + + + + + // Map Lua Class Methods to C Binding Functions + static WXLUAMETHOD s_wxHtmlWindowInterface_methods[] = { + + #if ((wxCHECK_VERSION(2,7,0)) && (wxLUA_USE_wxHTML)) && (wxLUA_USE_wxBitmap) + { LuaMethod, "SetHTMLBackgroundImage", wxLua_wxHtmlWindowInterface_SetHTMLBackgroundImage, 1, 1, { &s_wxluatag_wxBitmap, 0 } }, + #endif // ((wxCHECK_VERSION(2,7,0)) && (wxLUA_USE_wxHTML)) && (wxLUA_USE_wxBitmap) + + + #if ((wxCHECK_VERSION(2,7,0)) && (wxLUA_USE_wxHTML)) && (wxLUA_USE_wxColourPenBrush) + { LuaMethod, "GetHTMLBackgroundColour", wxLua_wxHtmlWindowInterface_GetHTMLBackgroundColour, 0, 0, { 0 } }, + { LuaMethod, "SetHTMLBackgroundColour", wxLua_wxHtmlWindowInterface_SetHTMLBackgroundColour, 1, 1, { &s_wxluatag_wxColour, 0 } }, + #endif // ((wxCHECK_VERSION(2,7,0)) && (wxLUA_USE_wxHTML)) && (wxLUA_USE_wxColourPenBrush) + + + #if ((wxCHECK_VERSION(2,7,0)) && (wxLUA_USE_wxHTML)) && (wxLUA_USE_wxCursor) + { LuaMethod, "GetHTMLCursor", wxLua_wxHtmlWindowInterface_GetHTMLCursor, 1, 1, { &s_wxluaarg_Enumeration, 0 } }, + #endif // ((wxCHECK_VERSION(2,7,0)) && (wxLUA_USE_wxHTML)) && (wxLUA_USE_wxCursor) + + + #if ((wxCHECK_VERSION(2,7,0)) && (wxLUA_USE_wxHTML)) && (wxLUA_USE_wxHTML) + { LuaMethod, "OnHTMLLinkClicked", wxLua_wxHtmlWindowInterface_OnHTMLLinkClicked, 1, 1, { &s_wxluatag_wxHtmlLinkInfo, 0 } }, + #endif // ((wxCHECK_VERSION(2,7,0)) && (wxLUA_USE_wxHTML)) && (wxLUA_USE_wxHTML) + + + #if ((wxLUA_USE_wxHTML) && ((wxCHECK_VERSION(2,7,0)) && (wxLUA_USE_wxHTML))) && (wxLUA_USE_wxPointSizeRect) + { LuaMethod, "HTMLCoordsToWindow", wxLua_wxHtmlWindowInterface_HTMLCoordsToWindow, 2, 2, { &s_wxluatag_wxHtmlCell, &s_wxluatag_wxPoint, 0 } }, + #endif // ((wxLUA_USE_wxHTML) && ((wxCHECK_VERSION(2,7,0)) && (wxLUA_USE_wxHTML))) && (wxLUA_USE_wxPointSizeRect) + + { LuaMethod, "SetHTMLWindowTitle", wxLua_wxHtmlWindowInterface_SetHTMLWindowTitle, 1, 1, { &s_wxluaarg_String, 0 } }, + { LuaMethod, "GetHTMLWindow", wxLua_wxHtmlWindowInterface_GetHTMLWindow, 0, 0, { 0 } }, + { LuaMethod, "SetHTMLStatusText", wxLua_wxHtmlWindowInterface_SetHTMLStatusText, 1, 1, { &s_wxluaarg_String, 0 } }, + { LuaDelete, "wxHtmlWindowInterface", wxLua_wxHtmlWindowInterface_destructor, 0, 0, {0} }, + }; + + // Extern accessor to class method map + WXLUAMETHOD* wxHtmlWindowInterface_methods = s_wxHtmlWindowInterface_methods; + int wxHtmlWindowInterface_methodCount = sizeof(s_wxHtmlWindowInterface_methods)/sizeof(s_wxHtmlWindowInterface_methods[0]); + #endif // (wxCHECK_VERSION(2,7,0)) && (wxLUA_USE_wxHTML) + + #if wxLUA_USE_wxHTML // ------------------------------------------------------------------------------------------------- Index: wx_bind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wx_bind.cpp,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** wx_bind.cpp 28 Aug 2006 05:26:20 -0000 1.54 --- wx_bind.cpp 20 Sep 2006 04:07:37 -0000 1.55 *************** *** 525,528 **** --- 525,533 ---- #endif // (wxUSE_SOUND) && (wxCHECK_VERSION(2,6,0)) && (wxLUA_USE_wxWave) + { "WXLUA_MAJOR_VERSION", WXLUA_MAJOR_VERSION }, + { "WXLUA_MINOR_VERSION", WXLUA_MINOR_VERSION }, + { "WXLUA_RELEASE_VERSION", WXLUA_RELEASE_VERSION }, + { "WXLUA_SUBRELEASE_VERSION", WXLUA_SUBRELEASE_VERSION }, + { "wxABI_VERSION", wxABI_VERSION }, { "wxALWAYS_SHOW_SB", wxALWAYS_SHOW_SB }, { "wxBACKINGSTORE", wxBACKINGSTORE }, *************** *** 558,561 **** --- 563,568 ---- { "wxIMAGE_ALPHA_TRANSPARENT", wxIMAGE_ALPHA_TRANSPARENT }, { "wxINVERT", wxINVERT }, + { "wxMAJOR_VERSION", wxMAJOR_VERSION }, + { "wxMINOR_VERSION", wxMINOR_VERSION }, { "wxMORE", wxMORE }, { "wxNO", wxNO }, *************** *** 568,571 **** --- 575,579 ---- { "wxPROCESS_ENTER", wxPROCESS_ENTER }, { "wxRAISED_BORDER", wxRAISED_BORDER }, + { "wxRELEASE_NUMBER", wxRELEASE_NUMBER }, { "wxRESET", wxRESET }, { "wxRESIZE_BOX", wxRESIZE_BOX }, *************** *** 583,586 **** --- 591,595 ---- { "wxSTATIC_BORDER", wxSTATIC_BORDER }, { "wxST_NO_AUTORESIZE", wxST_NO_AUTORESIZE }, + { "wxSUBRELEASE_NUMBER", wxSUBRELEASE_NUMBER }, { "wxSUNKEN_BORDER", wxSUNKEN_BORDER }, { "wxTAB_TRAVERSAL", wxTAB_TRAVERSAL }, *************** *** 1443,1446 **** --- 1452,1461 ---- #endif // (wxCHECK_VERSION(2,5,0)) && (wxLUA_USE_wxPrint) + #if (wxCHECK_VERSION(2,7,0)) && (wxLUA_USE_wxHTML) + { "wxHtmlWindowInterface_HTMLCursor_Default", wxHtmlWindowInterface::HTMLCursor_Default }, + { "wxHtmlWindowInterface_HTMLCursor_Link", wxHtmlWindowInterface::HTMLCursor_Link }, + { "wxHtmlWindowInterface_HTMLCursor_Text", wxHtmlWindowInterface::HTMLCursor_Text }, + #endif // (wxCHECK_VERSION(2,7,0)) && (wxLUA_USE_wxHTML) + #if (wxLUA_USE_wxHelpController) && (wxUSE_HELP) { "wxHELP_SEARCH_ALL", wxHELP_SEARCH_ALL }, *************** *** 2611,2614 **** --- 2626,2630 ---- #endif // (wxUSE_LIBTIFF) && (wxLUA_USE_wxImage) + { "WXLUA_VERSION_STRING", WXLUA_VERSION_STRING }, { "wxIMAGE_OPTION_FILENAME", _T("FileName") }, { "wxIMAGE_OPTION_PNG_BITDEPTH", wxIMAGE_OPTION_PNG_BITDEPTH }, *************** *** 2619,2622 **** --- 2635,2639 ---- { "wxIMAGE_OPTION_RESOLUTIONX", _T("ResolutionX") }, { "wxIMAGE_OPTION_RESOLUTIONY", _T("ResolutionY") }, + { "wxVERSION_STRING", wxVERSION_STRING }, #if wxCHECK_VERSION(2,6,0) *************** *** 3116,3119 **** --- 3133,3176 ---- } + // %function bool wxCHECK_VERSION(int major, int minor, int release) // actually a define + static int LUACALL wxLua_function_wxCHECK_VERSION(lua_State *L) + { + wxLuaState wxlState(L); + bool returns; + // int release + int release = (int)wxlState.GetNumberType(3); + // int minor + int minor = (int)wxlState.GetNumberType(2); + // int major + int major = (int)wxlState.GetNumberType(1); + // call wxCHECK_VERSION + returns = wxCHECK_VERSION(major, minor, release); + // push the result flag + lua_pushboolean(L, returns); + + return 1; + } + + // %function bool wxCHECK_VERSION_FULL(int major, int minor, int release, int subrel) // actually a define + static int LUACALL wxLua_function_wxCHECK_VERSION_FULL(lua_State *L) + { + wxLuaState wxlState(L); + bool returns; + // int subrel + int subrel = (int)wxlState.GetNumberType(4); + // int release + int release = (int)wxlState.GetNumberType(3); + // int minor + int minor = (int)wxlState.GetNumberType(2); + // int major + int major = (int)wxlState.GetNumberType(1); + // call wxCHECK_VERSION_FULL + returns = wxCHECK_VERSION_FULL(major, minor, release, subrel); + // push the result flag + lua_pushboolean(L, returns); + + return 1; + } + // %override wxLua_function_wxClientDisplayRect // %function void wxClientDisplayRect(int *x, int *y,int *width, int *height) *************** *** 4857,4860 **** --- 4914,4919 ---- { LuaGlobal, "wxBell", wxLua_function_wxBell, 0, 0, { 0 } }, + { LuaGlobal, "wxCHECK_VERSION", wxLua_function_wxCHECK_VERSION, 3, 3, { &s_wxluaarg_Number, &s_wxluaarg_Number, &s_wxluaarg_Number, 0 } }, + { LuaGlobal, "wxCHECK_VERSION_FULL", wxLua_function_wxCHECK_VERSION_FULL, 4, 4, { &s_wxluaarg_Number, &s_wxluaarg_Number, &s_wxluaarg_Number, &s_wxluaarg_Number, 0 } }, { LuaGlobal, "wxClientDisplayRect", wxLua_function_wxClientDisplayRect, 4, 4, { &s_wxluaarg_LightUserData, &s_wxluaarg_LightUserData, &s_wxluaarg_LightUserData, &s_wxluaarg_LightUserData, 0 } }, { LuaGlobal, "wxColourDisplay", wxLua_function_wxColourDisplay, 0, 0, { 0 } }, *************** *** 5102,5105 **** --- 5161,5169 ---- + #if (wxCHECK_VERSION(2,7,0)) && (wxLUA_USE_wxHTML) + { "wxHtmlWindowInterface", wxHtmlWindowInterface_methods, wxHtmlWindowInterface_methodCount, -1, NULL, &s_wxluatag_wxHtmlWindowInterface, NULL }, + #endif // (wxCHECK_VERSION(2,7,0)) && (wxLUA_USE_wxHTML) + + #if (wxLUA_USE_wxBitmapButton) && (wxLUA_USE_wxButton) { "wxBitmapButton", wxBitmapButton_methods, wxBitmapButton_methodCount, -1, CLASSINFO(wxBitmapButton), &s_wxluatag_wxBitmapButton, "wxButton" }, |