X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0f66a9f39d0d48f3e0da6641fa66d1b3db305732..8f17924e7389618db0ac792f2b53e69d7e4bb4ec:/utils/wxPython/modules/html/html.i diff --git a/utils/wxPython/modules/html/html.i b/utils/wxPython/modules/html/html.i index 3d6d878342..28ca2f9e4c 100644 --- a/utils/wxPython/modules/html/html.i +++ b/utils/wxPython/modules/html/html.i @@ -20,7 +20,6 @@ #include #include #include -#include "helpsys.h" %} //--------------------------------------------------------------------------- @@ -47,11 +46,12 @@ wxSize wxPyDefaultSize(wxDefaultSize); #endif %} -%pragma(python) code = "import wx,htmlhelper" +%pragma(python) code = "import wx" %pragma(python) code = "widget = htmlc" %{ +#if 0 static PyObject* mod_dict = NULL; // will be set by init #include @@ -129,15 +129,44 @@ TAGS_MODULE_BEGIN(PythonTag) TAGS_MODULE_END(PythonTag) // Note: see also the init function where we add the module! - +#endif %} //--------------------------------------------------------------------------- + +enum { + HTML_ALIGN_LEFT, + HTML_ALIGN_CENTER, + HTML_ALIGN_RIGHT, + HTML_ALIGN_BOTTOM, + HTML_ALIGN_TOP, + + HTML_CLR_FOREGROUND, + HTML_CLR_BACKGROUND, + + HTML_UNITS_PIXELS, + HTML_UNITS_PERCENT, + + HTML_INDENT_LEFT, + HTML_INDENT_RIGHT, + HTML_INDENT_TOP, + HTML_INDENT_BOTTOM, + + HTML_INDENT_HORIZONTAL, + HTML_INDENT_VERTICAL, + HTML_INDENT_ALL, + + HTML_COND_ISANCHOR, + HTML_COND_ISIMAGEMAP, + HTML_COND_USER, +}; + + //--------------------------------------------------------------------------- class wxHtmlTag { public: - // Never need to create a new tag... + // Never need to create a new tag from Python... //wxHtmlTag(const wxString& source, int pos, int end_pos, wxHtmlTagsCache* cache); wxString GetName(); @@ -236,7 +265,6 @@ public: IMP_PYCALLBACK_STRING__pure(wxPyHtmlTagHandler, wxHtmlTagHandler, GetSupportedTags); IMP_PYCALLBACK_BOOL_TAG_pure(wxPyHtmlTagHandler, wxHtmlTagHandler, HandleTag); - %} @@ -272,7 +300,6 @@ public: IMP_PYCALLBACK_STRING__pure(wxPyHtmlWinTagHandler, wxHtmlWinTagHandler, GetSupportedTags); IMP_PYCALLBACK_BOOL_TAG_pure(wxPyHtmlWinTagHandler, wxHtmlWinTagHandler, HandleTag); - %} @@ -315,9 +342,11 @@ public: // Wave our magic wand... (if it works it's a miracle! ;-) // First, make a new instance of the tag handler + bool doSave = wxPyRestoreThread(); PyObject* arg = Py_BuildValue("()"); PyObject* obj = PyInstance_New(m_tagHandlerClass, arg, NULL); Py_DECREF(arg); + wxPySaveThread(doSave); // now figure out where it's C++ object is... wxPyHtmlWinTagHandler* thPtr; @@ -348,6 +377,63 @@ private: } %} +//--------------------------------------------------------------------------- +//--------------------------------------------------------------------------- + +class wxHtmlCell { +public: + wxHtmlCell(); + + void SetParent(wxHtmlContainerCell *p); + wxHtmlContainerCell* GetParent(); + int GetPosX(); + int GetPosY(); + int GetWidth(); + int GetHeight(); + int GetDescent(); + wxString GetLink(int x = 0, int y = 0); + wxHtmlCell* GetNext(); + void SetPos(int x, int y); + void SetLink(const wxString& link); + void SetNext(wxHtmlCell *cell); + void Layout(int w); + void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2); + void DrawInvisible(wxDC& dc, int x, int y); + const wxHtmlCell* Find(int condition, const void* param); +}; + + +class wxHtmlContainerCell : public wxHtmlCell { +public: + wxHtmlContainerCell(wxHtmlContainerCell *parent); + + void InsertCell(wxHtmlCell *cell); + void SetAlignHor(int al); + int GetAlignHor(); + void SetAlignVer(int al); + int GetAlignVer(); + void SetIndent(int i, int what, int units = HTML_UNITS_PIXELS); + int GetIndent(int ind); + int GetIndentUnits(int ind); + void SetAlign(const wxHtmlTag& tag); + void SetWidthFloat(int w, int units); + %name(SetWidthFloatFromTag)void SetWidthFloat(const wxHtmlTag& tag); + void SetMinHeight(int h, int align = HTML_ALIGN_TOP); + int GetMaxLineWidth(); + void SetBackgroundColour(const wxColour& clr); + void SetBorder(const wxColour& clr1, const wxColour& clr2); + wxHtmlCell* GetFirstCell(); +}; + + + + +class wxHtmlWidgetCell : public wxHtmlCell { +public: + wxHtmlWidgetCell(wxWindow* wnd, int w = 0); + +}; + //--------------------------------------------------------------------------- @@ -402,70 +488,25 @@ public: bool SetPage(const char* source); - // Set HTML page and display it. !! source is HTML document itself, - // it is NOT address/filename of HTML document. If you want to - // specify document location, use LoadPage() istead - // Return value : FALSE if an error occured, TRUE otherwise - bool LoadPage(const char* location); - // Load HTML page from given location. Location can be either - // a) /usr/wxGTK2/docs/html/wx.htm - // b) http://www.somewhere.uk/document.htm - // c) ftp://ftp.somesite.cz/pub/something.htm - // In case there is no prefix (http:,ftp:), the method - // will try to find it itself (1. local file, then http or ftp) - // After the page is loaded, the method calls SetPage() to display it. - // Note : you can also use path relative to previously loaded page - // Return value : same as SetPage - wxString GetOpenedPage(); - // Returns full location of opened page - void SetRelatedFrame(wxFrame* frame, const char* format); - // sets frame in which page title will be displayed. Format is format of - // frame title, e.g. "HtmlHelp : %s". It must contain exactly one %s wxFrame* GetRelatedFrame(); - void SetRelatedStatusBar(int bar); - // after(!) calling SetRelatedFrame, this sets statusbar slot where messages - // will be displayed. Default is -1 = no messages. - void SetFonts(wxString normal_face, int normal_italic_mode, wxString fixed_face, int fixed_italic_mode, int *LIST); - // sets fonts to be used when displaying HTML page. - // *_italic_mode can be either wxSLANT or wxITALIC - void SetTitle(const char* title); - // Sets the title of the window - // (depending on the information passed to SetRelatedFrame() method) - void SetBorders(int b); - // Sets space between text and window borders. - void ReadCustomization(wxConfigBase *cfg, char* path = ""); - // saves custom settings into cfg config. it will use the path 'path' - // if given, otherwise it will save info into currently selected path. - // saved values : things set by SetFonts, SetBorders. - void WriteCustomization(wxConfigBase *cfg, char* path = ""); - // ... - bool HistoryBack(); bool HistoryForward(); - // Goes to previous/next page (in browsing history) - // Returns TRUE if successful, FALSE otherwise void HistoryClear(); - // Resets history - - // wxHtmlContainerCell* GetInternalRepresentation() const; - // Returns pointer to conteiners/cells structure. - // It should be used ONLY when printing + wxHtmlContainerCell* GetInternalRepresentation(); + wxHtmlWinParser* GetParser(); void base_OnLinkClicked(const char* link); - // called when users clicked on hypertext link. Default behavior is to - // call LoadPage(loc) - }; // Static methods are mapped to stand-alone functions @@ -486,18 +527,22 @@ public: %init %{ +#if 0 /* This is a bit cheesy. SWIG happens to call the dictionary d... * I save it here, 'cause I don't know how to get it back later! */ mod_dict = d; +#endif - //inithtmlhelpc(); + inithtmlhelpc(); wxClassInfo::CleanUpClasses(); wxClassInfo::InitializeClasses(); +#if 0 /* specifically add our python tag handler; it doesn't seem to * happen by itself... */ wxHtmlWinParser::AddModule(new HTML_ModulePythonTag()); +#endif // Until wxFileSystem is wrapped... #if wxUSE_FS_ZIP @@ -505,4 +550,11 @@ public: #endif %} +//---------------------------------------------------------------------- +// And this gets appended to the shadow class file. +//---------------------------------------------------------------------- + +%pragma(python) include="_extras.py"; + //--------------------------------------------------------------------------- +