Update of /cvsroot/wxlua/wxLua/bindings/wxwidgets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15118/wxLua/bindings/wxwidgets Modified Files: wxlua.i Added Files: htmlwin.cpp htmlwin.h printing.cpp printing.h wrappers.lst wxluawrap.i Removed Files: wxLuaWrap.i Log Message: still moving files to module and app directory --- NEW FILE: wxluawrap.i --- ///////////////////////////////////////////////////////////////////////////// // Name: wxLuaWrap.i // Purpose: definition of interface data, functions and classes // Author: J Winwood // Modified by: J Winwood. Automatic generation of event table. // More code generation overrides. // Support for wxWindows 2.3 and wxWindows 2.4 // Created: 3/11/2001 // Copyrights: // Original file from wxBasic (Wrap.i) (c) 2001 David Cuny // Modifications for wxLua (c) 2001, 2002, 2003 J. Winwood // Portions are extracted from the wxWindows documentation // and headers therefore // Portions (c) 2001 wxWindows development team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// %define wxBACKINGSTORE %define wxBACKWARD %define wxBOTH %define wxBOTTOM %define wxCANCEL %define wxCENTER %define wxCENTER_FRAME %define wxCENTER_ON_SCREEN %define wxCENTRE %define wxCENTRE_ON_SCREEN %define wxCOLOURED //%define wxED_BUTTONS_BOTTOM // for wxExtDialog? not used? //%define wxED_BUTTONS_RIGHT //%define wxED_CLIENT_MARGIN //%define wxED_STATIC_LINE %define wxEQUIV %define wxFIXED_LENGTH %define wxFORWARD %define wxGTK %define wxHELP %define wxHORIZONTAL %define wxINVERT %define wxMORE %define wxMOTIF_X %define wxNO %define wxNO_BORDER %define wxNO_DEFAULT %define wxOK %define wxPASSWORD %define wxPROCESS_ENTER %define wxRESET %define wxRESIZE_BOX %define wxRETAINED %define wxRIGHT %define wxSET %define wxSETUP %define wxSIZE_ALLOW_MINUS_ONE %define wxSIZE_AUTO %define wxSIZE_AUTO_HEIGHT %define wxSIZE_AUTO_WIDTH %define wxSIZE_NO_ADJUSTMENTS %define wxSIZE_USE_EXISTING %define wxST_NO_AUTORESIZE %define wxTOP %define wxUNKNOWN_PLATFORM //%define wxUSER_COLOURS depricated use wxNO_3D %define wxVERTICAL %define wxWINDOWS %define wxWS_EX_VALIDATE_RECURSIVELY %define wxXVIEW_X %define wxYES %define wxYES_DEFAULT %define wxYES_NO %win %define wxPlatformWindows %gtk %define wxPlatformGTK %mac %define wxPlatformMac %mgl %define wxPlatformMgl %motif %define wxPlatformMotif %os2 %define wxPlatformOS2 %univ %define wxPlatformUniv %x11 %define wxPlatformX11 %cocoa %define wxPlatformCocoa %include "wx/wx.h" %include "wxlua/include/internal.h" %includefile override.hpp // classes %class %noclassinfo wxLog %endclass %class %noclassinfo wxProcess %endclass //====================================================================================== // These are out of order to ensure proper checking for base classes %includefile data.i %includefile event.i %includefile windows.i %includefile gdi.i %includefile appframe.i %includefile dialogs.i %includefile print.i %includefile clipdrag.i %includefile config.i %includefile controls.i %includefile datetime.i %includefile defsutil.i %includefile file.i %includefile grid.i %includefile help.i %includefile html.i %includefile image.i %includefile mdi.i %includefile menutool.i %includefile plot.i %includefile sizer.i %includefile socket.i %includefile geometry.i %includefile wave.i %includefile regex.i %includefile wxlua.i %includefile fl.i %includefile stc.i %includefile xml.i --- NEW FILE: printing.cpp --- ///////////////////////////////////////////////////////////////////////////// // Name: wxLuaPrinting.cpp // Purpose: Provide an interface to wxPrintout for wxLua. // Author: J. Winwood. // Created: July 2002. // Copyright: (c) 2002 Lomtick Software. All rights reserved. // Licence: wxWidgets licence ///////////////////////////////////////////////////////////////////////////// /* #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "printing.h" #endif #include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop #endif #ifndef WX_PRECOMP #include "wx/wx.h" #endif */ #include "wx/datetime.h" #include "wxlua/include/callback.h" #include "wxlua/include/internal.h" //#include "wxlua/printing.h" // forward reference class wxLuaObject; // This lua tag is defined in wxLuaWrap.cpp extern int s_wxLuaPrintout; // ---------------------------------------------------------------------------- // wxLuaPrintout // ---------------------------------------------------------------------------- IMPLEMENT_CLASS(wxLuaPrintout, wxPrintout) wxLuaPrintout::wxLuaPrintout(const wxString& title, wxLuaObject *pObject) : wxPrintout(title), m_pObject(pObject), m_minPage(0), m_maxPage(0), m_pageFrom(0), m_pageTo(0) { } void wxLuaPrintout::SetPageInfo(int minPage, int maxPage, int pageFrom, int pageTo) { m_minPage = minPage; m_maxPage = maxPage; m_pageFrom = pageFrom; m_pageTo = pageTo; } void wxLuaPrintout::GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *pageTo) { lua_State *luaState = getDerivedMethod(this, "GetPageInfo"); if (luaState != NULL) { int nOldTop = lua_gettop(luaState); tpushusertag(luaState, this, s_wxLuaPrintout); LuaCall(luaState, 1, false); *minPage = (int) lua_tonumber(luaState, -4); *maxPage = (int) lua_tonumber(luaState, -3); *pageFrom = (int) lua_tonumber(luaState, -2); *pageTo = (int) lua_tonumber(luaState, -1); lua_settop(luaState, nOldTop); } else { *minPage = m_minPage; *maxPage = m_maxPage; *pageFrom = m_pageFrom; *pageTo = m_pageTo; } } bool wxLuaPrintout::HasPage(int pageNum) { bool fResult = false; lua_State *luaState = getDerivedMethod(this, "HasPage"); if (luaState != NULL) { int nOldTop = lua_gettop(luaState); tpushusertag(luaState, this, s_wxLuaPrintout); lua_pushnumber(luaState, pageNum); LuaCall(luaState, 2, false); fResult = (lua_toboolean(luaState, -1) != false); lua_settop(luaState, nOldTop); } else fResult = wxPrintout::HasPage(pageNum); return fResult; } bool wxLuaPrintout::OnBeginDocument(int startPage, int endPage) { bool fResult = true; lua_State *luaState = getDerivedMethod(this, "OnBeginDocument"); if (luaState != NULL) { int nOldTop = lua_gettop(luaState); tpushusertag(luaState, this, s_wxLuaPrintout); lua_pushnumber(luaState, startPage); lua_pushnumber(luaState, endPage); LuaCall(luaState, 3, false); fResult = (lua_toboolean(luaState, -1) != false); lua_pop(luaState, 1); lua_settop(luaState, nOldTop); } else fResult = wxPrintout::OnBeginDocument(startPage, endPage); return fResult; } void wxLuaPrintout::OnEndDocument() { lua_State *luaState = getDerivedMethod(this, "OnEndDocument"); if (luaState != NULL) { int nOldTop = lua_gettop(luaState); tpushusertag(luaState, this, s_wxLuaPrintout); LuaCall(luaState, 1, true); lua_settop(luaState, nOldTop); } else wxPrintout::OnEndDocument(); } void wxLuaPrintout::OnBeginPrinting() { lua_State *luaState = getDerivedMethod(this, "OnBeginPrinting"); if (luaState != NULL) { int nOldTop = lua_gettop(luaState); tpushusertag(luaState, this, s_wxLuaPrintout); LuaCall(luaState, 1, true); lua_settop(luaState, nOldTop); } else wxPrintout::OnBeginPrinting(); } void wxLuaPrintout::OnEndPrinting() { lua_State *luaState = getDerivedMethod(this, "OnEndPrinting"); if (luaState != NULL) { int nOldTop = lua_gettop(luaState); tpushusertag(luaState, this, s_wxLuaPrintout); LuaCall(luaState, 1, true); lua_settop(luaState, nOldTop); } else wxPrintout::OnEndPrinting(); } void wxLuaPrintout::OnPreparePrinting() { lua_State *luaState = getDerivedMethod(this, "OnPreparePrinting"); if (luaState != NULL) { int nOldTop = lua_gettop(luaState); tpushusertag(luaState, this, s_wxLuaPrintout); LuaCall(luaState, 1, true); lua_settop(luaState, nOldTop); } else wxPrintout::OnPreparePrinting(); } bool wxLuaPrintout::OnPrintPage(int pageNum) { bool fResult = false; lua_State *luaState = getDerivedMethod(this, "OnPrintPage"); if (luaState != NULL) { int nOldTop = lua_gettop(luaState); tpushusertag(luaState, this, s_wxLuaPrintout); lua_pushnumber(luaState, pageNum); LuaCall(luaState, 2, false); fResult = (lua_toboolean(luaState, -1) != false); lua_settop(luaState, nOldTop); } return fResult; } --- NEW FILE: wrappers.lst --- WRAPPERS = \ appframe.i \ clipdrag.i \ config.i \ controls.i \ data.i \ datetime.i \ defsutil.i \ dialogs.i \ event.i \ file.i \ fl.i \ gdi.i \ geometry.i \ grid.i \ help.i \ html.i \ image.i \ mdi.i \ menutool.i \ plot.i \ print.i \ regex.i \ sizer.i \ socket.i \ stc.i \ wave.i \ windows.i \ wxlua.i \ wxluawrap.i \ xml.i --- NEW FILE: htmlwin.h --- ///////////////////////////////////////////////////////////////////////////// // Purpose: A wrapper around wxHtmlWindow for wxLua // Author: J. Winwood // Created: June 2002 // Copyright: (c) 2002 Lomtick Software. All rights reserved. // Licence: wxWidgets licence ///////////////////////////////////////////////////////////////////////////// #ifndef WX_LUA_HTML_WINDOW_H #define WX_LUA_HTML_WINDOW_H //#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) // #pragma interface "htmlwin.h" //#endif #include "wxlua/include/defs.h" #include "wx/print.h" #include "wx/html/htmlwin.h" #include "wx/html/htmlcell.h" // ---------------------------------------------------------------------------- // wxLuaHtmlWindow // ---------------------------------------------------------------------------- class wxLuaHtmlWindow : public wxHtmlWindow { public: wxLuaHtmlWindow(); virtual ~wxLuaHtmlWindow(); wxLuaHtmlWindow(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxHW_SCROLLBAR_AUTO, const wxString& name = wxT("wxLuaHtmlWindow")); virtual void OnCellClicked(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& event); virtual void OnCellMouseHover(wxHtmlCell *cell, wxCoord x, wxCoord y); virtual void OnLinkClicked(const wxHtmlLinkInfo& link); virtual void OnSetTitle(const wxString& title); private: DECLARE_EVENT_TABLE() DECLARE_CLASS (wxLuaHtmlWindow) }; // ---------------------------------------------------------------------------- // wxLuaHtmlWinTagEvent // ---------------------------------------------------------------------------- class wxLuaHtmlWinTagEvent : public wxEvent { public: wxLuaHtmlWinTagEvent(); wxLuaHtmlWinTagEvent(int eventType); virtual ~wxLuaHtmlWinTagEvent(); void SetTagInfo(const wxHtmlTag *pHtmlTag, wxHtmlWinParser *pParser); const wxHtmlTag *GetHtmlTag() const; wxHtmlWinParser *GetHtmlParser() const; void SetParseInnerCalled(bool fParseInnerCalled); bool GetParseInnerCalled() const; protected: virtual wxEvent* Clone() const; private: const wxHtmlTag *m_pHtmlTag; wxHtmlWinParser *m_pHtmlParser; bool m_fParseInnerCalled; DECLARE_DYNAMIC_CLASS(wxLuaHtmlWinTagEvent) }; typedef void (wxEvtHandler::*wxLuaHtmlWinTagEventFunction)(wxLuaHtmlWinTagEvent&); BEGIN_DECLARE_EVENT_TYPES() DECLARE_LOCAL_EVENT_TYPE(wxEVT_HTML_TAG_HANDLER, 2520) END_DECLARE_EVENT_TYPES() #define EVT_HTML_TAG_HANDLER(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_HTML_TAG_HANDLER, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxLuaHtmlWinTagEventFunction) & fn, (wxObject *) NULL), #endif //WX_LUA_HTML_WINDOW_H Index: wxlua.i =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxlua.i,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** wxlua.i 6 Jun 2005 23:06:07 -0000 1.1 --- wxlua.i 7 Jun 2005 04:17:38 -0000 1.2 *************** *** 34,38 **** %if wxLUA_USE_wxLuaDebugServer ! %include "wxlua/dserver.h" %class %noclassinfo %delete wxLuaDebugServer --- 34,38 ---- %if wxLUA_USE_wxLuaDebugServer ! %include "wxluasocket/include/dserver.h" %class %noclassinfo %delete wxLuaDebugServer *************** *** 83,87 **** %if wxLUA_USE_wxLuaPrintout ! %include "wxlua/printing.h" %class %delete wxLuaPrintout, wxPrintout --- 83,88 ---- %if wxLUA_USE_wxLuaPrintout ! %inlinefile printing.h ! %inlinefile printing.cpp %class %delete wxLuaPrintout, wxPrintout *************** *** 98,102 **** %if wxLUA_USE_wxLuaHtmlWindow ! %include "wxlua/htmlwin.h" %class wxLuaHtmlWindow, wxHtmlWindow --- 99,104 ---- %if wxLUA_USE_wxLuaHtmlWindow ! %inlinefile htmlwin.h ! %inlinefile htmlwin.cpp %class wxLuaHtmlWindow, wxHtmlWindow *************** *** 123,127 **** %if wxLUA_USE_wxLuaApp ! %include "wxlua/library.h" %endif wxLUA_USE_wxLuaApp --- 125,129 ---- %if wxLUA_USE_wxLuaApp ! %include "wxlua/include/library.h" %endif wxLUA_USE_wxLuaApp --- wxLuaWrap.i DELETED --- --- NEW FILE: htmlwin.cpp --- ///////////////////////////////////////////////////////////////////////////// // Name: wxLuaHtmlWindow.cpp // Purpose: Provide an interface to wxHtmlWindow for wxLua. // Author: J. Winwood. // Created: June 2002. // Copyright: (c) 2002 Lomtick Software. All rights reserved. // Licence: wxWidgets licence ///////////////////////////////////////////////////////////////////////////// /* #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "htmlwin.h" #endif #include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop #endif #ifndef WX_PRECOMP #include "wx/wx.h" #endif */ #include "wx/datetime.h" #include "wxlua/include/callback.h" //#include "wxlua/htmlwin.h" #include "wxlua/include/internal.h" // These are the wxLua tags defined in wxLuaWrap.cpp extern int s_wxLuaHtmlWindow; extern int s_wxHtmlCell; extern int s_wxMouseEvent; extern int s_wxHtmlLinkInfo; DEFINE_EVENT_TYPE(wxEVT_HTML_TAG_HANDLER) // ---------------------------------------------------------------------------- // wxLuaHtmlWindow // ---------------------------------------------------------------------------- IMPLEMENT_CLASS(wxLuaHtmlWindow, wxHtmlWindow) BEGIN_EVENT_TABLE(wxLuaHtmlWindow, wxHtmlWindow) END_EVENT_TABLE() wxLuaHtmlWindow::wxLuaHtmlWindow() : wxHtmlWindow() { } wxLuaHtmlWindow::~wxLuaHtmlWindow() { } wxLuaHtmlWindow::wxLuaHtmlWindow(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name) : wxHtmlWindow(parent, id, pos, size, style, name) { } void wxLuaHtmlWindow::OnCellClicked(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& event) { bool fResult = false; lua_State *luaState = getDerivedMethod(this, "OnCellClicked"); if (luaState != NULL) { int nOldTop = lua_gettop(luaState); tpushusertag(luaState, this, s_wxLuaHtmlWindow); tpushusertag(luaState, cell, s_wxHtmlCell); lua_pushnumber(luaState, x); lua_pushnumber(luaState, y); tpushusertag(luaState, (void *) &event, s_wxMouseEvent); LuaCall(luaState, 5, false); fResult = (lua_tonumber(luaState, -1) != 0); lua_settop(luaState, nOldTop); if (fResult) wxHtmlWindow::OnCellClicked(cell, x, y, event); } else wxHtmlWindow::OnCellClicked(cell, x, y, event); } void wxLuaHtmlWindow::OnCellMouseHover(wxHtmlCell *cell, wxCoord x, wxCoord y) { lua_State *luaState = getDerivedMethod(this, "OnCellMouseHover"); if (luaState != NULL) { int nOldTop = lua_gettop(luaState); tpushusertag(luaState, this, s_wxLuaHtmlWindow); tpushusertag(luaState, cell, s_wxHtmlCell); lua_pushnumber(luaState, x); lua_pushnumber(luaState, y); LuaCall(luaState, 4, true); lua_settop(luaState, nOldTop); } else wxHtmlWindow::OnCellMouseHover(cell, x, y); } void wxLuaHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link) { lua_State *luaState = getDerivedMethod(this, "OnLinkClicked"); if (luaState != NULL) { int nOldTop = lua_gettop(luaState); tpushusertag(luaState, this, s_wxLuaHtmlWindow); tpushusertag(luaState, (void *) &link, s_wxHtmlLinkInfo); LuaCall(luaState, 2, true); lua_settop(luaState, nOldTop); } else wxHtmlWindow::OnLinkClicked(link); } void wxLuaHtmlWindow::OnSetTitle(const wxString& title) { lua_State *luaState = getDerivedMethod(this, "OnSetTitle"); if (luaState != NULL) { int nOldTop = lua_gettop(luaState); tpushusertag(luaState, this, s_wxLuaHtmlWindow); lua_pushstring(luaState, wx2lua(title)); LuaCall(luaState, 2, true); lua_settop(luaState, nOldTop); } else wxHtmlWindow::OnSetTitle(title); } // ---------------------------------------------------------------------------- // wxLuaHtmlWinTagHandler // ---------------------------------------------------------------------------- class wxLuaHtmlWinTagHandler : public wxHtmlWinTagHandler { public: wxLuaHtmlWinTagHandler() { } wxString GetSupportedTags() { return wxString(wxT("LUA")); } bool HandleTag(const wxHtmlTag& tag) { wxLuaHtmlWinTagEvent htmlEvent(wxEVT_HTML_TAG_HANDLER); htmlEvent.SetTagInfo(&tag, m_WParser); if (wxTheApp->ProcessEvent(htmlEvent)) return htmlEvent.GetParseInnerCalled(); return FALSE; } }; class wxLuaHtmlTagsModule : public wxHtmlTagsModule { DECLARE_DYNAMIC_CLASS(wxLuaHtmlTagsModule) public: void FillHandlersTable(wxHtmlWinParser *parser) { parser->AddTagHandler(new wxLuaHtmlWinTagHandler); } }; IMPLEMENT_DYNAMIC_CLASS(wxLuaHtmlTagsModule, wxHtmlTagsModule) // ---------------------------------------------------------------------------- // wxLuaHtmlWinTagEvent // ---------------------------------------------------------------------------- IMPLEMENT_DYNAMIC_CLASS(wxLuaHtmlWinTagEvent, wxEvent) wxLuaHtmlWinTagEvent::wxLuaHtmlWinTagEvent() : m_pHtmlTag(NULL), m_pHtmlParser(NULL), m_fParseInnerCalled(false) { } wxLuaHtmlWinTagEvent::wxLuaHtmlWinTagEvent(int eventType) : m_pHtmlTag(NULL), m_pHtmlParser(NULL), m_fParseInnerCalled(false) { SetEventType(eventType); } wxLuaHtmlWinTagEvent::~wxLuaHtmlWinTagEvent() { } void wxLuaHtmlWinTagEvent::SetTagInfo(const wxHtmlTag *pHtmlTag, wxHtmlWinParser *pParser) { m_pHtmlTag = pHtmlTag; m_pHtmlParser = pParser; } wxEvent* wxLuaHtmlWinTagEvent::Clone() const { wxLuaHtmlWinTagEvent *pEvent = new wxLuaHtmlWinTagEvent(GetEventType()); if (pEvent != NULL) { pEvent->m_pHtmlTag = m_pHtmlTag; pEvent->m_pHtmlParser = m_pHtmlParser; pEvent->m_fParseInnerCalled = m_fParseInnerCalled; } return pEvent; } const wxHtmlTag *wxLuaHtmlWinTagEvent::GetHtmlTag() const { return m_pHtmlTag; } wxHtmlWinParser *wxLuaHtmlWinTagEvent::GetHtmlParser() const { return m_pHtmlParser; } bool wxLuaHtmlWinTagEvent::GetParseInnerCalled() const { return m_fParseInnerCalled; } void wxLuaHtmlWinTagEvent::SetParseInnerCalled(bool fParseInnerCalled) { m_fParseInnerCalled = fParseInnerCalled; } --- NEW FILE: printing.h --- ///////////////////////////////////////////////////////////////////////////// // Purpose: A wrapper around wxPrintout for wxLua // Author: J. Winwood // Created: July 2002 // Copyright: (c) 2002 Lomtick Software. All rights reserved. // Licence: wxWidgets licence ///////////////////////////////////////////////////////////////////////////// #ifndef WX_LUA_PRINTING_H #define WX_LUA_PRINTING_H //#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) // #pragma interface "printing.h" //#endif #include "wxlua/include/defs.h" #include "wx/print.h" // ---------------------------------------------------------------------------- // wxLuaPrintout // ---------------------------------------------------------------------------- class wxLuaPrintout : public wxPrintout { public: wxLuaPrintout(const wxString& title = _("Printout"), wxLuaObject *pObject = NULL); void SetPageInfo(int minPage, int maxPage, int pageFrom, int pageTo); // overrides virtual void GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *pageTo); virtual bool HasPage(int pageNum); virtual bool OnBeginDocument(int startPage, int endPage); virtual void OnEndDocument(); virtual void OnBeginPrinting(); virtual void OnEndPrinting(); virtual void OnPreparePrinting(); virtual bool OnPrintPage(int pageNumber); wxLuaObject *GetID() const { return m_pObject; } private: wxLuaObject *m_pObject; int m_minPage; int m_maxPage; int m_pageFrom; int m_pageTo; DECLARE_CLASS(wxLuaPrintout) }; #endif //WX_LUA_PRINTING_H |