1 /////////////////////////////////////////////////////////////////////////////
 
   3 // Purpose:     SWIG definitions of html classes
 
   7 // Created:     25-Nov-1998
 
   9 // Copyright:   (c) 2003 by Total Control Software
 
  10 // Licence:     wxWindows license
 
  11 /////////////////////////////////////////////////////////////////////////////
 
  14 "Classes for a simple HTML rendering window, HTML Help Window, etc."
 
  17 %module(package="wx", docstring=DOCSTRING) html
 
  20 #include "wx/wxPython/wxPython.h"
 
  21 #include "wx/wxPython/pyclasses.h"
 
  22 #include "wx/wxPython/pyistream.h"
 
  23 #include "wx/wxPython/printfw.h"
 
  25 #include <wx/html/htmlwin.h>
 
  26 #include <wx/html/htmprint.h>
 
  27 #include <wx/html/helpctrl.h>
 
  28 #include <wx/html/helpwnd.h>
 
  29 #include <wx/html/helpfrm.h>
 
  30 #include <wx/html/helpdlg.h>
 
  35 //---------------------------------------------------------------------------
 
  38 %pythoncode { wx = _core }
 
  39 %pythoncode { __docfilter__ = wx.__DocFilter(globals()) }
 
  41 %include _html_rename.i
 
  44 MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
 
  45 MAKE_CONST_WXSTRING2(HtmlWindowNameStr,    wxT("htmlWindow"))
 
  46 MAKE_CONST_WXSTRING2(HtmlPrintoutTitleStr, wxT("Printout"))
 
  47 MAKE_CONST_WXSTRING2(HtmlPrintingTitleStr, wxT("Printing"))
 
  50 // TODO: Split this file into multiple %included files that coresponds to the
 
  51 // wx/html include files (more or less.)
 
  53 //---------------------------------------------------------------------------
 
  64     wxHTML_CLR_FOREGROUND,
 
  65     wxHTML_CLR_BACKGROUND,
 
  75     wxHTML_INDENT_HORIZONTAL,
 
  76     wxHTML_INDENT_VERTICAL,
 
  80     wxHTML_COND_ISIMAGEMAP,
 
 102 // enums for wxHtmlWindow::OnOpeningURL
 
 103 enum wxHtmlOpeningStatus
 
 119 //---------------------------------------------------------------------------
 
 121 class wxHtmlLinkInfo : public wxObject {
 
 123     wxHtmlLinkInfo(const wxString& href, const wxString& target = wxPyEmptyString);
 
 125     wxString GetTarget();
 
 126     wxMouseEvent* GetEvent();
 
 127     wxHtmlCell* GetHtmlCell();
 
 129     void SetEvent(const wxMouseEvent *e);
 
 130     void SetHtmlCell(const wxHtmlCell * e);
 
 133 //---------------------------------------------------------------------------
 
 135 class wxHtmlTag : public wxObject {
 
 137     // Never need to create a new tag from Python...
 
 138     //wxHtmlTag(const wxString& source, int pos, int end_pos, wxHtmlTagsCache* cache);
 
 141     bool HasParam(const wxString& par);
 
 142     wxString GetParam(const wxString& par, int with_commas = false);
 
 144     // Can't do this one as-is, but GetParam should be enough...
 
 145     //int ScanParam(const wxString& par, const char *format, void* param);
 
 147     wxString GetAllParams();
 
 154 //---------------------------------------------------------------------------
 
 156 class wxHtmlParser : public wxObject {
 
 158     // wxHtmlParser();  This is an abstract base class...
 
 160     void SetFS(wxFileSystem *fs);
 
 161     wxFileSystem* GetFS();
 
 162     wxObject* Parse(const wxString& source);
 
 163     void InitParser(const wxString& source);
 
 165     void DoParsing(int begin_pos, int end_pos);
 
 167     // wxObject* GetProduct();
 
 169     void AddTagHandler(wxHtmlTagHandler *handler);
 
 170     wxString* GetSource();
 
 171     void PushTagHandler(wxHtmlTagHandler* handler, wxString tags);
 
 172     void PopTagHandler();
 
 174     // virtual wxFSFile *OpenURL(wxHtmlURLType type, const wxString& url) const;
 
 176     // void AddText(const char* txt) = 0;
 
 177     // void AddTag(const wxHtmlTag& tag);
 
 181 //---------------------------------------------------------------------------
 
 183 class wxHtmlWinParser : public wxHtmlParser {
 
 185     wxHtmlWinParser(wxPyHtmlWindow *wnd = NULL);
 
 187     void SetDC(wxDC *dc);
 
 191     wxPyHtmlWindow* GetWindow();
 
 193     // Sets fonts to be used when displaying HTML page. (if size null then default sizes used).
 
 195         void SetFonts(wxString normal_face, wxString fixed_face, PyObject* sizes=NULL) {
 
 197             if (sizes) temp = int_LIST_helper(sizes);
 
 198             self->SetFonts(normal_face, fixed_face, temp);
 
 204     // Sets font sizes to be relative to the given size or the system
 
 205     // default size; use either specified or default font
 
 206     void SetStandardFonts(int size = -1,
 
 207                           const wxString& normal_face = wxPyEmptyString,
 
 208                           const wxString& fixed_face = wxPyEmptyString);
 
 211     wxHtmlContainerCell* GetContainer();
 
 212     wxHtmlContainerCell* OpenContainer();
 
 213     wxHtmlContainerCell *SetContainer(wxHtmlContainerCell *c);
 
 214     wxHtmlContainerCell* CloseContainer();
 
 217     void SetFontSize(int s);
 
 219     void SetFontBold(int x);
 
 221     void SetFontItalic(int x);
 
 222     int GetFontUnderlined();
 
 223     void SetFontUnderlined(int x);
 
 225     void SetFontFixed(int x);
 
 227     void SetAlign(int a);
 
 228     wxColour GetLinkColor();
 
 229     void SetLinkColor(const wxColour& clr);
 
 230     wxColour GetActualColor();
 
 231     void SetActualColor(const wxColour& clr);
 
 233         GetActualColour = GetActualColor
 
 234         SetActualColour = SetActualColor
 
 236     void SetLink(const wxString& link);
 
 237     wxFont* CreateCurrentFont();
 
 238     wxHtmlLinkInfo GetLink();
 
 243 //---------------------------------------------------------------------------
 
 246 class wxPyHtmlTagHandler : public wxHtmlTagHandler {
 
 247     DECLARE_DYNAMIC_CLASS(wxPyHtmlTagHandler)
 
 249     wxPyHtmlTagHandler() : wxHtmlTagHandler() {};
 
 251     wxHtmlParser* GetParser() { return m_Parser; }
 
 252     void ParseInner(const wxHtmlTag& tag) { wxHtmlTagHandler::ParseInner(tag); }
 
 254     DEC_PYCALLBACK_STRING__pure(GetSupportedTags);
 
 255     DEC_PYCALLBACK_BOOL_TAG_pure(HandleTag);
 
 260 IMPLEMENT_DYNAMIC_CLASS(wxPyHtmlTagHandler, wxHtmlTagHandler);
 
 262 IMP_PYCALLBACK_STRING__pure(wxPyHtmlTagHandler, wxHtmlTagHandler, GetSupportedTags);
 
 263 IMP_PYCALLBACK_BOOL_TAG_pure(wxPyHtmlTagHandler, wxHtmlTagHandler, HandleTag);
 
 267 %rename(HtmlTagHandler) wxPyHtmlTagHandler;
 
 268 class wxPyHtmlTagHandler : public wxObject {
 
 270     %pythonAppend wxPyHtmlTagHandler   "self._setCallbackInfo(self, HtmlTagHandler)"
 
 271     wxPyHtmlTagHandler();
 
 273     void _setCallbackInfo(PyObject* self, PyObject* _class);
 
 275     void SetParser(wxHtmlParser *parser);
 
 276     wxHtmlParser* GetParser();
 
 277     void ParseInner(const wxHtmlTag& tag);
 
 281 //---------------------------------------------------------------------------
 
 284 class wxPyHtmlWinTagHandler : public wxHtmlWinTagHandler {
 
 285     DECLARE_DYNAMIC_CLASS(wxPyHtmlWinTagHandler)
 
 287     wxPyHtmlWinTagHandler() : wxHtmlWinTagHandler() {};
 
 289     wxHtmlWinParser* GetParser() { return m_WParser; }
 
 290     void ParseInner(const wxHtmlTag& tag)
 
 291         { wxHtmlWinTagHandler::ParseInner(tag); }
 
 293     DEC_PYCALLBACK_STRING__pure(GetSupportedTags);
 
 294     DEC_PYCALLBACK_BOOL_TAG_pure(HandleTag);
 
 299 IMPLEMENT_DYNAMIC_CLASS( wxPyHtmlWinTagHandler, wxHtmlWinTagHandler);
 
 301 IMP_PYCALLBACK_STRING__pure(wxPyHtmlWinTagHandler, wxHtmlWinTagHandler, GetSupportedTags);
 
 302 IMP_PYCALLBACK_BOOL_TAG_pure(wxPyHtmlWinTagHandler, wxHtmlWinTagHandler, HandleTag);
 
 306 %rename(HtmlWinTagHandler) wxPyHtmlWinTagHandler;
 
 307 class wxPyHtmlWinTagHandler : public wxPyHtmlTagHandler {
 
 309     %pythonAppend wxPyHtmlWinTagHandler    "self._setCallbackInfo(self, HtmlWinTagHandler)"
 
 310     wxPyHtmlWinTagHandler();
 
 312     void _setCallbackInfo(PyObject* self, PyObject* _class);
 
 314     void SetParser(wxHtmlParser *parser);
 
 315     wxHtmlWinParser* GetParser();
 
 316     void ParseInner(const wxHtmlTag& tag);
 
 320 //---------------------------------------------------------------------------
 
 324 class wxPyHtmlTagsModule : public wxHtmlTagsModule {
 
 326     wxPyHtmlTagsModule(PyObject* thc) : wxHtmlTagsModule() {
 
 327         m_tagHandlerClass = thc;
 
 328         Py_INCREF(m_tagHandlerClass);
 
 329         RegisterModule(this);
 
 330         wxHtmlWinParser::AddModule(this);
 
 334         wxPyBlock_t blocked = wxPyBeginBlockThreads();
 
 335         Py_DECREF(m_tagHandlerClass);
 
 336         m_tagHandlerClass = NULL;
 
 337         for (size_t x=0; x < m_objArray.GetCount(); x++) {
 
 338             PyObject* obj = (PyObject*)m_objArray.Item(x);
 
 341         wxPyEndBlockThreads(blocked);
 
 344     void FillHandlersTable(wxHtmlWinParser *parser) {
 
 345         // Wave our magic wand...  (if it works it's a miracle!  ;-)
 
 347         // First, make a new instance of the tag handler
 
 348         wxPyBlock_t blocked = wxPyBeginBlockThreads();
 
 349         PyObject* arg = PyTuple_New(0);
 
 350         PyObject* obj = PyObject_CallObject(m_tagHandlerClass, arg);
 
 353         // now figure out where it's C++ object is...
 
 354         wxPyHtmlWinTagHandler* thPtr;
 
 355         if (! wxPyConvertSwigPtr(obj, (void **)&thPtr, wxT("wxPyHtmlWinTagHandler"))) {
 
 356             wxPyEndBlockThreads(blocked);
 
 359         wxPyEndBlockThreads(blocked);
 
 362         parser->AddTagHandler(thPtr);
 
 369     PyObject*           m_tagHandlerClass;
 
 370     wxArrayPtrVoid      m_objArray;
 
 378     void wxHtmlWinParser_AddTagHandler(PyObject* tagHandlerClass) {
 
 379         // Dynamically create a new wxModule.  Refcounts tagHandlerClass
 
 380         // and adds itself to the wxModules list and to the wxHtmlWinParser.
 
 381         new wxPyHtmlTagsModule(tagHandlerClass);
 
 386 //---------------------------------------------------------------------------
 
 388 %typemap(out) wxHtmlCell*         { $result = wxPyMake_wxObject($1, $owner); }
 
 389 %typemap(out) const wxHtmlCell*   { $result = wxPyMake_wxObject($1, $owner); }
 
 391 //---------------------------------------------------------------------------
 
 395 // wxHtmlSelection is data holder with information about text selection.
 
 396 // Selection is defined by two positions (beginning and end of the selection)
 
 397 // and two leaf(!) cells at these positions.
 
 398 class wxHtmlSelection
 
 404     void Set(const wxPoint& fromPos, const wxHtmlCell *fromCell,
 
 405              const wxPoint& toPos, const wxHtmlCell *toCell);
 
 406     %Rename(SetCells, void, Set(const wxHtmlCell *fromCell, const wxHtmlCell *toCell));
 
 408     const wxHtmlCell *GetFromCell() const;
 
 409     const wxHtmlCell *GetToCell() const;
 
 411     // these values are in absolute coordinates:
 
 412     const wxPoint& GetFromPos() const;
 
 413     const wxPoint& GetToPos() const;
 
 415     // these are From/ToCell's private data
 
 416     const wxPoint& GetFromPrivPos() const;
 
 417     const wxPoint& GetToPrivPos() const;
 
 418     void SetFromPrivPos(const wxPoint& pos);
 
 419     void SetToPrivPos(const wxPoint& pos);
 
 422     const bool IsEmpty() const;
 
 427 enum wxHtmlSelectionState
 
 429     wxHTML_SEL_OUT,     // currently rendered cell is outside the selection
 
 430     wxHTML_SEL_IN,      // ... is inside selection
 
 431     wxHTML_SEL_CHANGING // ... is the cell on which selection state changes
 
 436 // Selection state is passed to wxHtmlCell::Draw so that it can render itself
 
 437 // differently e.g. when inside text selection or outside it.
 
 438 class wxHtmlRenderingState
 
 441     wxHtmlRenderingState();
 
 442     ~wxHtmlRenderingState();
 
 444     void SetSelectionState(wxHtmlSelectionState s);
 
 445     wxHtmlSelectionState GetSelectionState() const;
 
 447     void SetFgColour(const wxColour& c);
 
 448     const wxColour& GetFgColour() const;
 
 449     void SetBgColour(const wxColour& c);
 
 450     const wxColour& GetBgColour() const;
 
 455 // HTML rendering customization. This class is used when rendering wxHtmlCells
 
 457 class wxHtmlRenderingStyle
 
 460     virtual wxColour GetSelectedTextColour(const wxColour& clr) = 0;
 
 461     virtual wxColour GetSelectedTextBgColour(const wxColour& clr) = 0;
 
 465 class wxDefaultHtmlRenderingStyle : public wxHtmlRenderingStyle
 
 468     virtual wxColour GetSelectedTextColour(const wxColour& clr);
 
 469     virtual wxColour GetSelectedTextBgColour(const wxColour& clr);
 
 474 // Information given to cells when drawing them. Contains rendering state,
 
 475 // selection information and rendering style object that can be used to
 
 476 // customize the output.
 
 477 class wxHtmlRenderingInfo
 
 480     wxHtmlRenderingInfo();
 
 481     ~wxHtmlRenderingInfo();
 
 483     void SetSelection(wxHtmlSelection *s);
 
 484     wxHtmlSelection *GetSelection() const;
 
 486     void SetStyle(wxHtmlRenderingStyle *style);
 
 487     wxHtmlRenderingStyle& GetStyle();
 
 489     wxHtmlRenderingState& GetState();
 
 492 //---------------------------------------------------------------------------
 
 498     wxHTML_FIND_EXACT             = 1,
 
 499     wxHTML_FIND_NEAREST_BEFORE    = 2,
 
 500     wxHTML_FIND_NEAREST_AFTER     = 4
 
 504 class wxHtmlCell : public wxObject {
 
 506     %typemap(out) wxHtmlCell*;    // turn off this typemap
 
 511     // Turn it back on again
 
 512     %typemap(out) wxHtmlCell* { $result = wxPyMake_wxObject($1, $owner); }
 
 520     // Returns the maximum possible length of the cell.
 
 521     // Call Layout at least once before using GetMaxTotalWidth()
 
 522     int GetMaxTotalWidth() const;
 
 524     const wxString& GetId() const;
 
 525     void SetId(const wxString& id);
 
 526     wxHtmlLinkInfo* GetLink(int x = 0, int y = 0);
 
 527     wxHtmlCell* GetNext();
 
 528     wxHtmlContainerCell* GetParent();
 
 529     wxHtmlCell* GetFirstChild() const;
 
 531     // Returns cursor to be used when mouse is over the cell:
 
 532     wxCursor GetCursor() const;
 
 534     // Formatting cells are not visible on the screen, they only alter
 
 536     bool IsFormattingCell() const;
 
 539     void SetLink(const wxHtmlLinkInfo& link);
 
 541     %disownarg(wxHtmlCell*);
 
 542     void SetNext(wxHtmlCell *cell);
 
 543     %cleardisown(wxHtmlCell*);
 
 545     void SetParent(wxHtmlContainerCell *p);
 
 546     void SetPos(int x, int y);
 
 548     void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2,
 
 549               wxHtmlRenderingInfo& info);
 
 550     void DrawInvisible(wxDC& dc, int x, int y,
 
 551               wxHtmlRenderingInfo& info);
 
 552     const wxHtmlCell* Find(int condition, const void* param);
 
 554     bool AdjustPagebreak(int* INOUT);
 
 555     void SetCanLiveOnPagebreak(bool can);
 
 557     // Can the line be broken before this cell?
 
 558     bool IsLinebreakAllowed() const;
 
 560     // Returns True for simple == terminal cells, i.e. not composite ones.
 
 561     // This if for internal usage only and may disappear in future versions!
 
 562     bool IsTerminalCell() const;
 
 564     // Find a cell inside this cell positioned at the given coordinates
 
 565     // (relative to this's positions). Returns NULL if no such cell exists.
 
 566     // The flag can be used to specify whether to look for terminal or
 
 567     // nonterminal cells or both. In either case, returned cell is deepest
 
 568     // cell in cells tree that contains [x,y].
 
 569     wxHtmlCell *FindCellByPos(wxCoord x, wxCoord y,
 
 570                                   unsigned flags = wxHTML_FIND_EXACT) const;
 
 572     // Returns absolute position of the cell on HTML canvas
 
 573     wxPoint GetAbsPos() const;
 
 575     // Returns first (last) terminal cell inside this cell. It may return NULL,
 
 576     // but it is rare -- only if there are no terminals in the tree.
 
 577     wxHtmlCell *GetFirstTerminal() const ;
 
 578     wxHtmlCell *GetLastTerminal() const ;
 
 580     // Returns cell's depth, i.e. how far under the root cell it is
 
 581     // (if it is the root, depth is 0)
 
 582     unsigned GetDepth() const;
 
 584     // Returns True if the cell appears before 'cell' in natural order of
 
 585     // cells (= as they are read). If cell A is (grand)parent of cell B,
 
 586     // then both A.IsBefore(B) and B.IsBefore(A) always return True.
 
 587     bool IsBefore(wxHtmlCell *cell) const;
 
 589     // Converts the cell into text representation. If sel != NULL then
 
 590     // only part of the cell inside the selection is converted.
 
 591     wxString ConvertToText(wxHtmlSelection *sel) const;
 
 595 class  wxHtmlWordCell : public wxHtmlCell
 
 598     wxHtmlWordCell(const wxString& word, wxDC& dc);
 
 599     wxString ConvertToText(wxHtmlSelection *sel) const;
 
 600     bool IsLinebreakAllowed() const;
 
 601     void SetPreviousWord(wxHtmlWordCell *cell);
 
 605 class wxHtmlContainerCell : public wxHtmlCell {
 
 607     wxHtmlContainerCell(wxHtmlContainerCell *parent);
 
 609     %disownarg(wxHtmlCell*);
 
 610     void InsertCell(wxHtmlCell *cell);
 
 611     %cleardisown(wxHtmlCell*);
 
 613     void SetAlignHor(int al);
 
 615     void SetAlignVer(int al);
 
 617     void SetIndent(int i, int what, int units = wxHTML_UNITS_PIXELS);
 
 618     int GetIndent(int ind);
 
 619     int GetIndentUnits(int ind);
 
 620     void SetAlign(const wxHtmlTag& tag);
 
 621     void SetWidthFloat(int w, int units);
 
 622     %Rename(SetWidthFloatFromTag, void,  SetWidthFloat(const wxHtmlTag& tag));
 
 623     void SetMinHeight(int h, int align = wxHTML_ALIGN_TOP);
 
 624     void SetBackgroundColour(const wxColour& clr);
 
 625     wxColour GetBackgroundColour();
 
 626     void SetBorder(const wxColour& clr1, const wxColour& clr2);
 
 627     wxHtmlCell* GetFirstChild();
 
 628     %pragma(python) addtoclass = "GetFirstCell = GetFirstChild"
 
 633 class wxHtmlColourCell : public wxHtmlCell {
 
 635     wxHtmlColourCell(const wxColour& clr, int flags = wxHTML_CLR_FOREGROUND);
 
 640 class  wxHtmlFontCell : public wxHtmlCell
 
 643     wxHtmlFontCell(wxFont *font);
 
 647 class wxHtmlWidgetCell : public wxHtmlCell {
 
 649     wxHtmlWidgetCell(wxWindow* wnd, int w = 0);
 
 656 //---------------------------------------------------------------------------
 
 658 //---------------------------------------------------------------------------
 
 662 %{ // here's the C++ version
 
 663 class wxPyHtmlFilter : public wxHtmlFilter {
 
 664     DECLARE_ABSTRACT_CLASS(wxPyHtmlFilter)
 
 666     wxPyHtmlFilter() : wxHtmlFilter() {}
 
 668     // returns True if this filter is able to open&read given file
 
 669     virtual bool CanRead(const wxFSFile& file) const {
 
 672         wxPyBlock_t blocked = wxPyBeginBlockThreads();
 
 673         if ((found = wxPyCBH_findCallback(m_myInst, "CanRead"))) {
 
 674             PyObject* obj = wxPyMake_wxObject((wxFSFile*)&file,false);  // cast away const
 
 675             rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj));
 
 678         wxPyEndBlockThreads(blocked);
 
 683     // Reads given file and returns HTML document.
 
 684     // Returns empty string if opening failed
 
 685     virtual wxString ReadFile(const wxFSFile& file) const {
 
 688         wxPyBlock_t blocked = wxPyBeginBlockThreads();
 
 689         if ((found = wxPyCBH_findCallback(m_myInst, "ReadFile"))) {
 
 690             PyObject* obj = wxPyMake_wxObject((wxFSFile*)&file,false);  // cast away const
 
 692             ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", obj));
 
 695                 rval = Py2wxString(ro);
 
 699         wxPyEndBlockThreads(blocked);
 
 706 IMPLEMENT_ABSTRACT_CLASS(wxPyHtmlFilter, wxHtmlFilter);
 
 710 // And now the version seen by SWIG
 
 712 %rename(HtmlFilter) wxPyHtmlFilter;
 
 713 class wxPyHtmlFilter : public wxObject {
 
 715     %pythonAppend wxPyHtmlFilter   "self._setCallbackInfo(self, HtmlFilter)"
 
 718     void _setCallbackInfo(PyObject* self, PyObject* _class);
 
 722 // TODO: wxHtmlFilterHTML
 
 725 //---------------------------------------------------------------------------
 
 727 //---------------------------------------------------------------------------
 
 731 class wxPyHtmlWindow : public wxHtmlWindow {
 
 732     DECLARE_ABSTRACT_CLASS(wxPyHtmlWindow)
 
 734     wxPyHtmlWindow(wxWindow *parent, wxWindowID id = -1,
 
 735                    const wxPoint& pos = wxDefaultPosition,
 
 736                    const wxSize& size = wxDefaultSize,
 
 737                    long style = wxHW_DEFAULT_STYLE,
 
 738                    const wxString& name = wxPyHtmlWindowNameStr)
 
 739         : wxHtmlWindow(parent, id, pos, size, style, name)  {};
 
 740     wxPyHtmlWindow() : wxHtmlWindow() {};
 
 742     bool ScrollToAnchor(const wxString& anchor) {
 
 743         return wxHtmlWindow::ScrollToAnchor(anchor);
 
 746     bool HasAnchor(const wxString& anchor) {
 
 747         const wxHtmlCell *c = m_Cell->Find(wxHTML_COND_ISANCHOR, &anchor);
 
 751     void OnLinkClicked(const wxHtmlLinkInfo& link);
 
 753     wxHtmlOpeningStatus OnOpeningURL(wxHtmlURLType type,
 
 755                                       wxString *redirect) const;
 
 757     DEC_PYCALLBACK__STRING(OnSetTitle);
 
 758     DEC_PYCALLBACK__CELLINTINT(OnCellMouseHover);
 
 759     DEC_PYCALLBACK__CELLINTINTME(OnCellClicked);
 
 763 IMPLEMENT_ABSTRACT_CLASS( wxPyHtmlWindow, wxHtmlWindow );
 
 764 IMP_PYCALLBACK__STRING(wxPyHtmlWindow, wxHtmlWindow, OnSetTitle);
 
 765 IMP_PYCALLBACK__CELLINTINT(wxPyHtmlWindow, wxHtmlWindow, OnCellMouseHover);
 
 766 IMP_PYCALLBACK__CELLINTINTME(wxPyHtmlWindow, wxHtmlWindow, OnCellClicked);
 
 769 void wxPyHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link) {
 
 771     wxPyBlock_t blocked = wxPyBeginBlockThreads();
 
 772     if ((found = wxPyCBH_findCallback(m_myInst, "OnLinkClicked"))) {
 
 773         PyObject* obj = wxPyConstructObject((void*)&link, wxT("wxHtmlLinkInfo"), 0);
 
 774         wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj));
 
 777     wxPyEndBlockThreads(blocked);
 
 779         wxHtmlWindow::OnLinkClicked(link);
 
 783 wxHtmlOpeningStatus wxPyHtmlWindow::OnOpeningURL(wxHtmlURLType type,
 
 785                                                  wxString *redirect) const {
 
 787     wxHtmlOpeningStatus rval;
 
 788     wxPyBlock_t blocked = wxPyBeginBlockThreads();
 
 789     if ((found = wxPyCBH_findCallback(m_myInst, "OnOpeningURL"))) {
 
 791         PyObject* s = wx2PyString(url);
 
 792         ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(iO)", type, s));
 
 794         if (PyString_Check(ro)
 
 795 #if PYTHON_API_VERSION >= 1009
 
 796             || PyUnicode_Check(ro)
 
 799             *redirect = Py2wxString(ro);
 
 800             rval = wxHTML_REDIRECT;
 
 803             PyObject* num = PyNumber_Int(ro);
 
 804             rval = (wxHtmlOpeningStatus)PyInt_AsLong(num);
 
 809     wxPyEndBlockThreads(blocked);
 
 811         rval = wxHtmlWindow::OnOpeningURL(type, url, redirect);
 
 820 MustHaveApp(wxPyHtmlWindow);
 
 822 %rename(HtmlWindow) wxPyHtmlWindow;
 
 823 class wxPyHtmlWindow : public wxScrolledWindow {
 
 825     %pythonAppend wxPyHtmlWindow      "self._setCallbackInfo(self, HtmlWindow); self._setOORInfo(self)"
 
 826     %pythonAppend wxPyHtmlWindow()    ""
 
 827     %typemap(out) wxPyHtmlWindow*;    // turn off this typemap
 
 829     wxPyHtmlWindow(wxWindow *parent, int id = -1,
 
 830                  const wxPoint& pos = wxDefaultPosition,
 
 831                  const wxSize& size = wxDefaultSize,
 
 832                  int style=wxHW_DEFAULT_STYLE,
 
 833                  const wxString& name = wxPyHtmlWindowNameStr);
 
 834     %RenameCtor(PreHtmlWindow, wxPyHtmlWindow());
 
 836     // Turn it back on again
 
 837     %typemap(out) wxPyHtmlWindow* { $result = wxPyMake_wxObject($1, $owner); }
 
 839     bool Create(wxWindow *parent, int id = -1,
 
 840                 const wxPoint& pos = wxDefaultPosition,
 
 841                 const wxSize& size = wxDefaultSize,
 
 842                 int style=wxHW_SCROLLBAR_AUTO,
 
 843                 const wxString& name = wxPyHtmlWindowNameStr);
 
 846     void _setCallbackInfo(PyObject* self, PyObject* _class);
 
 849     // Set HTML page and display it. !! source is HTML document itself,
 
 850     // it is NOT address/filename of HTML document. If you want to
 
 851     // specify document location, use LoadPage() istead
 
 852     // Return value : False if an error occurred, True otherwise
 
 853     bool SetPage(const wxString& source);
 
 855     // Load HTML page from given location. Location can be either
 
 856     // a) /usr/wxGTK2/docs/html/wx.htm
 
 857     // b) http://www.somewhere.uk/document.htm
 
 858     // c) ftp://ftp.somesite.cz/pub/something.htm
 
 859     // In case there is no prefix (http:,ftp:), the method
 
 860     // will try to find it itself (1. local file, then http or ftp)
 
 861     // After the page is loaded, the method calls SetPage() to display it.
 
 862     // Note : you can also use path relative to previously loaded page
 
 863     // Return value : same as SetPage
 
 864     bool LoadPage(const wxString& location);
 
 866     // Loads HTML page from file
 
 867     bool LoadFile(const wxString& filename);
 
 869     // Append to current page
 
 870     bool AppendToPage(const wxString& source);
 
 872      // Returns full location of opened page
 
 873     wxString GetOpenedPage();
 
 875     // Returns anchor within opened page
 
 876     wxString GetOpenedAnchor();
 
 878     // Returns <TITLE> of opened page or empty string otherwise
 
 879     wxString GetOpenedPageTitle();
 
 881     // Sets frame in which page title will  be displayed. Format is format of
 
 882     // frame title, e.g. "HtmlHelp : %s". It must contain exactly one %s
 
 883     void SetRelatedFrame(wxFrame* frame, const wxString& format);
 
 884     wxFrame* GetRelatedFrame();
 
 886     // After(!) calling SetRelatedFrame, this sets statusbar slot where messages
 
 887     // will be displayed. Default is -1 = no messages.
 
 888     void SetRelatedStatusBar(int bar);
 
 890     // Sets fonts to be used when displaying HTML page.
 
 892         void SetFonts(wxString normal_face, wxString fixed_face, PyObject* sizes=NULL) {
 
 894             if (sizes) temp = int_LIST_helper(sizes);
 
 895             self->SetFonts(normal_face, fixed_face, temp);
 
 901     // Sets font sizes to be relative to the given size or the system
 
 902     // default size; use either specified or default font
 
 903     void SetStandardFonts(int size = -1,
 
 904                           const wxString& normal_face = wxPyEmptyString,
 
 905                           const wxString& fixed_face = wxPyEmptyString);
 
 908         void, SetLabel(const wxString& title),
 
 911     // Sets space between text and window borders.
 
 912     void SetBorders(int b);
 
 914     // Sets the bitmap to use for background (currnetly it will be tiled,
 
 915     // when/if we have CSS support we could add other possibilities...)
 
 916     void SetBackgroundImage(const wxBitmap& bmpBg);
 
 918     // Saves custom settings into cfg config. it will use the path 'path'
 
 919     // if given, otherwise it will save info into currently selected path.
 
 920     // saved values : things set by SetFonts, SetBorders.
 
 921     void ReadCustomization(wxConfigBase *cfg, wxString path = wxPyEmptyString);
 
 922     void WriteCustomization(wxConfigBase *cfg, wxString path = wxPyEmptyString);
 
 924     // Goes to previous/next page (in browsing history)
 
 925     // Returns True if successful, False otherwise
 
 927     bool HistoryForward();
 
 928     bool HistoryCanBack();
 
 929     bool HistoryCanForward();
 
 934     // Returns pointer to conteiners/cells structure.
 
 935     wxHtmlContainerCell* GetInternalRepresentation();
 
 937     // Returns a pointer to the parser.
 
 938     wxHtmlWinParser* GetParser();
 
 940     bool ScrollToAnchor(const wxString& anchor);
 
 941     bool HasAnchor(const wxString& anchor);
 
 944     static void AddFilter(wxPyHtmlFilter *filter);
 
 946     // Helper functions to select parts of page:
 
 947     void SelectWord(const wxPoint& pos);
 
 948     void SelectLine(const wxPoint& pos);
 
 951     // Convert selection to text:
 
 952     wxString SelectionToText();
 
 954     // Converts current page to text:
 
 957     void OnLinkClicked(const wxHtmlLinkInfo& link);
 
 958     void OnSetTitle(const wxString& title);
 
 959     void OnCellMouseHover(wxHtmlCell *cell, wxCoord x, wxCoord y);
 
 960     void OnCellClicked(wxHtmlCell *cell,
 
 961                        wxCoord x, wxCoord y,
 
 962                        const wxMouseEvent& event);
 
 963     %MAKE_BASE_FUNC(HtmlWindow, OnLinkClicked);
 
 964     %MAKE_BASE_FUNC(HtmlWindow, OnSetTitle);
 
 965     %MAKE_BASE_FUNC(HtmlWindow, OnCellMouseHover);
 
 966     %MAKE_BASE_FUNC(HtmlWindow, OnCellClicked);
 
 968     static wxVisualAttributes
 
 969     GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
 
 975 //---------------------------------------------------------------------------
 
 976 //---------------------------------------------------------------------------
 
 980 MustHaveApp(wxHtmlDCRenderer);
 
 982 class wxHtmlDCRenderer : public wxObject {
 
 987     void SetDC(wxDC *dc, int maxwidth);
 
 988     void SetSize(int width, int height);
 
 989     void SetHtmlText(const wxString& html,
 
 990                      const wxString& basepath = wxPyEmptyString,
 
 992     // Sets fonts to be used when displaying HTML page. (if size null then default sizes used).
 
 994         void SetFonts(wxString normal_face, wxString fixed_face, PyObject* sizes=NULL) {
 
 996             if (sizes) temp = int_LIST_helper(sizes);
 
 997             self->SetFonts(normal_face, fixed_face, temp);
 
1003     // Sets font sizes to be relative to the given size or the system
 
1004     // default size; use either specified or default font
 
1005     void SetStandardFonts(int size = -1,
 
1006                           const wxString& normal_face = wxPyEmptyString,
 
1007                           const wxString& fixed_face = wxPyEmptyString);
 
1009     int Render(int x, int y, int from = 0, int dont_render = false, int maxHeight = INT_MAX,
 
1010                //int *known_pagebreaks = NULL, int number_of_pages = 0
 
1011                int* choices=NULL, int LCOUNT = 0
 
1013     int GetTotalHeight();
 
1014                 // returns total height of the html document
 
1015                 // (compare Render's return value with this)
 
1026 MustHaveApp(wxHtmlPrintout);
 
1028 class wxHtmlPrintout : public wxPyPrintout {
 
1030     wxHtmlPrintout(const wxString& title = wxPyHtmlPrintoutTitleStr);
 
1031     //~wxHtmlPrintout();   wxPrintPreview object takes ownership...
 
1033     void SetHtmlText(const wxString& html,
 
1034                      const wxString &basepath = wxPyEmptyString,
 
1036     void SetHtmlFile(const wxString &htmlfile);
 
1037     void SetHeader(const wxString& header, int pg = wxPAGE_ALL);
 
1038     void SetFooter(const wxString& footer, int pg = wxPAGE_ALL);
 
1040     // Sets fonts to be used when displaying HTML page. (if size null then default sizes used).
 
1042         void SetFonts(wxString normal_face, wxString fixed_face, PyObject* sizes=NULL) {
 
1044             if (sizes) temp = int_LIST_helper(sizes);
 
1045             self->SetFonts(normal_face, fixed_face, temp);
 
1051     // Sets font sizes to be relative to the given size or the system
 
1052     // default size; use either specified or default font
 
1053     void SetStandardFonts(int size = -1,
 
1054                           const wxString& normal_face = wxPyEmptyString,
 
1055                           const wxString& fixed_face = wxPyEmptyString);
 
1057     void SetMargins(float top = 25.2, float bottom = 25.2,
 
1058                     float left = 25.2, float right = 25.2,
 
1061     // Adds input filter
 
1062     static void AddFilter(wxHtmlFilter *filter);
 
1065     static void CleanUpStatics();
 
1070 MustHaveApp(wxHtmlEasyPrinting);
 
1072 class wxHtmlEasyPrinting : public wxObject {
 
1074     wxHtmlEasyPrinting(const wxString& name = wxPyHtmlPrintingTitleStr,
 
1075                        wxWindow *parentWindow = NULL);
 
1076     ~wxHtmlEasyPrinting();
 
1078     void PreviewFile(const wxString &htmlfile);
 
1079     void PreviewText(const wxString &htmltext, const wxString& basepath = wxPyEmptyString);
 
1080     void PrintFile(const wxString &htmlfile);
 
1081     void PrintText(const wxString &htmltext, const wxString& basepath = wxPyEmptyString);
 
1082 //    void PrinterSetup();
 
1084     void SetHeader(const wxString& header, int pg = wxPAGE_ALL);
 
1085     void SetFooter(const wxString& footer, int pg = wxPAGE_ALL);
 
1088         void SetFonts(wxString normal_face, wxString fixed_face, PyObject* sizes=NULL) {
 
1090             if (sizes) temp = int_LIST_helper(sizes);
 
1091             self->SetFonts(normal_face, fixed_face, temp);
 
1097     // Sets font sizes to be relative to the given size or the system
 
1098     // default size; use either specified or default font
 
1099     void SetStandardFonts(int size = -1,
 
1100                           const wxString& normal_face = wxPyEmptyString,
 
1101                           const wxString& fixed_face = wxPyEmptyString);
 
1103     wxPrintData *GetPrintData() {return m_PrintData;}
 
1104     wxPageSetupDialogData *GetPageSetupData() {return m_PageSetupData;}
 
1109 //---------------------------------------------------------------------------
 
1110 //---------------------------------------------------------------------------
 
1114 class wxHtmlBookRecord {
 
1116     wxHtmlBookRecord(const wxString& bookfile, const wxString& basepath,
 
1117                      const wxString& title, const wxString& start);
 
1119     wxString GetBookFile();
 
1120     wxString GetTitle();
 
1121     wxString GetStart();
 
1122     wxString GetBasePath();
 
1124     void SetContentsRange(int start, int end);
 
1125     int GetContentsStart();
 
1126     int GetContentsEnd();
 
1128     void SetTitle(const wxString& title);
 
1129     void SetBasePath(const wxString& path);
 
1130     void SetStart(const wxString& start);
 
1132     wxString GetFullPath(const wxString &page) const;
 
1135 //---------------------------------------------------------------------------
 
1136 // WXWIN_COMPATIBILITY_2_4
 
1138 struct wxHtmlContentsItem
 
1141         int GetLevel() { return self->m_Level; }
 
1142         int GetID() { return self->m_ID; }
 
1143         wxString GetName() { return self->m_Name; }
 
1144         wxString GetPage() { return self->m_Page; }
 
1145         wxHtmlBookRecord* GetBook() { return self->m_Book; }
 
1149 //---------------------------------------------------------------------------
 
1151 class wxHtmlSearchStatus
 
1154     //wxHtmlSearchStatus(wxHtmlHelpData* base, const wxString& keyword,
 
1155     //                   const wxString& book = wxPyEmptyString);
 
1160     const wxString& GetName();
 
1163 //---------------------------------------------------------------------------
 
1165 class wxHtmlHelpData {
 
1170     void SetTempDir(const wxString& path);
 
1171     bool AddBook(const wxString& book);
 
1172 //      bool AddBookParam(const wxString& title, const wxString& contfile,
 
1173 //                    const wxString& indexfile=wxPyEmptyString,
 
1174 //                    const wxString& deftopic=wxPyEmptyString,
 
1175 //                    const wxString& path=wxPyEmptyString);
 
1177     wxString FindPageByName(const wxString& page);
 
1178     wxString FindPageById(int id);
 
1180     // TODO: this one needs fixed...
 
1181     const wxHtmlBookRecArray& GetBookRecArray();
 
1185 //---------------------------------------------------------------------------
 
1198     wxHF_ICONS_BOOK_CHAPTER,
 
1218     wxID_HTML_BOOKMARKSLIST,
 
1219     wxID_HTML_BOOKMARKSADD,
 
1220     wxID_HTML_BOOKMARKSREMOVE,
 
1222     wxID_HTML_INDEXPAGE,
 
1223     wxID_HTML_INDEXLIST,
 
1224     wxID_HTML_INDEXTEXT,
 
1225     wxID_HTML_INDEXBUTTON,
 
1226     wxID_HTML_INDEXBUTTONALL,
 
1228     wxID_HTML_SEARCHPAGE,
 
1229     wxID_HTML_SEARCHTEXT,
 
1230     wxID_HTML_SEARCHLIST,
 
1231     wxID_HTML_SEARCHBUTTON,
 
1232     wxID_HTML_SEARCHCHOICE,
 
1238 MustHaveApp(wxHtmlHelpWindow);
 
1240 class wxHtmlHelpWindow : public wxWindow
 
1243     %pythonAppend wxHtmlHelpWindow    "self._setOORInfo(self)"
 
1244     %pythonAppend wxHtmlHelpWindow()       ""
 
1245     %typemap(out) wxHtmlHelpWindow*;    // turn off this typemap
 
1247     wxHtmlHelpWindow(wxWindow* parent, wxWindowID wxWindowID,
 
1248                      const wxPoint& pos = wxDefaultPosition,
 
1249                      const wxSize& size = wxDefaultSize,
 
1250                      int style = wxTAB_TRAVERSAL|wxNO_BORDER,
 
1251                      int helpStyle = wxHF_DEFAULT_STYLE,
 
1252                      wxHtmlHelpData* data = NULL);
 
1253     %RenameCtor(PreHtmlHelpWindow, wxHtmlHelpWindow(wxHtmlHelpData* data = NULL));
 
1255     // Turn it back on again
 
1256     %typemap(out) wxHtmlHelpWindow* { $result = wxPyMake_wxObject($1, $owner); }
 
1258     bool Create(wxWindow* parent, wxWindowID id,
 
1259                 const wxPoint& pos = wxDefaultPosition,
 
1260                 const wxSize& size = wxDefaultSize,
 
1261                 int style = wxTAB_TRAVERSAL|wxNO_BORDER,
 
1262                 int helpStyle = wxHF_DEFAULT_STYLE);
 
1264     wxHtmlHelpData* GetData();
 
1265     wxHtmlHelpController* GetController() const;
 
1267     %disownarg( wxHtmlHelpController* controller );
 
1268     void SetController(wxHtmlHelpController* controller);
 
1269     %cleardisown( wxHtmlHelpController* controller );
 
1271     // Displays page x. If not found it will offect the user a choice of
 
1273     // Looking for the page runs in these steps:
 
1274     // 1. try to locate file named x (if x is for example "doc/howto.htm")
 
1275     // 2. try to open starting page of book x
 
1276     // 3. try to find x in contents (if x is for example "How To ...")
 
1277     // 4. try to find x in index (if x is for example "How To ...")
 
1278     bool Display(const wxString& x);
 
1280     // Alternative version that works with numeric ID.
 
1281     // (uses extension to MS format, <param name="ID" value=id>, see docs)
 
1282     %Rename(DisplayID,  bool,  Display(int id));
 
1284     // Displays help window and focuses contents.
 
1285     bool DisplayContents();
 
1287     // Displays help window and focuses index.
 
1288     bool DisplayIndex();
 
1290     // Searches for keyword. Returns true and display page if found, return
 
1292     // Syntax of keyword is Altavista-like:
 
1293     // * words are separated by spaces
 
1294     //   (but "\"hello world\"" is only one world "hello world")
 
1295     // * word may be pretended by + or -
 
1296     //   (+ : page must contain the word ; - : page can't contain the word)
 
1297     // * if there is no + or - before the word, + is default
 
1298     bool KeywordSearch(const wxString& keyword,
 
1299                        wxHelpSearchMode mode = wxHELP_SEARCH_ALL);
 
1301     void UseConfig(wxConfigBase *config, const wxString& rootpath = wxEmptyString);
 
1303     // Saves custom settings into cfg config. it will use the path 'path'
 
1304     // if given, otherwise it will save info into currently selected path.
 
1305     // saved values : things set by SetFonts, SetBorders.
 
1306     void ReadCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString);
 
1307     void WriteCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString);
 
1309     // call this to let wxHtmlHelpWindow know page changed
 
1310     void NotifyPageChanged();
 
1312     // Refreshes Contents and Index tabs
 
1313     void RefreshLists();
 
1315     // Gets the HTML window
 
1316     wxHtmlWindow* GetHtmlWindow() const;
 
1318     // Gets the splitter window
 
1319     wxSplitterWindow* GetSplitterWindow();
 
1322     wxToolBar* GetToolBar() const;
 
1324     // Gets the configuration data
 
1325     wxHtmlHelpFrameCfg& GetCfgData();
 
1327     // Gets the tree control
 
1328     wxTreeCtrl *GetTreeCtrl() const;
 
1333 class wxHtmlWindowEvent: public wxNotifyEvent
 
1336     wxHtmlWindowEvent(wxEventType commandType = wxEVT_NULL, int id = 0):
 
1337         wxNotifyEvent(commandType, id);
 
1339     void SetURL(const wxString& url);
 
1340     const wxString& GetURL() const;
 
1345 MustHaveApp(wxHtmlHelpFrame);
 
1347 class wxHtmlHelpFrame : public wxFrame {
 
1349     %pythonAppend wxHtmlHelpFrame    "self._setOORInfo(self)"
 
1350     %pythonAppend wxHtmlHelpFrame()       ""
 
1351     %typemap(out) wxHtmlHelpFrame*;    // turn off this typemap
 
1353     wxHtmlHelpFrame(wxWindow* parent, int wxWindowID,
 
1354                     const wxString& title = wxPyEmptyString,
 
1355                     int style = wxHF_DEFAULTSTYLE, wxHtmlHelpData* data = NULL);
 
1356     %RenameCtor(PreHtmlHelpFrame, wxHtmlHelpFrame(wxHtmlHelpData* data = NULL));
 
1358     // Turn it back on again
 
1359     %typemap(out) wxHtmlHelpFrame* { $result = wxPyMake_wxObject($1, $owner); }
 
1361     bool Create(wxWindow* parent, wxWindowID id,
 
1362                 const wxString& title = wxPyEmptyString,
 
1363                 int style = wxHF_DEFAULT_STYLE);
 
1365     wxHtmlHelpData* GetData();
 
1366     void SetTitleFormat(const wxString& format);
 
1368     void AddGrabIfNeeded();
 
1370     /// Returns the help controller associated with the window.
 
1371     wxHtmlHelpController* GetController() const;
 
1373     /// Sets the help controller associated with the window.
 
1374     %disownarg( wxHtmlHelpController* controller );
 
1375     void SetController(wxHtmlHelpController* controller);
 
1376     %cleardisown( wxHtmlHelpController* controller );
 
1378     /// Returns the help window.
 
1379     wxHtmlHelpWindow* GetHelpWindow() const;
 
1382         %# For compatibility from before the refactor
 
1383         def Display(self, x):
 
1384             return self.GetHelpWindow().Display(x)
 
1385         def DisplayID(self, x):
 
1386             return self.GetHelpWindow().DisplayID(id)
 
1387         def DisplayContents(self):
 
1388             return self.GetHelpWindow().DisplayContents()
 
1389         def DisplayIndex(self):
 
1390             return self.GetHelpWindow().DisplayIndex()
 
1392         def KeywordSearch(self, keyword):
 
1393             return self.GetHelpWindow().KeywordSearch(keyword)
 
1395         def UseConfig(self, config, rootpath=""):
 
1396             return self.GetHelpWindow().UseConfig(config, rootpath)
 
1397         def ReadCustomization(self, config, rootpath=""):
 
1398             return self.GetHelpWindow().ReadCustomization(config, rootpath)
 
1399         def WriteCustomization(self, config, rootpath=""):
 
1400             return self.GetHelpWindow().WriteCustomization(config, rootpath)
 
1406 MustHaveApp(wxHtmlHelpDialog);
 
1408 class wxHtmlHelpDialog : public wxDialog
 
1411     %pythonAppend wxHtmlHelpDialog    "self._setOORInfo(self)"
 
1412     %pythonAppend wxHtmlHelpDialog()       ""
 
1413     %typemap(out) wxHtmlHelpDialog*;    // turn off this typemap
 
1415     wxHtmlHelpDialog(wxWindow* parent, wxWindowID wxWindowID,
 
1416                     const wxString& title = wxPyEmptyString,
 
1417                     int style = wxHF_DEFAULT_STYLE, wxHtmlHelpData* data = NULL);
 
1418     %RenameCtor(PreHtmlHelpDialog, wxHtmlHelpDialog(wxHtmlHelpData* data = NULL));
 
1420     // Turn it back on again
 
1421     %typemap(out) wxHtmlHelpDialog* { $result = wxPyMake_wxObject($1, $owner); }
 
1423     bool Create(wxWindow* parent, wxWindowID id, const wxString& title = wxPyEmptyString,
 
1424                 int style = wxHF_DEFAULT_STYLE);
 
1426     /// Returns the data associated with this dialog.
 
1427     wxHtmlHelpData* GetData();
 
1429     /// Returns the controller that created this dialog.
 
1430     wxHtmlHelpController* GetController() const;
 
1432     /// Sets the controller associated with this dialog.
 
1433     %disownarg( wxHtmlHelpController* controller );
 
1434     void SetController(wxHtmlHelpController* controller);
 
1435     %cleardisown( wxHtmlHelpController* controller );
 
1437     /// Returns the help window.
 
1438     wxHtmlHelpWindow* GetHelpWindow() const;
 
1440     // Sets format of title of the frame. Must contain exactly one "%s"
 
1441     // (for title of displayed HTML page)
 
1442     void SetTitleFormat(const wxString& format);
 
1444     // Override to add custom buttons to the toolbar
 
1445 //    virtual void AddToolbarButtons(wxToolBar* WXUNUSED(toolBar), int WXUNUSED(style)) {};
 
1450 //---------------------------------------------------------------------------
 
1453 // TODO: Make virtual methods of this class overridable in Python.
 
1455 MustHaveApp(wxHelpControllerBase);
 
1457 class wxHelpControllerBase: public wxObject
 
1460 //    wxHelpControllerBase(wxWindow* parentWindow = NULL);
 
1461 //    ~wxHelpControllerBase();
 
1463     %nokwargs Initialize;
 
1464     virtual bool Initialize(const wxString& file, int server );
 
1465     virtual bool Initialize(const wxString& file);
 
1467     virtual void SetViewer(const wxString& viewer, long flags = 0);
 
1469     // If file is "", reloads file given  in Initialize
 
1470     virtual bool LoadFile(const wxString& file = wxEmptyString) /* = 0 */;
 
1472     // Displays the contents
 
1473     virtual bool DisplayContents(void) /* = 0 */;
 
1475     %nokwargs DisplaySection;
 
1477     // Display the given section
 
1478     virtual bool DisplaySection(int sectionNo) /* = 0 */;
 
1480     // Display the section using a context id
 
1481     virtual bool DisplayContextPopup(int contextId);
 
1483     // Display the text in a popup, if possible
 
1484     virtual bool DisplayTextPopup(const wxString& text, const wxPoint& pos);
 
1486     // By default, uses KeywordSection to display a topic. Implementations
 
1487     // may override this for more specific behaviour.
 
1488     virtual bool DisplaySection(const wxString& section);
 
1490     virtual bool DisplayBlock(long blockNo) /* = 0 */;
 
1491     virtual bool KeywordSearch(const wxString& k,
 
1492                                wxHelpSearchMode mode = wxHELP_SEARCH_ALL) /* = 0 */;
 
1494     /// Allows one to override the default settings for the help frame.
 
1495     virtual void SetFrameParameters(const wxString& title,
 
1497                                     const wxPoint& pos = wxDefaultPosition,
 
1498                                     bool newFrameEachTime = false);
 
1500     /// Obtains the latest settings used by the help frame and the help
 
1502     virtual wxFrame *GetFrameParameters(wxSize *size = NULL,
 
1503                                         wxPoint *pos = NULL,
 
1504                                         bool *newFrameEachTime = NULL);
 
1506     virtual bool Quit() /* = 0 */;
 
1508     virtual void OnQuit();
 
1510     /// Set the window that can optionally be used for the help window's parent.
 
1511     virtual void SetParentWindow(wxWindow* win);
 
1513     /// Get the window that can optionally be used for the help window's parent.
 
1514     virtual wxWindow* GetParentWindow() const;
 
1521 MustHaveApp(wxHtmlHelpController);
 
1523 class wxHtmlHelpController : public wxHelpControllerBase
 
1526 //    %pythonAppend wxHtmlHelpController "self._setOORInfo(self)"
 
1528     wxHtmlHelpController(int style = wxHF_DEFAULT_STYLE, wxWindow* parentWindow = NULL);
 
1529     ~wxHtmlHelpController();
 
1531     wxHtmlHelpWindow* GetHelpWindow();
 
1532     void SetHelpWindow(wxHtmlHelpWindow* helpWindow);
 
1534     wxHtmlHelpFrame* GetFrame();
 
1535     wxHtmlHelpDialog* GetDialog();
 
1537     void SetTitleFormat(const wxString& format);
 
1538     void SetTempDir(const wxString& path);
 
1539     bool AddBook(const wxString& book, int show_wait_msg = false);
 
1540     void Display(const wxString& x);
 
1541     %Rename(DisplayID,  void,  Display(int id));
 
1542     void DisplayContents();
 
1543     void DisplayIndex();
 
1544     bool KeywordSearch(const wxString& keyword);
 
1545     void UseConfig(wxConfigBase *config, const wxString& rootpath = wxPyEmptyString);
 
1546     void ReadCustomization(wxConfigBase *cfg, wxString path = wxPyEmptyString);
 
1547     void WriteCustomization(wxConfigBase *cfg, wxString path = wxPyEmptyString);
 
1549     void MakeModalIfNeeded();
 
1550     wxWindow* FindTopLevelWindow();
 
1556  * A convenience class particularly for use on wxMac,
 
1557  * where you can only show modal dialogs from a modal
 
1562  * wxHtmlModalHelp help(parent, filename, topic);
 
1564  * If topic is empty, the help contents is displayed.
 
1567 class wxHtmlModalHelp
 
1570     wxHtmlModalHelp(wxWindow* parent, const wxString& helpFile,
 
1571                     const wxString& topic = wxEmptyString,
 
1572                     int style = wxHF_DEFAULT_STYLE | wxHF_DIALOG | wxHF_MODAL);
 
1576 //---------------------------------------------------------------------------
 
1578     wxPyPtrTypeMap_Add("wxHtmlTagHandler",    "wxPyHtmlTagHandler");
 
1579     wxPyPtrTypeMap_Add("wxHtmlWinTagHandler", "wxPyHtmlWinTagHandler");
 
1580     wxPyPtrTypeMap_Add("wxHtmlWindow",        "wxPyHtmlWindow");
 
1581     wxPyPtrTypeMap_Add("wxHtmlFilter",        "wxPyHtmlFilter");
 
1583 //---------------------------------------------------------------------------
 
1584 //---------------------------------------------------------------------------