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);
180 // Returns HTML source inside the element (i.e. between the starting
182 wxString GetInnerSource(const wxHtmlTag& tag);
186 //---------------------------------------------------------------------------
188 class wxHtmlWinParser : public wxHtmlParser {
190 wxHtmlWinParser(wxPyHtmlWindow *wnd = NULL);
192 void SetDC(wxDC *dc);
196 wxPyHtmlWindow* GetWindow();
197 %pythoncode { GetWindow = wx._deprecated(GetWindow) }
199 wxHtmlWindowInterface *GetWindowInterface();
201 // Sets fonts to be used when displaying HTML page. (if size null then default sizes used).
203 void SetFonts(wxString normal_face, wxString fixed_face, PyObject* sizes=NULL) {
205 if (sizes) temp = int_LIST_helper(sizes);
206 self->SetFonts(normal_face, fixed_face, temp);
212 // Sets font sizes to be relative to the given size or the system
213 // default size; use either specified or default font
214 void SetStandardFonts(int size = -1,
215 const wxString& normal_face = wxPyEmptyString,
216 const wxString& fixed_face = wxPyEmptyString);
219 wxHtmlContainerCell* GetContainer();
220 wxHtmlContainerCell* OpenContainer();
221 wxHtmlContainerCell *SetContainer(wxHtmlContainerCell *c);
222 wxHtmlContainerCell* CloseContainer();
225 void SetFontSize(int s);
227 void SetFontBold(int x);
229 void SetFontItalic(int x);
230 int GetFontUnderlined();
231 void SetFontUnderlined(int x);
233 void SetFontFixed(int x);
235 void SetAlign(int a);
236 wxColour GetLinkColor();
237 void SetLinkColor(const wxColour& clr);
238 wxColour GetActualColor();
239 void SetActualColor(const wxColour& clr);
241 GetActualColour = GetActualColor
242 SetActualColour = SetActualColor
244 void SetLink(const wxString& link);
245 wxFont* CreateCurrentFont();
246 wxHtmlLinkInfo GetLink();
251 //---------------------------------------------------------------------------
254 class wxPyHtmlTagHandler : public wxHtmlTagHandler {
255 DECLARE_DYNAMIC_CLASS(wxPyHtmlTagHandler)
257 wxPyHtmlTagHandler() : wxHtmlTagHandler() {};
259 wxHtmlParser* GetParser() { return m_Parser; }
260 void ParseInner(const wxHtmlTag& tag) { wxHtmlTagHandler::ParseInner(tag); }
262 DEC_PYCALLBACK_STRING__pure(GetSupportedTags);
263 DEC_PYCALLBACK_BOOL_TAG_pure(HandleTag);
268 IMPLEMENT_DYNAMIC_CLASS(wxPyHtmlTagHandler, wxHtmlTagHandler);
270 IMP_PYCALLBACK_STRING__pure(wxPyHtmlTagHandler, wxHtmlTagHandler, GetSupportedTags);
271 IMP_PYCALLBACK_BOOL_TAG_pure(wxPyHtmlTagHandler, wxHtmlTagHandler, HandleTag);
275 %rename(HtmlTagHandler) wxPyHtmlTagHandler;
276 class wxPyHtmlTagHandler : public wxObject {
278 %pythonAppend wxPyHtmlTagHandler "self._setCallbackInfo(self, HtmlTagHandler)"
279 wxPyHtmlTagHandler();
281 void _setCallbackInfo(PyObject* self, PyObject* _class);
283 void SetParser(wxHtmlParser *parser);
284 wxHtmlParser* GetParser();
285 void ParseInner(const wxHtmlTag& tag);
289 //---------------------------------------------------------------------------
292 class wxPyHtmlWinTagHandler : public wxHtmlWinTagHandler {
293 DECLARE_DYNAMIC_CLASS(wxPyHtmlWinTagHandler)
295 wxPyHtmlWinTagHandler() : wxHtmlWinTagHandler() {};
297 wxHtmlWinParser* GetParser() { return m_WParser; }
298 void ParseInner(const wxHtmlTag& tag)
299 { wxHtmlWinTagHandler::ParseInner(tag); }
301 DEC_PYCALLBACK_STRING__pure(GetSupportedTags);
302 DEC_PYCALLBACK_BOOL_TAG_pure(HandleTag);
307 IMPLEMENT_DYNAMIC_CLASS( wxPyHtmlWinTagHandler, wxHtmlWinTagHandler);
309 IMP_PYCALLBACK_STRING__pure(wxPyHtmlWinTagHandler, wxHtmlWinTagHandler, GetSupportedTags);
310 IMP_PYCALLBACK_BOOL_TAG_pure(wxPyHtmlWinTagHandler, wxHtmlWinTagHandler, HandleTag);
314 %rename(HtmlWinTagHandler) wxPyHtmlWinTagHandler;
315 class wxPyHtmlWinTagHandler : public wxPyHtmlTagHandler {
317 %pythonAppend wxPyHtmlWinTagHandler "self._setCallbackInfo(self, HtmlWinTagHandler)"
318 wxPyHtmlWinTagHandler();
320 void _setCallbackInfo(PyObject* self, PyObject* _class);
322 void SetParser(wxHtmlParser *parser);
323 wxHtmlWinParser* GetParser();
324 void ParseInner(const wxHtmlTag& tag);
328 //---------------------------------------------------------------------------
332 class wxPyHtmlTagsModule : public wxHtmlTagsModule {
334 wxPyHtmlTagsModule(PyObject* thc) : wxHtmlTagsModule() {
335 m_tagHandlerClass = thc;
336 Py_INCREF(m_tagHandlerClass);
337 RegisterModule(this);
338 wxHtmlWinParser::AddModule(this);
342 wxPyBlock_t blocked = wxPyBeginBlockThreads();
343 Py_DECREF(m_tagHandlerClass);
344 m_tagHandlerClass = NULL;
345 for (size_t x=0; x < m_objArray.GetCount(); x++) {
346 PyObject* obj = (PyObject*)m_objArray.Item(x);
349 wxPyEndBlockThreads(blocked);
352 void FillHandlersTable(wxHtmlWinParser *parser) {
353 // Wave our magic wand... (if it works it's a miracle! ;-)
355 // First, make a new instance of the tag handler
356 wxPyBlock_t blocked = wxPyBeginBlockThreads();
357 PyObject* arg = PyTuple_New(0);
358 PyObject* obj = PyObject_CallObject(m_tagHandlerClass, arg);
361 // now figure out where it's C++ object is...
362 wxPyHtmlWinTagHandler* thPtr;
363 if (! wxPyConvertSwigPtr(obj, (void **)&thPtr, wxT("wxPyHtmlWinTagHandler"))) {
364 wxPyEndBlockThreads(blocked);
367 wxPyEndBlockThreads(blocked);
370 parser->AddTagHandler(thPtr);
377 PyObject* m_tagHandlerClass;
378 wxArrayPtrVoid m_objArray;
386 void wxHtmlWinParser_AddTagHandler(PyObject* tagHandlerClass) {
387 // Dynamically create a new wxModule. Refcounts tagHandlerClass
388 // and adds itself to the wxModules list and to the wxHtmlWinParser.
389 new wxPyHtmlTagsModule(tagHandlerClass);
394 //---------------------------------------------------------------------------
396 %typemap(out) wxHtmlCell* { $result = wxPyMake_wxObject($1, $owner); }
397 %typemap(out) const wxHtmlCell* { $result = wxPyMake_wxObject($1, $owner); }
399 //---------------------------------------------------------------------------
403 // wxHtmlSelection is data holder with information about text selection.
404 // Selection is defined by two positions (beginning and end of the selection)
405 // and two leaf(!) cells at these positions.
406 class wxHtmlSelection
412 void Set(const wxPoint& fromPos, const wxHtmlCell *fromCell,
413 const wxPoint& toPos, const wxHtmlCell *toCell);
414 %Rename(SetCells, void, Set(const wxHtmlCell *fromCell, const wxHtmlCell *toCell));
416 const wxHtmlCell *GetFromCell() const;
417 const wxHtmlCell *GetToCell() const;
419 // these values are in absolute coordinates:
420 const wxPoint& GetFromPos() const;
421 const wxPoint& GetToPos() const;
423 // these are From/ToCell's private data
424 const wxPoint& GetFromPrivPos() const;
425 const wxPoint& GetToPrivPos() const;
426 void SetFromPrivPos(const wxPoint& pos);
427 void SetToPrivPos(const wxPoint& pos);
430 const bool IsEmpty() const;
435 enum wxHtmlSelectionState
437 wxHTML_SEL_OUT, // currently rendered cell is outside the selection
438 wxHTML_SEL_IN, // ... is inside selection
439 wxHTML_SEL_CHANGING // ... is the cell on which selection state changes
444 // Selection state is passed to wxHtmlCell::Draw so that it can render itself
445 // differently e.g. when inside text selection or outside it.
446 class wxHtmlRenderingState
449 wxHtmlRenderingState();
450 ~wxHtmlRenderingState();
452 void SetSelectionState(wxHtmlSelectionState s);
453 wxHtmlSelectionState GetSelectionState() const;
455 void SetFgColour(const wxColour& c);
456 const wxColour& GetFgColour() const;
457 void SetBgColour(const wxColour& c);
458 const wxColour& GetBgColour() const;
463 // HTML rendering customization. This class is used when rendering wxHtmlCells
465 class wxHtmlRenderingStyle
468 virtual wxColour GetSelectedTextColour(const wxColour& clr) = 0;
469 virtual wxColour GetSelectedTextBgColour(const wxColour& clr) = 0;
473 class wxDefaultHtmlRenderingStyle : public wxHtmlRenderingStyle
476 virtual wxColour GetSelectedTextColour(const wxColour& clr);
477 virtual wxColour GetSelectedTextBgColour(const wxColour& clr);
482 // Information given to cells when drawing them. Contains rendering state,
483 // selection information and rendering style object that can be used to
484 // customize the output.
485 class wxHtmlRenderingInfo
488 wxHtmlRenderingInfo();
489 ~wxHtmlRenderingInfo();
491 void SetSelection(wxHtmlSelection *s);
492 wxHtmlSelection *GetSelection() const;
494 void SetStyle(wxHtmlRenderingStyle *style);
495 wxHtmlRenderingStyle& GetStyle();
497 wxHtmlRenderingState& GetState();
500 //---------------------------------------------------------------------------
506 wxHTML_FIND_EXACT = 1,
507 wxHTML_FIND_NEAREST_BEFORE = 2,
508 wxHTML_FIND_NEAREST_AFTER = 4
512 class wxHtmlCell : public wxObject {
514 %typemap(out) wxHtmlCell*; // turn off this typemap
519 // Turn it back on again
520 %typemap(out) wxHtmlCell* { $result = wxPyMake_wxObject($1, $owner); }
528 // Returns the maximum possible length of the cell.
529 // Call Layout at least once before using GetMaxTotalWidth()
530 int GetMaxTotalWidth() const;
532 const wxString& GetId() const;
533 void SetId(const wxString& id);
534 wxHtmlLinkInfo* GetLink(int x = 0, int y = 0);
535 wxHtmlCell* GetNext();
536 wxHtmlContainerCell* GetParent();
537 wxHtmlCell* GetFirstChild() const;
539 // Returns cursor to be used when mouse is over the cell:
540 virtual wxCursor GetMouseCursor(wxHtmlWindowInterface *window) const;
542 // Returns cursor to be used when mouse is over the cell:
543 wxCursor GetCursor() const;
544 %pythoncode { GetCursor = wx._deprecated(GetCursor) }
546 // Formatting cells are not visible on the screen, they only alter
548 bool IsFormattingCell() const;
551 void SetLink(const wxHtmlLinkInfo& link);
553 %disownarg(wxHtmlCell*);
554 void SetNext(wxHtmlCell *cell);
555 %cleardisown(wxHtmlCell*);
557 void SetParent(wxHtmlContainerCell *p);
558 void SetPos(int x, int y);
560 void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2,
561 wxHtmlRenderingInfo& info);
562 void DrawInvisible(wxDC& dc, int x, int y,
563 wxHtmlRenderingInfo& info);
564 const wxHtmlCell* Find(int condition, const void* param);
567 virtual bool ProcessMouseClick(wxHtmlWindowInterface *window,
569 const wxMouseEvent& event);
571 bool AdjustPagebreak(int* INOUT);
572 void SetCanLiveOnPagebreak(bool can);
574 // Can the line be broken before this cell?
575 bool IsLinebreakAllowed() const;
577 // Returns True for simple == terminal cells, i.e. not composite ones.
578 // This if for internal usage only and may disappear in future versions!
579 bool IsTerminalCell() const;
581 // Find a cell inside this cell positioned at the given coordinates
582 // (relative to this's positions). Returns NULL if no such cell exists.
583 // The flag can be used to specify whether to look for terminal or
584 // nonterminal cells or both. In either case, returned cell is deepest
585 // cell in cells tree that contains [x,y].
586 wxHtmlCell *FindCellByPos(wxCoord x, wxCoord y,
587 unsigned flags = wxHTML_FIND_EXACT) const;
589 // Returns absolute position of the cell on HTML canvas
590 // If rootCell is provided, then it's considered to be the root of the
591 // hierarchy and the returned value is relative to it.
592 wxPoint GetAbsPos(wxHtmlCell *rootCell = NULL) const;
594 // Returns root cell of the hierarchy (i.e. grand-grand-...-parent that
595 // doesn't have a parent itself)
596 wxHtmlCell *GetRootCell() const;
598 // Returns first (last) terminal cell inside this cell. It may return NULL,
599 // but it is rare -- only if there are no terminals in the tree.
600 wxHtmlCell *GetFirstTerminal() const ;
601 wxHtmlCell *GetLastTerminal() const ;
603 // Returns cell's depth, i.e. how far under the root cell it is
604 // (if it is the root, depth is 0)
605 unsigned GetDepth() const;
607 // Returns True if the cell appears before 'cell' in natural order of
608 // cells (= as they are read). If cell A is (grand)parent of cell B,
609 // then both A.IsBefore(B) and B.IsBefore(A) always return True.
610 bool IsBefore(wxHtmlCell *cell) const;
612 // Converts the cell into text representation. If sel != NULL then
613 // only part of the cell inside the selection is converted.
614 wxString ConvertToText(wxHtmlSelection *sel) const;
618 class wxHtmlWordCell : public wxHtmlCell
621 wxHtmlWordCell(const wxString& word, wxDC& dc);
622 wxString ConvertToText(wxHtmlSelection *sel) const;
623 bool IsLinebreakAllowed() const;
624 void SetPreviousWord(wxHtmlWordCell *cell);
628 class wxHtmlContainerCell : public wxHtmlCell {
630 wxHtmlContainerCell(wxHtmlContainerCell *parent);
632 %disownarg(wxHtmlCell*);
633 void InsertCell(wxHtmlCell *cell);
634 %cleardisown(wxHtmlCell*);
636 void SetAlignHor(int al);
638 void SetAlignVer(int al);
640 void SetIndent(int i, int what, int units = wxHTML_UNITS_PIXELS);
641 int GetIndent(int ind);
642 int GetIndentUnits(int ind);
643 void SetAlign(const wxHtmlTag& tag);
644 void SetWidthFloat(int w, int units);
645 %Rename(SetWidthFloatFromTag, void, SetWidthFloat(const wxHtmlTag& tag));
646 void SetMinHeight(int h, int align = wxHTML_ALIGN_TOP);
647 void SetBackgroundColour(const wxColour& clr);
648 wxColour GetBackgroundColour();
649 void SetBorder(const wxColour& clr1, const wxColour& clr2);
650 wxHtmlCell* GetFirstChild();
651 %pragma(python) addtoclass = "GetFirstCell = GetFirstChild"
656 class wxHtmlColourCell : public wxHtmlCell {
658 wxHtmlColourCell(const wxColour& clr, int flags = wxHTML_CLR_FOREGROUND);
663 class wxHtmlFontCell : public wxHtmlCell
666 wxHtmlFontCell(wxFont *font);
670 class wxHtmlWidgetCell : public wxHtmlCell {
672 wxHtmlWidgetCell(wxWindow* wnd, int w = 0);
679 //---------------------------------------------------------------------------
681 //---------------------------------------------------------------------------
685 %{ // here's the C++ version
686 class wxPyHtmlFilter : public wxHtmlFilter {
687 DECLARE_ABSTRACT_CLASS(wxPyHtmlFilter)
689 wxPyHtmlFilter() : wxHtmlFilter() {}
691 // returns True if this filter is able to open&read given file
692 virtual bool CanRead(const wxFSFile& file) const {
695 wxPyBlock_t blocked = wxPyBeginBlockThreads();
696 if ((found = wxPyCBH_findCallback(m_myInst, "CanRead"))) {
697 PyObject* obj = wxPyMake_wxObject((wxFSFile*)&file,false); // cast away const
698 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj));
701 wxPyEndBlockThreads(blocked);
706 // Reads given file and returns HTML document.
707 // Returns empty string if opening failed
708 virtual wxString ReadFile(const wxFSFile& file) const {
711 wxPyBlock_t blocked = wxPyBeginBlockThreads();
712 if ((found = wxPyCBH_findCallback(m_myInst, "ReadFile"))) {
713 PyObject* obj = wxPyMake_wxObject((wxFSFile*)&file,false); // cast away const
715 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", obj));
718 rval = Py2wxString(ro);
722 wxPyEndBlockThreads(blocked);
729 IMPLEMENT_ABSTRACT_CLASS(wxPyHtmlFilter, wxHtmlFilter);
733 // And now the version seen by SWIG
735 %rename(HtmlFilter) wxPyHtmlFilter;
736 class wxPyHtmlFilter : public wxObject {
738 %pythonAppend wxPyHtmlFilter "self._setCallbackInfo(self, HtmlFilter)"
741 void _setCallbackInfo(PyObject* self, PyObject* _class);
745 // TODO: wxHtmlFilterHTML
748 //---------------------------------------------------------------------------
751 class wxHtmlWindowInterface
755 wxHtmlWindowInterface();
756 virtual ~wxHtmlWindowInterface();
759 Called by the parser to set window's title to given text.
761 virtual void SetHTMLWindowTitle(const wxString& title) = 0;
764 // Called when a link is clicked.
766 // @param link information about the clicked link
768 // virtual void OnHTMLLinkClicked(const wxHtmlLinkInfo& link) = 0;
771 // Called when the parser needs to open another URL (e.g. an image).
773 // @param type Type of the URL request (e.g. image)
774 // @param url URL the parser wants to open
775 // @param redirect If the return value is wxHTML_REDIRECT, then the
776 // URL to redirect to will be stored in this variable
777 // (the pointer must never be NULL)
779 // @return indicator of how to treat the request
781 // virtual wxHtmlOpeningStatus OnHTMLOpeningURL(wxHtmlURLType type,
782 // const wxString& url,
783 // wxString *redirect) const = 0;
786 Converts coordinates @a pos relative to given @a cell to
787 physical coordinates in the window.
789 virtual wxPoint HTMLCoordsToWindow(wxHtmlCell *cell,
790 const wxPoint& pos) const = 0;
792 /// Returns the window used for rendering (may be NULL).
793 virtual wxWindow* GetHTMLWindow() = 0;
795 /// Returns background colour to use by default.
796 virtual wxColour GetHTMLBackgroundColour() const = 0;
798 /// Sets window's background to colour @a clr.
799 virtual void SetHTMLBackgroundColour(const wxColour& clr) = 0;
801 /// Sets window's background to given bitmap.
802 virtual void SetHTMLBackgroundImage(const wxBitmap& bmpBg) = 0;
804 /// Sets status bar text.
805 virtual void SetHTMLStatusText(const wxString& text) = 0;
807 /// Type of mouse cursor
810 /// Standard mouse cursor (typically an arrow)
812 /// Cursor shown over links
814 /// Cursor shown over selectable text
819 Returns mouse cursor of given @a type.
821 // virtual wxCursor GetHTMLCursor(HTMLCursor type) const = 0;
825 //---------------------------------------------------------------------------
827 //---------------------------------------------------------------------------
831 // wxHtmlWindowInterface and wxHtmlWindowMouseHelper
835 class wxPyHtmlWindow : public wxHtmlWindow {
836 DECLARE_ABSTRACT_CLASS(wxPyHtmlWindow)
838 wxPyHtmlWindow(wxWindow *parent, wxWindowID id = -1,
839 const wxPoint& pos = wxDefaultPosition,
840 const wxSize& size = wxDefaultSize,
841 long style = wxHW_DEFAULT_STYLE,
842 const wxString& name = wxPyHtmlWindowNameStr)
843 : wxHtmlWindow(parent, id, pos, size, style, name) {};
844 wxPyHtmlWindow() : wxHtmlWindow() {};
846 bool ScrollToAnchor(const wxString& anchor) {
847 return wxHtmlWindow::ScrollToAnchor(anchor);
850 bool HasAnchor(const wxString& anchor) {
851 const wxHtmlCell *c = m_Cell->Find(wxHTML_COND_ISANCHOR, &anchor);
855 void OnLinkClicked(const wxHtmlLinkInfo& link);
857 wxHtmlOpeningStatus OnOpeningURL(wxHtmlURLType type,
859 wxString *redirect) const;
861 DEC_PYCALLBACK__STRING(OnSetTitle);
862 DEC_PYCALLBACK__CELLINTINT(OnCellMouseHover);
863 DEC_PYCALLBACK_BOOL_CELLINTINTME(OnCellClicked);
868 IMPLEMENT_ABSTRACT_CLASS( wxPyHtmlWindow, wxHtmlWindow );
869 IMP_PYCALLBACK__STRING(wxPyHtmlWindow, wxHtmlWindow, OnSetTitle);
870 IMP_PYCALLBACK__CELLINTINT(wxPyHtmlWindow, wxHtmlWindow, OnCellMouseHover);
871 IMP_PYCALLBACK_BOOL_CELLINTINTME(wxPyHtmlWindow, wxHtmlWindow, OnCellClicked);
874 void wxPyHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link) {
876 wxPyBlock_t blocked = wxPyBeginBlockThreads();
877 if ((found = wxPyCBH_findCallback(m_myInst, "OnLinkClicked"))) {
878 PyObject* obj = wxPyConstructObject((void*)&link, wxT("wxHtmlLinkInfo"), 0);
879 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj));
882 wxPyEndBlockThreads(blocked);
884 wxHtmlWindow::OnLinkClicked(link);
888 wxHtmlOpeningStatus wxPyHtmlWindow::OnOpeningURL(wxHtmlURLType type,
890 wxString *redirect) const {
892 wxHtmlOpeningStatus rval;
893 wxPyBlock_t blocked = wxPyBeginBlockThreads();
894 if ((found = wxPyCBH_findCallback(m_myInst, "OnOpeningURL"))) {
896 PyObject* s = wx2PyString(url);
897 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(iO)", type, s));
899 if (PyString_Check(ro)
900 #if PYTHON_API_VERSION >= 1009
901 || PyUnicode_Check(ro)
904 *redirect = Py2wxString(ro);
905 rval = wxHTML_REDIRECT;
908 PyObject* num = PyNumber_Int(ro);
909 rval = (wxHtmlOpeningStatus)PyInt_AsLong(num);
914 wxPyEndBlockThreads(blocked);
916 rval = wxHtmlWindow::OnOpeningURL(type, url, redirect);
925 MustHaveApp(wxPyHtmlWindow);
927 %rename(HtmlWindow) wxPyHtmlWindow;
928 class wxPyHtmlWindow : public wxScrolledWindow //,
929 // public wxHtmlWindowInterface //,
930 // public wxHtmlWindowMouseHelper
933 %pythonAppend wxPyHtmlWindow "self._setCallbackInfo(self, HtmlWindow); self._setOORInfo(self)"
934 %pythonAppend wxPyHtmlWindow() ""
935 %typemap(out) wxPyHtmlWindow*; // turn off this typemap
937 wxPyHtmlWindow(wxWindow *parent, int id = -1,
938 const wxPoint& pos = wxDefaultPosition,
939 const wxSize& size = wxDefaultSize,
940 int style=wxHW_DEFAULT_STYLE,
941 const wxString& name = wxPyHtmlWindowNameStr);
942 %RenameCtor(PreHtmlWindow, wxPyHtmlWindow());
944 // Turn it back on again
945 %typemap(out) wxPyHtmlWindow* { $result = wxPyMake_wxObject($1, $owner); }
947 bool Create(wxWindow *parent, int id = -1,
948 const wxPoint& pos = wxDefaultPosition,
949 const wxSize& size = wxDefaultSize,
950 int style=wxHW_SCROLLBAR_AUTO,
951 const wxString& name = wxPyHtmlWindowNameStr);
954 void _setCallbackInfo(PyObject* self, PyObject* _class);
957 // Set HTML page and display it. !! source is HTML document itself,
958 // it is NOT address/filename of HTML document. If you want to
959 // specify document location, use LoadPage() istead
960 // Return value : False if an error occurred, True otherwise
961 bool SetPage(const wxString& source);
963 // Load HTML page from given location. Location can be either
964 // a) /usr/wxGTK2/docs/html/wx.htm
965 // b) http://www.somewhere.uk/document.htm
966 // c) ftp://ftp.somesite.cz/pub/something.htm
967 // In case there is no prefix (http:,ftp:), the method
968 // will try to find it itself (1. local file, then http or ftp)
969 // After the page is loaded, the method calls SetPage() to display it.
970 // Note : you can also use path relative to previously loaded page
971 // Return value : same as SetPage
972 bool LoadPage(const wxString& location);
974 // Loads HTML page from file
975 bool LoadFile(const wxString& filename);
977 // Append to current page
978 bool AppendToPage(const wxString& source);
980 // Returns full location of opened page
981 wxString GetOpenedPage();
983 // Returns anchor within opened page
984 wxString GetOpenedAnchor();
986 // Returns <TITLE> of opened page or empty string otherwise
987 wxString GetOpenedPageTitle();
989 // Sets frame in which page title will be displayed. Format is format of
990 // frame title, e.g. "HtmlHelp : %s". It must contain exactly one %s
991 void SetRelatedFrame(wxFrame* frame, const wxString& format);
992 wxFrame* GetRelatedFrame();
994 // After(!) calling SetRelatedFrame, this sets statusbar slot where messages
995 // will be displayed. Default is -1 = no messages.
996 void SetRelatedStatusBar(int bar);
998 // Sets fonts to be used when displaying HTML page.
1000 void SetFonts(wxString normal_face, wxString fixed_face, PyObject* sizes=NULL) {
1002 if (sizes) temp = int_LIST_helper(sizes);
1003 self->SetFonts(normal_face, fixed_face, temp);
1009 // Sets font sizes to be relative to the given size or the system
1010 // default size; use either specified or default font
1011 void SetStandardFonts(int size = -1,
1012 const wxString& normal_face = wxPyEmptyString,
1013 const wxString& fixed_face = wxPyEmptyString);
1016 void, SetLabel(const wxString& title),
1019 // Sets space between text and window borders.
1020 void SetBorders(int b);
1022 // Sets the bitmap to use for background (currnetly it will be tiled,
1023 // when/if we have CSS support we could add other possibilities...)
1024 void SetBackgroundImage(const wxBitmap& bmpBg);
1026 // Saves custom settings into cfg config. it will use the path 'path'
1027 // if given, otherwise it will save info into currently selected path.
1028 // saved values : things set by SetFonts, SetBorders.
1029 void ReadCustomization(wxConfigBase *cfg, wxString path = wxPyEmptyString);
1030 void WriteCustomization(wxConfigBase *cfg, wxString path = wxPyEmptyString);
1032 // Goes to previous/next page (in browsing history)
1033 // Returns True if successful, False otherwise
1035 bool HistoryForward();
1036 bool HistoryCanBack();
1037 bool HistoryCanForward();
1040 void HistoryClear();
1042 // Returns pointer to conteiners/cells structure.
1043 wxHtmlContainerCell* GetInternalRepresentation();
1045 // Returns a pointer to the parser.
1046 wxHtmlWinParser* GetParser();
1048 bool ScrollToAnchor(const wxString& anchor);
1049 bool HasAnchor(const wxString& anchor);
1052 static void AddFilter(wxPyHtmlFilter *filter);
1054 // Helper functions to select parts of page:
1055 void SelectWord(const wxPoint& pos);
1056 void SelectLine(const wxPoint& pos);
1059 // Convert selection to text:
1060 wxString SelectionToText();
1062 // Converts current page to text:
1065 void OnLinkClicked(const wxHtmlLinkInfo& link);
1066 void OnSetTitle(const wxString& title);
1067 void OnCellMouseHover(wxHtmlCell *cell, wxCoord x, wxCoord y);
1068 bool OnCellClicked(wxHtmlCell *cell,
1069 wxCoord x, wxCoord y,
1070 const wxMouseEvent& event);
1071 wxHtmlOpeningStatus OnOpeningURL(wxHtmlURLType type,
1072 const wxString& url,
1073 wxString *redirect) const;
1074 %MAKE_BASE_FUNC(HtmlWindow, OnLinkClicked);
1075 %MAKE_BASE_FUNC(HtmlWindow, OnSetTitle);
1076 %MAKE_BASE_FUNC(HtmlWindow, OnCellMouseHover);
1077 %MAKE_BASE_FUNC(HtmlWindow, OnCellClicked);
1079 static wxVisualAttributes
1080 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
1082 /// Type of mouse cursor
1085 /// Standard mouse cursor (typically an arrow)
1087 /// Cursor shown over links
1089 /// Cursor shown over selectable text
1093 // Returns standard HTML cursor as used by wxHtmlWindow
1094 static wxCursor GetDefaultHTMLCursor(HTMLCursor type);
1098 // // wxHtmlWindowInterface methods:
1099 // virtual void SetHTMLWindowTitle(const wxString& title);
1100 // virtual void OnHTMLLinkClicked(const wxHtmlLinkInfo& link);
1101 // virtual wxHtmlOpeningStatus OnHTMLOpeningURL(wxHtmlURLType type,
1102 // const wxString& url,
1103 // wxString *redirect) const;
1104 // virtual wxPoint HTMLCoordsToWindow(wxHtmlCell *cell,
1105 // const wxPoint& pos) const;
1106 // virtual wxWindow* GetHTMLWindow();
1107 // virtual wxColour GetHTMLBackgroundColour() const;
1108 // virtual void SetHTMLBackgroundColour(const wxColour& clr);
1109 // virtual void SetHTMLBackgroundImage(const wxBitmap& bmpBg);
1110 // virtual void SetHTMLStatusText(const wxString& text);
1111 // virtual wxCursor GetHTMLCursor(HTMLCursor type) const;
1118 //---------------------------------------------------------------------------
1119 //---------------------------------------------------------------------------
1123 MustHaveApp(wxHtmlDCRenderer);
1125 class wxHtmlDCRenderer : public wxObject {
1128 ~wxHtmlDCRenderer();
1130 void SetDC(wxDC *dc, int maxwidth);
1131 void SetSize(int width, int height);
1132 void SetHtmlText(const wxString& html,
1133 const wxString& basepath = wxPyEmptyString,
1135 // Sets fonts to be used when displaying HTML page. (if size null then default sizes used).
1137 void SetFonts(wxString normal_face, wxString fixed_face, PyObject* sizes=NULL) {
1139 if (sizes) temp = int_LIST_helper(sizes);
1140 self->SetFonts(normal_face, fixed_face, temp);
1146 // Sets font sizes to be relative to the given size or the system
1147 // default size; use either specified or default font
1148 void SetStandardFonts(int size = -1,
1149 const wxString& normal_face = wxPyEmptyString,
1150 const wxString& fixed_face = wxPyEmptyString);
1152 int Render(int x, int y, int from = 0, int dont_render = false, int maxHeight = INT_MAX,
1153 //int *known_pagebreaks = NULL, int number_of_pages = 0
1154 int* choices=NULL, int LCOUNT = 0
1156 int GetTotalHeight();
1157 // returns total height of the html document
1158 // (compare Render's return value with this)
1169 MustHaveApp(wxHtmlPrintout);
1171 class wxHtmlPrintout : public wxPyPrintout {
1173 wxHtmlPrintout(const wxString& title = wxPyHtmlPrintoutTitleStr);
1174 //~wxHtmlPrintout(); wxPrintPreview object takes ownership...
1176 void SetHtmlText(const wxString& html,
1177 const wxString &basepath = wxPyEmptyString,
1179 void SetHtmlFile(const wxString &htmlfile);
1180 void SetHeader(const wxString& header, int pg = wxPAGE_ALL);
1181 void SetFooter(const wxString& footer, int pg = wxPAGE_ALL);
1183 // Sets fonts to be used when displaying HTML page. (if size null then default sizes used).
1185 void SetFonts(wxString normal_face, wxString fixed_face, PyObject* sizes=NULL) {
1187 if (sizes) temp = int_LIST_helper(sizes);
1188 self->SetFonts(normal_face, fixed_face, temp);
1194 // Sets font sizes to be relative to the given size or the system
1195 // default size; use either specified or default font
1196 void SetStandardFonts(int size = -1,
1197 const wxString& normal_face = wxPyEmptyString,
1198 const wxString& fixed_face = wxPyEmptyString);
1200 void SetMargins(float top = 25.2, float bottom = 25.2,
1201 float left = 25.2, float right = 25.2,
1204 // Adds input filter
1205 static void AddFilter(wxHtmlFilter *filter);
1208 static void CleanUpStatics();
1213 MustHaveApp(wxHtmlEasyPrinting);
1215 class wxHtmlEasyPrinting : public wxObject {
1217 wxHtmlEasyPrinting(const wxString& name = wxPyHtmlPrintingTitleStr,
1218 wxWindow *parentWindow = NULL);
1219 ~wxHtmlEasyPrinting();
1221 void PreviewFile(const wxString &htmlfile);
1222 void PreviewText(const wxString &htmltext, const wxString& basepath = wxPyEmptyString);
1223 void PrintFile(const wxString &htmlfile);
1224 void PrintText(const wxString &htmltext, const wxString& basepath = wxPyEmptyString);
1225 // void PrinterSetup();
1227 void SetHeader(const wxString& header, int pg = wxPAGE_ALL);
1228 void SetFooter(const wxString& footer, int pg = wxPAGE_ALL);
1231 void SetFonts(wxString normal_face, wxString fixed_face, PyObject* sizes=NULL) {
1233 if (sizes) temp = int_LIST_helper(sizes);
1234 self->SetFonts(normal_face, fixed_face, temp);
1240 // Sets font sizes to be relative to the given size or the system
1241 // default size; use either specified or default font
1242 void SetStandardFonts(int size = -1,
1243 const wxString& normal_face = wxPyEmptyString,
1244 const wxString& fixed_face = wxPyEmptyString);
1246 wxPrintData *GetPrintData() {return m_PrintData;}
1247 wxPageSetupDialogData *GetPageSetupData() {return m_PageSetupData;}
1252 //---------------------------------------------------------------------------
1253 //---------------------------------------------------------------------------
1257 class wxHtmlBookRecord {
1259 wxHtmlBookRecord(const wxString& bookfile, const wxString& basepath,
1260 const wxString& title, const wxString& start);
1262 wxString GetBookFile();
1263 wxString GetTitle();
1264 wxString GetStart();
1265 wxString GetBasePath();
1267 void SetContentsRange(int start, int end);
1268 int GetContentsStart();
1269 int GetContentsEnd();
1271 void SetTitle(const wxString& title);
1272 void SetBasePath(const wxString& path);
1273 void SetStart(const wxString& start);
1275 wxString GetFullPath(const wxString &page) const;
1278 //---------------------------------------------------------------------------
1279 // WXWIN_COMPATIBILITY_2_4
1281 struct wxHtmlContentsItem
1284 int GetLevel() { return self->m_Level; }
1285 int GetID() { return self->m_ID; }
1286 wxString GetName() { return self->m_Name; }
1287 wxString GetPage() { return self->m_Page; }
1288 wxHtmlBookRecord* GetBook() { return self->m_Book; }
1292 //---------------------------------------------------------------------------
1294 class wxHtmlSearchStatus
1297 //wxHtmlSearchStatus(wxHtmlHelpData* base, const wxString& keyword,
1298 // const wxString& book = wxPyEmptyString);
1303 const wxString& GetName();
1306 //---------------------------------------------------------------------------
1308 class wxHtmlHelpData {
1313 void SetTempDir(const wxString& path);
1314 bool AddBook(const wxString& book);
1315 // bool AddBookParam(const wxString& title, const wxString& contfile,
1316 // const wxString& indexfile=wxPyEmptyString,
1317 // const wxString& deftopic=wxPyEmptyString,
1318 // const wxString& path=wxPyEmptyString);
1320 wxString FindPageByName(const wxString& page);
1321 wxString FindPageById(int id);
1323 // TODO: this one needs fixed...
1324 const wxHtmlBookRecArray& GetBookRecArray();
1328 //---------------------------------------------------------------------------
1341 wxHF_ICONS_BOOK_CHAPTER,
1361 wxID_HTML_BOOKMARKSLIST,
1362 wxID_HTML_BOOKMARKSADD,
1363 wxID_HTML_BOOKMARKSREMOVE,
1365 wxID_HTML_INDEXPAGE,
1366 wxID_HTML_INDEXLIST,
1367 wxID_HTML_INDEXTEXT,
1368 wxID_HTML_INDEXBUTTON,
1369 wxID_HTML_INDEXBUTTONALL,
1371 wxID_HTML_SEARCHPAGE,
1372 wxID_HTML_SEARCHTEXT,
1373 wxID_HTML_SEARCHLIST,
1374 wxID_HTML_SEARCHBUTTON,
1375 wxID_HTML_SEARCHCHOICE,
1381 MustHaveApp(wxHtmlHelpWindow);
1383 class wxHtmlHelpWindow : public wxWindow
1386 %pythonAppend wxHtmlHelpWindow "self._setOORInfo(self)"
1387 %pythonAppend wxHtmlHelpWindow() ""
1388 %typemap(out) wxHtmlHelpWindow*; // turn off this typemap
1390 wxHtmlHelpWindow(wxWindow* parent, wxWindowID wxWindowID,
1391 const wxPoint& pos = wxDefaultPosition,
1392 const wxSize& size = wxDefaultSize,
1393 int style = wxTAB_TRAVERSAL|wxNO_BORDER,
1394 int helpStyle = wxHF_DEFAULT_STYLE,
1395 wxHtmlHelpData* data = NULL);
1396 %RenameCtor(PreHtmlHelpWindow, wxHtmlHelpWindow(wxHtmlHelpData* data = NULL));
1398 // Turn it back on again
1399 %typemap(out) wxHtmlHelpWindow* { $result = wxPyMake_wxObject($1, $owner); }
1401 bool Create(wxWindow* parent, wxWindowID id,
1402 const wxPoint& pos = wxDefaultPosition,
1403 const wxSize& size = wxDefaultSize,
1404 int style = wxTAB_TRAVERSAL|wxNO_BORDER,
1405 int helpStyle = wxHF_DEFAULT_STYLE);
1407 wxHtmlHelpData* GetData();
1408 wxHtmlHelpController* GetController() const;
1410 %disownarg( wxHtmlHelpController* controller );
1411 void SetController(wxHtmlHelpController* controller);
1412 %cleardisown( wxHtmlHelpController* controller );
1414 // Displays page x. If not found it will offect the user a choice of
1416 // Looking for the page runs in these steps:
1417 // 1. try to locate file named x (if x is for example "doc/howto.htm")
1418 // 2. try to open starting page of book x
1419 // 3. try to find x in contents (if x is for example "How To ...")
1420 // 4. try to find x in index (if x is for example "How To ...")
1421 bool Display(const wxString& x);
1423 // Alternative version that works with numeric ID.
1424 // (uses extension to MS format, <param name="ID" value=id>, see docs)
1425 %Rename(DisplayID, bool, Display(int id));
1427 // Displays help window and focuses contents.
1428 bool DisplayContents();
1430 // Displays help window and focuses index.
1431 bool DisplayIndex();
1433 // Searches for keyword. Returns true and display page if found, return
1435 // Syntax of keyword is Altavista-like:
1436 // * words are separated by spaces
1437 // (but "\"hello world\"" is only one world "hello world")
1438 // * word may be pretended by + or -
1439 // (+ : page must contain the word ; - : page can't contain the word)
1440 // * if there is no + or - before the word, + is default
1441 bool KeywordSearch(const wxString& keyword,
1442 wxHelpSearchMode mode = wxHELP_SEARCH_ALL);
1444 void UseConfig(wxConfigBase *config, const wxString& rootpath = wxEmptyString);
1446 // Saves custom settings into cfg config. it will use the path 'path'
1447 // if given, otherwise it will save info into currently selected path.
1448 // saved values : things set by SetFonts, SetBorders.
1449 void ReadCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString);
1450 void WriteCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString);
1452 // call this to let wxHtmlHelpWindow know page changed
1453 void NotifyPageChanged();
1455 // Refreshes Contents and Index tabs
1456 void RefreshLists();
1458 // Gets the HTML window
1459 wxHtmlWindow* GetHtmlWindow() const;
1461 // Gets the splitter window
1462 wxSplitterWindow* GetSplitterWindow();
1465 wxToolBar* GetToolBar() const;
1467 // Gets the configuration data
1468 wxHtmlHelpFrameCfg& GetCfgData();
1470 // Gets the tree control
1471 wxTreeCtrl *GetTreeCtrl() const;
1476 class wxHtmlWindowEvent: public wxNotifyEvent
1479 wxHtmlWindowEvent(wxEventType commandType = wxEVT_NULL, int id = 0):
1480 wxNotifyEvent(commandType, id);
1482 void SetURL(const wxString& url);
1483 const wxString& GetURL() const;
1488 MustHaveApp(wxHtmlHelpFrame);
1490 class wxHtmlHelpFrame : public wxFrame {
1492 %pythonAppend wxHtmlHelpFrame "self._setOORInfo(self)"
1493 %pythonAppend wxHtmlHelpFrame() ""
1494 %typemap(out) wxHtmlHelpFrame*; // turn off this typemap
1496 wxHtmlHelpFrame(wxWindow* parent, int wxWindowID,
1497 const wxString& title = wxPyEmptyString,
1498 int style = wxHF_DEFAULTSTYLE, wxHtmlHelpData* data = NULL);
1499 %RenameCtor(PreHtmlHelpFrame, wxHtmlHelpFrame(wxHtmlHelpData* data = NULL));
1501 // Turn it back on again
1502 %typemap(out) wxHtmlHelpFrame* { $result = wxPyMake_wxObject($1, $owner); }
1504 bool Create(wxWindow* parent, wxWindowID id,
1505 const wxString& title = wxPyEmptyString,
1506 int style = wxHF_DEFAULT_STYLE);
1508 wxHtmlHelpData* GetData();
1509 void SetTitleFormat(const wxString& format);
1511 void AddGrabIfNeeded();
1513 /// Returns the help controller associated with the window.
1514 wxHtmlHelpController* GetController() const;
1516 /// Sets the help controller associated with the window.
1517 %disownarg( wxHtmlHelpController* controller );
1518 void SetController(wxHtmlHelpController* controller);
1519 %cleardisown( wxHtmlHelpController* controller );
1521 /// Returns the help window.
1522 wxHtmlHelpWindow* GetHelpWindow() const;
1525 %# For compatibility from before the refactor
1526 def Display(self, x):
1527 return self.GetHelpWindow().Display(x)
1528 def DisplayID(self, x):
1529 return self.GetHelpWindow().DisplayID(id)
1530 def DisplayContents(self):
1531 return self.GetHelpWindow().DisplayContents()
1532 def DisplayIndex(self):
1533 return self.GetHelpWindow().DisplayIndex()
1535 def KeywordSearch(self, keyword):
1536 return self.GetHelpWindow().KeywordSearch(keyword)
1538 def UseConfig(self, config, rootpath=""):
1539 return self.GetHelpWindow().UseConfig(config, rootpath)
1540 def ReadCustomization(self, config, rootpath=""):
1541 return self.GetHelpWindow().ReadCustomization(config, rootpath)
1542 def WriteCustomization(self, config, rootpath=""):
1543 return self.GetHelpWindow().WriteCustomization(config, rootpath)
1549 MustHaveApp(wxHtmlHelpDialog);
1551 class wxHtmlHelpDialog : public wxDialog
1554 %pythonAppend wxHtmlHelpDialog "self._setOORInfo(self)"
1555 %pythonAppend wxHtmlHelpDialog() ""
1556 %typemap(out) wxHtmlHelpDialog*; // turn off this typemap
1558 wxHtmlHelpDialog(wxWindow* parent, wxWindowID wxWindowID,
1559 const wxString& title = wxPyEmptyString,
1560 int style = wxHF_DEFAULT_STYLE, wxHtmlHelpData* data = NULL);
1561 %RenameCtor(PreHtmlHelpDialog, wxHtmlHelpDialog(wxHtmlHelpData* data = NULL));
1563 // Turn it back on again
1564 %typemap(out) wxHtmlHelpDialog* { $result = wxPyMake_wxObject($1, $owner); }
1566 bool Create(wxWindow* parent, wxWindowID id, const wxString& title = wxPyEmptyString,
1567 int style = wxHF_DEFAULT_STYLE);
1569 /// Returns the data associated with this dialog.
1570 wxHtmlHelpData* GetData();
1572 /// Returns the controller that created this dialog.
1573 wxHtmlHelpController* GetController() const;
1575 /// Sets the controller associated with this dialog.
1576 %disownarg( wxHtmlHelpController* controller );
1577 void SetController(wxHtmlHelpController* controller);
1578 %cleardisown( wxHtmlHelpController* controller );
1580 /// Returns the help window.
1581 wxHtmlHelpWindow* GetHelpWindow() const;
1583 // Sets format of title of the frame. Must contain exactly one "%s"
1584 // (for title of displayed HTML page)
1585 void SetTitleFormat(const wxString& format);
1587 // Override to add custom buttons to the toolbar
1588 // virtual void AddToolbarButtons(wxToolBar* WXUNUSED(toolBar), int WXUNUSED(style)) {};
1593 //---------------------------------------------------------------------------
1596 // TODO: Make virtual methods of this class overridable in Python.
1598 MustHaveApp(wxHelpControllerBase);
1600 class wxHelpControllerBase: public wxObject
1603 // wxHelpControllerBase(wxWindow* parentWindow = NULL);
1604 // ~wxHelpControllerBase();
1606 %nokwargs Initialize;
1607 virtual bool Initialize(const wxString& file, int server );
1608 virtual bool Initialize(const wxString& file);
1610 virtual void SetViewer(const wxString& viewer, long flags = 0);
1612 // If file is "", reloads file given in Initialize
1613 virtual bool LoadFile(const wxString& file = wxEmptyString) /* = 0 */;
1615 // Displays the contents
1616 virtual bool DisplayContents(void) /* = 0 */;
1618 %nokwargs DisplaySection;
1620 // Display the given section
1621 virtual bool DisplaySection(int sectionNo) /* = 0 */;
1623 // Display the section using a context id
1624 virtual bool DisplayContextPopup(int contextId);
1626 // Display the text in a popup, if possible
1627 virtual bool DisplayTextPopup(const wxString& text, const wxPoint& pos);
1629 // By default, uses KeywordSection to display a topic. Implementations
1630 // may override this for more specific behaviour.
1631 virtual bool DisplaySection(const wxString& section);
1633 virtual bool DisplayBlock(long blockNo) /* = 0 */;
1634 virtual bool KeywordSearch(const wxString& k,
1635 wxHelpSearchMode mode = wxHELP_SEARCH_ALL) /* = 0 */;
1637 /// Allows one to override the default settings for the help frame.
1638 virtual void SetFrameParameters(const wxString& title,
1640 const wxPoint& pos = wxDefaultPosition,
1641 bool newFrameEachTime = false);
1643 /// Obtains the latest settings used by the help frame and the help
1645 virtual wxFrame *GetFrameParameters(wxSize *size = NULL,
1646 wxPoint *pos = NULL,
1647 bool *newFrameEachTime = NULL);
1649 virtual bool Quit() /* = 0 */;
1651 virtual void OnQuit();
1653 /// Set the window that can optionally be used for the help window's parent.
1654 virtual void SetParentWindow(wxWindow* win);
1656 /// Get the window that can optionally be used for the help window's parent.
1657 virtual wxWindow* GetParentWindow() const;
1664 MustHaveApp(wxHtmlHelpController);
1666 class wxHtmlHelpController : public wxHelpControllerBase
1669 // %pythonAppend wxHtmlHelpController "self._setOORInfo(self)"
1671 wxHtmlHelpController(int style = wxHF_DEFAULT_STYLE, wxWindow* parentWindow = NULL);
1672 ~wxHtmlHelpController();
1674 wxHtmlHelpWindow* GetHelpWindow();
1675 void SetHelpWindow(wxHtmlHelpWindow* helpWindow);
1677 wxHtmlHelpFrame* GetFrame();
1678 wxHtmlHelpDialog* GetDialog();
1680 void SetTitleFormat(const wxString& format);
1681 void SetTempDir(const wxString& path);
1682 bool AddBook(const wxString& book, int show_wait_msg = false);
1683 void Display(const wxString& x);
1684 %Rename(DisplayID, void, Display(int id));
1685 void DisplayContents();
1686 void DisplayIndex();
1687 bool KeywordSearch(const wxString& keyword);
1688 void UseConfig(wxConfigBase *config, const wxString& rootpath = wxPyEmptyString);
1689 void ReadCustomization(wxConfigBase *cfg, wxString path = wxPyEmptyString);
1690 void WriteCustomization(wxConfigBase *cfg, wxString path = wxPyEmptyString);
1692 void MakeModalIfNeeded();
1693 wxWindow* FindTopLevelWindow();
1699 * A convenience class particularly for use on wxMac,
1700 * where you can only show modal dialogs from a modal
1705 * wxHtmlModalHelp help(parent, filename, topic);
1707 * If topic is empty, the help contents is displayed.
1710 class wxHtmlModalHelp
1713 wxHtmlModalHelp(wxWindow* parent, const wxString& helpFile,
1714 const wxString& topic = wxEmptyString,
1715 int style = wxHF_DEFAULT_STYLE | wxHF_DIALOG | wxHF_MODAL);
1719 //---------------------------------------------------------------------------
1721 wxPyPtrTypeMap_Add("wxHtmlTagHandler", "wxPyHtmlTagHandler");
1722 wxPyPtrTypeMap_Add("wxHtmlWinTagHandler", "wxPyHtmlWinTagHandler");
1723 wxPyPtrTypeMap_Add("wxHtmlWindow", "wxPyHtmlWindow");
1724 wxPyPtrTypeMap_Add("wxHtmlFilter", "wxPyHtmlFilter");
1726 //---------------------------------------------------------------------------
1727 //---------------------------------------------------------------------------