]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/html.i
Forward declare new wxPy classes
[wxWidgets.git] / wxPython / src / html.i
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: html.i
3 // Purpose: SWIG definitions of html classes
4 //
5 // Author: Robin Dunn
6 //
7 // Created: 25-Nov-1998
8 // RCS-ID: $Id$
9 // Copyright: (c) 2003 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
12
13 %define DOCSTRING
14 "Classes for a simple HTML rendering window, HTML Help Window, etc."
15 %enddef
16
17 %module(package="wx", docstring=DOCSTRING) html
18
19 %{
20 #include "wx/wxPython/wxPython.h"
21 #include "wx/wxPython/pyclasses.h"
22 #include "wx/wxPython/pyistream.h"
23 #include "wx/wxPython/printfw.h"
24
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>
31
32 %}
33
34
35 //---------------------------------------------------------------------------
36
37 %import windows.i
38 %pythoncode { wx = _core }
39 %pythoncode { __docfilter__ = wx.__DocFilter(globals()) }
40
41 MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
42 MAKE_CONST_WXSTRING2(HtmlWindowNameStr, wxT("htmlWindow"))
43 MAKE_CONST_WXSTRING2(HtmlPrintoutTitleStr, wxT("Printout"))
44 MAKE_CONST_WXSTRING2(HtmlPrintingTitleStr, wxT("Printing"))
45
46
47 // TODO: Split this file into multiple %included files that coresponds to the
48 // wx/html include files (more or less.)
49
50 //---------------------------------------------------------------------------
51 %newgroup
52
53
54 enum {
55 wxHTML_ALIGN_LEFT,
56 wxHTML_ALIGN_CENTER,
57 wxHTML_ALIGN_RIGHT,
58 wxHTML_ALIGN_BOTTOM,
59 wxHTML_ALIGN_TOP,
60
61 wxHTML_CLR_FOREGROUND,
62 wxHTML_CLR_BACKGROUND,
63
64 wxHTML_UNITS_PIXELS,
65 wxHTML_UNITS_PERCENT,
66
67 wxHTML_INDENT_LEFT,
68 wxHTML_INDENT_RIGHT,
69 wxHTML_INDENT_TOP,
70 wxHTML_INDENT_BOTTOM,
71
72 wxHTML_INDENT_HORIZONTAL,
73 wxHTML_INDENT_VERTICAL,
74 wxHTML_INDENT_ALL,
75
76 wxHTML_COND_ISANCHOR,
77 wxHTML_COND_ISIMAGEMAP,
78 wxHTML_COND_USER,
79
80 };
81
82
83 enum {
84 wxHW_SCROLLBAR_NEVER,
85 wxHW_SCROLLBAR_AUTO,
86 wxHW_NO_SELECTION,
87 wxHW_DEFAULT_STYLE,
88 };
89
90
91 // enums for wxHtmlWindow::OnOpeningURL
92 enum wxHtmlOpeningStatus
93 {
94 wxHTML_OPEN,
95 wxHTML_BLOCK,
96 wxHTML_REDIRECT
97 };
98
99 enum wxHtmlURLType
100 {
101 wxHTML_URL_PAGE,
102 wxHTML_URL_IMAGE,
103 wxHTML_URL_OTHER
104 };
105
106
107
108 //---------------------------------------------------------------------------
109
110 class wxHtmlLinkInfo : public wxObject {
111 public:
112 wxHtmlLinkInfo(const wxString& href, const wxString& target = wxPyEmptyString);
113 wxString GetHref();
114 wxString GetTarget();
115 wxMouseEvent* GetEvent();
116 wxHtmlCell* GetHtmlCell();
117
118 void SetEvent(const wxMouseEvent *e);
119 void SetHtmlCell(const wxHtmlCell * e);
120
121 %property(Event, GetEvent, SetEvent, doc="See `GetEvent` and `SetEvent`");
122 %property(Href, GetHref, doc="See `GetHref`");
123 %property(HtmlCell, GetHtmlCell, SetHtmlCell, doc="See `GetHtmlCell` and `SetHtmlCell`");
124 %property(Target, GetTarget, doc="See `GetTarget`");
125 };
126
127 //---------------------------------------------------------------------------
128
129 class wxHtmlTag : public wxObject {
130 public:
131 // Never need to create a new tag from Python...
132 //wxHtmlTag(const wxString& source, int pos, int end_pos, wxHtmlTagsCache* cache);
133
134 wxString GetName();
135 bool HasParam(const wxString& par);
136 wxString GetParam(const wxString& par, int with_commas = false);
137
138 // Can't do this one as-is, but GetParam should be enough...
139 //int ScanParam(const wxString& par, const char *format, void* param);
140
141 wxString GetAllParams();
142 bool HasEnding();
143 int GetBeginPos();
144 int GetEndPos1();
145 int GetEndPos2();
146
147 %property(AllParams, GetAllParams, doc="See `GetAllParams`");
148 %property(BeginPos, GetBeginPos, doc="See `GetBeginPos`");
149 %property(EndPos1, GetEndPos1, doc="See `GetEndPos1`");
150 %property(EndPos2, GetEndPos2, doc="See `GetEndPos2`");
151 %property(Name, GetName, doc="See `GetName`");
152 };
153
154 //---------------------------------------------------------------------------
155
156 class wxHtmlParser : public wxObject {
157 public:
158 // wxHtmlParser(); This is an abstract base class...
159
160 void SetFS(wxFileSystem *fs);
161 wxFileSystem* GetFS();
162 wxObject* Parse(const wxString& source);
163 void InitParser(const wxString& source);
164 void DoneParser();
165 void DoParsing(int begin_pos, int end_pos);
166 void StopParsing();
167 // wxObject* GetProduct();
168
169 void AddTagHandler(wxHtmlTagHandler *handler);
170 wxString* GetSource();
171 void PushTagHandler(wxHtmlTagHandler* handler, wxString tags);
172 void PopTagHandler();
173
174 // virtual wxFSFile *OpenURL(wxHtmlURLType type, const wxString& url) const;
175
176 // void AddText(const char* txt) = 0;
177 // void AddTag(const wxHtmlTag& tag);
178
179
180 // Returns HTML source inside the element (i.e. between the starting
181 // and ending tag)
182 wxString GetInnerSource(const wxHtmlTag& tag);
183
184 %property(FS, GetFS, SetFS, doc="See `GetFS` and `SetFS`");
185 %property(Source, GetSource, doc="See `GetSource`");
186 };
187
188
189 //---------------------------------------------------------------------------
190
191 class wxHtmlWinParser : public wxHtmlParser {
192 public:
193 wxHtmlWinParser(wxPyHtmlWindow *wnd = NULL);
194
195 void SetDC(wxDC *dc);
196 wxDC* GetDC();
197 int GetCharHeight();
198 int GetCharWidth();
199
200 wxHtmlWindowInterface *GetWindowInterface();
201
202 // Sets fonts to be used when displaying HTML page. (if size null then default sizes used).
203 %extend {
204 void SetFonts(wxString normal_face, wxString fixed_face, PyObject* sizes=NULL) {
205 int* temp = NULL;
206 if (sizes) temp = int_LIST_helper(sizes);
207 self->SetFonts(normal_face, fixed_face, temp);
208 if (temp)
209 delete [] temp;
210 }
211 }
212
213 // Sets font sizes to be relative to the given size or the system
214 // default size; use either specified or default font
215 void SetStandardFonts(int size = -1,
216 const wxString& normal_face = wxPyEmptyString,
217 const wxString& fixed_face = wxPyEmptyString);
218
219
220 wxHtmlContainerCell* GetContainer();
221 wxHtmlContainerCell* OpenContainer();
222 wxHtmlContainerCell *SetContainer(wxHtmlContainerCell *c);
223 wxHtmlContainerCell* CloseContainer();
224
225 int GetFontSize();
226 void SetFontSize(int s);
227 int GetFontBold();
228 void SetFontBold(int x);
229 int GetFontItalic();
230 void SetFontItalic(int x);
231 int GetFontUnderlined();
232 void SetFontUnderlined(int x);
233 int GetFontFixed();
234 void SetFontFixed(int x);
235 int GetAlign();
236 void SetAlign(int a);
237 wxColour GetLinkColor();
238 void SetLinkColor(const wxColour& clr);
239 wxColour GetActualColor();
240 void SetActualColor(const wxColour& clr);
241 %pythoncode {
242 GetActualColour = GetActualColor
243 SetActualColour = SetActualColor
244 }
245 void SetLink(const wxString& link);
246 wxFont* CreateCurrentFont();
247 wxHtmlLinkInfo GetLink();
248
249 %property(ActualColor, GetActualColor, SetActualColor, doc="See `GetActualColor` and `SetActualColor`");
250 %property(ActualColour, GetActualColour, SetActualColour, doc="See `GetActualColour` and `SetActualColour`");
251 %property(Align, GetAlign, SetAlign, doc="See `GetAlign` and `SetAlign`");
252 %property(CharHeight, GetCharHeight, doc="See `GetCharHeight`");
253 %property(CharWidth, GetCharWidth, doc="See `GetCharWidth`");
254 %property(Container, GetContainer, SetContainer, doc="See `GetContainer` and `SetContainer`");
255 %property(DC, GetDC, SetDC, doc="See `GetDC` and `SetDC`");
256 %property(FontBold, GetFontBold, SetFontBold, doc="See `GetFontBold` and `SetFontBold`");
257 %property(FontFixed, GetFontFixed, SetFontFixed, doc="See `GetFontFixed` and `SetFontFixed`");
258 %property(FontItalic, GetFontItalic, SetFontItalic, doc="See `GetFontItalic` and `SetFontItalic`");
259 %property(FontSize, GetFontSize, SetFontSize, doc="See `GetFontSize` and `SetFontSize`");
260 %property(FontUnderlined, GetFontUnderlined, SetFontUnderlined, doc="See `GetFontUnderlined` and `SetFontUnderlined`");
261 %property(Link, GetLink, SetLink, doc="See `GetLink` and `SetLink`");
262 %property(LinkColor, GetLinkColor, SetLinkColor, doc="See `GetLinkColor` and `SetLinkColor`");
263 %property(WindowInterface, GetWindowInterface, doc="See `GetWindowInterface`");
264 };
265
266
267 //---------------------------------------------------------------------------
268
269 %{
270 class wxPyHtmlTagHandler : public wxHtmlTagHandler {
271 DECLARE_DYNAMIC_CLASS(wxPyHtmlTagHandler)
272 public:
273 wxPyHtmlTagHandler() : wxHtmlTagHandler() {};
274
275 wxHtmlParser* GetParser() { return m_Parser; }
276 void ParseInner(const wxHtmlTag& tag) { wxHtmlTagHandler::ParseInner(tag); }
277
278 DEC_PYCALLBACK_STRING__pure(GetSupportedTags);
279 DEC_PYCALLBACK_BOOL_TAG_pure(HandleTag);
280
281 PYPRIVATE;
282 };
283
284 IMPLEMENT_DYNAMIC_CLASS(wxPyHtmlTagHandler, wxHtmlTagHandler);
285
286 IMP_PYCALLBACK_STRING__pure(wxPyHtmlTagHandler, wxHtmlTagHandler, GetSupportedTags);
287 IMP_PYCALLBACK_BOOL_TAG_pure(wxPyHtmlTagHandler, wxHtmlTagHandler, HandleTag);
288 %}
289
290
291 %rename(HtmlTagHandler) wxPyHtmlTagHandler;
292 class wxPyHtmlTagHandler : public wxObject {
293 public:
294 %pythonAppend wxPyHtmlTagHandler setCallbackInfo(HtmlTagHandler)
295 wxPyHtmlTagHandler();
296
297 void _setCallbackInfo(PyObject* self, PyObject* _class);
298
299 void SetParser(wxHtmlParser *parser);
300 wxHtmlParser* GetParser();
301 void ParseInner(const wxHtmlTag& tag);
302
303 %property(Parser, GetParser, SetParser, doc="See `GetParser` and `SetParser`");
304 };
305
306
307 //---------------------------------------------------------------------------
308
309 %{
310 class wxPyHtmlWinTagHandler : public wxHtmlWinTagHandler {
311 DECLARE_DYNAMIC_CLASS(wxPyHtmlWinTagHandler)
312 public:
313 wxPyHtmlWinTagHandler() : wxHtmlWinTagHandler() {};
314
315 wxHtmlWinParser* GetParser() { return m_WParser; }
316 void ParseInner(const wxHtmlTag& tag)
317 { wxHtmlWinTagHandler::ParseInner(tag); }
318
319 DEC_PYCALLBACK_STRING__pure(GetSupportedTags);
320 DEC_PYCALLBACK_BOOL_TAG_pure(HandleTag);
321
322 PYPRIVATE;
323 };
324
325 IMPLEMENT_DYNAMIC_CLASS( wxPyHtmlWinTagHandler, wxHtmlWinTagHandler);
326
327 IMP_PYCALLBACK_STRING__pure(wxPyHtmlWinTagHandler, wxHtmlWinTagHandler, GetSupportedTags);
328 IMP_PYCALLBACK_BOOL_TAG_pure(wxPyHtmlWinTagHandler, wxHtmlWinTagHandler, HandleTag);
329 %}
330
331
332 %rename(HtmlWinTagHandler) wxPyHtmlWinTagHandler;
333 class wxPyHtmlWinTagHandler : public wxPyHtmlTagHandler {
334 public:
335 %pythonAppend wxPyHtmlWinTagHandler setCallbackInfo(HtmlWinTagHandler)
336 wxPyHtmlWinTagHandler();
337
338 void _setCallbackInfo(PyObject* self, PyObject* _class);
339
340 void SetParser(wxHtmlParser *parser);
341 wxHtmlWinParser* GetParser();
342 void ParseInner(const wxHtmlTag& tag);
343
344 %property(Parser, GetParser, SetParser, doc="See `GetParser` and `SetParser`");
345 };
346
347
348 //---------------------------------------------------------------------------
349
350 %{
351
352 class wxPyHtmlTagsModule : public wxHtmlTagsModule {
353 public:
354 wxPyHtmlTagsModule(PyObject* thc) : wxHtmlTagsModule() {
355 m_tagHandlerClass = thc;
356 Py_INCREF(m_tagHandlerClass);
357 RegisterModule(this);
358 wxHtmlWinParser::AddModule(this);
359 }
360
361 void OnExit() {
362 wxPyBlock_t blocked = wxPyBeginBlockThreads();
363 Py_DECREF(m_tagHandlerClass);
364 m_tagHandlerClass = NULL;
365 for (size_t x=0; x < m_objArray.GetCount(); x++) {
366 PyObject* obj = (PyObject*)m_objArray.Item(x);
367 Py_DECREF(obj);
368 }
369 wxPyEndBlockThreads(blocked);
370 };
371
372 void FillHandlersTable(wxHtmlWinParser *parser) {
373 // Wave our magic wand... (if it works it's a miracle! ;-)
374
375 // First, make a new instance of the tag handler
376 wxPyBlock_t blocked = wxPyBeginBlockThreads();
377 PyObject* arg = PyTuple_New(0);
378 PyObject* obj = PyObject_CallObject(m_tagHandlerClass, arg);
379 Py_DECREF(arg);
380
381 // now figure out where it's C++ object is...
382 wxPyHtmlWinTagHandler* thPtr;
383 if (! wxPyConvertSwigPtr(obj, (void **)&thPtr, wxT("wxPyHtmlWinTagHandler"))) {
384 wxPyEndBlockThreads(blocked);
385 return;
386 }
387 wxPyEndBlockThreads(blocked);
388
389 // add it,
390 parser->AddTagHandler(thPtr);
391
392 // and track it.
393 m_objArray.Add(obj);
394 }
395
396 private:
397 PyObject* m_tagHandlerClass;
398 wxArrayPtrVoid m_objArray;
399
400 };
401 %}
402
403
404
405 %inline %{
406 void wxHtmlWinParser_AddTagHandler(PyObject* tagHandlerClass) {
407 // Dynamically create a new wxModule. Refcounts tagHandlerClass
408 // and adds itself to the wxModules list and to the wxHtmlWinParser.
409 new wxPyHtmlTagsModule(tagHandlerClass);
410 }
411 %}
412
413
414 //---------------------------------------------------------------------------
415
416 %typemap(out) wxHtmlCell* { $result = wxPyMake_wxObject($1, $owner); }
417 %typemap(out) const wxHtmlCell* { $result = wxPyMake_wxObject($1, $owner); }
418
419 //---------------------------------------------------------------------------
420 %newgroup
421
422
423 // wxHtmlSelection is data holder with information about text selection.
424 // Selection is defined by two positions (beginning and end of the selection)
425 // and two leaf(!) cells at these positions.
426 class wxHtmlSelection
427 {
428 public:
429 wxHtmlSelection();
430 ~wxHtmlSelection();
431
432 void Set(const wxPoint& fromPos, const wxHtmlCell *fromCell,
433 const wxPoint& toPos, const wxHtmlCell *toCell);
434 %Rename(SetCells, void, Set(const wxHtmlCell *fromCell, const wxHtmlCell *toCell));
435
436 const wxHtmlCell *GetFromCell() const;
437 const wxHtmlCell *GetToCell() const;
438
439 // these values are in absolute coordinates:
440 const wxPoint& GetFromPos() const;
441 const wxPoint& GetToPos() const;
442
443 // these are From/ToCell's private data
444 const wxPoint& GetFromPrivPos() const;
445 const wxPoint& GetToPrivPos() const;
446 void SetFromPrivPos(const wxPoint& pos);
447 void SetToPrivPos(const wxPoint& pos);
448 void ClearPrivPos();
449
450 const bool IsEmpty() const;
451
452 %property(FromCell, GetFromCell, doc="See `GetFromCell`");
453 %property(FromPos, GetFromPos, doc="See `GetFromPos`");
454 %property(FromPrivPos, GetFromPrivPos, SetFromPrivPos, doc="See `GetFromPrivPos` and `SetFromPrivPos`");
455 %property(ToCell, GetToCell, doc="See `GetToCell`");
456 %property(ToPos, GetToPos, doc="See `GetToPos`");
457 %property(ToPrivPos, GetToPrivPos, SetToPrivPos, doc="See `GetToPrivPos` and `SetToPrivPos`");
458 };
459
460
461 enum wxHtmlSelectionState
462 {
463 wxHTML_SEL_OUT, // currently rendered cell is outside the selection
464 wxHTML_SEL_IN, // ... is inside selection
465 wxHTML_SEL_CHANGING // ... is the cell on which selection state changes
466 };
467
468
469
470 // Selection state is passed to wxHtmlCell::Draw so that it can render itself
471 // differently e.g. when inside text selection or outside it.
472 class wxHtmlRenderingState
473 {
474 public:
475 wxHtmlRenderingState();
476 ~wxHtmlRenderingState();
477
478 void SetSelectionState(wxHtmlSelectionState s);
479 wxHtmlSelectionState GetSelectionState() const;
480
481 void SetFgColour(const wxColour& c);
482 const wxColour& GetFgColour() const;
483 void SetBgColour(const wxColour& c);
484 const wxColour& GetBgColour() const;
485
486 %property(BgColour, GetBgColour, SetBgColour, doc="See `GetBgColour` and `SetBgColour`");
487 %property(FgColour, GetFgColour, SetFgColour, doc="See `GetFgColour` and `SetFgColour`");
488 %property(SelectionState, GetSelectionState, SetSelectionState, doc="See `GetSelectionState` and `SetSelectionState`");
489 };
490
491
492
493 // HTML rendering customization. This class is used when rendering wxHtmlCells
494 // as a callback:
495 class wxHtmlRenderingStyle
496 {
497 public:
498 virtual wxColour GetSelectedTextColour(const wxColour& clr) = 0;
499 virtual wxColour GetSelectedTextBgColour(const wxColour& clr) = 0;
500
501 %property(SelectedTextBgColour, GetSelectedTextBgColour, doc="See `GetSelectedTextBgColour`");
502 %property(SelectedTextColour, GetSelectedTextColour, doc="See `GetSelectedTextColour`");
503 };
504
505 // Standard style:
506 class wxDefaultHtmlRenderingStyle : public wxHtmlRenderingStyle
507 {
508 public:
509 };
510
511
512
513 // Information given to cells when drawing them. Contains rendering state,
514 // selection information and rendering style object that can be used to
515 // customize the output.
516 class wxHtmlRenderingInfo
517 {
518 public:
519 wxHtmlRenderingInfo();
520 ~wxHtmlRenderingInfo();
521
522 void SetSelection(wxHtmlSelection *s);
523 wxHtmlSelection *GetSelection() const;
524
525 void SetStyle(wxHtmlRenderingStyle *style);
526 wxHtmlRenderingStyle& GetStyle();
527
528 wxHtmlRenderingState& GetState();
529
530 %property(Selection, GetSelection, SetSelection, doc="See `GetSelection` and `SetSelection`");
531 %property(State, GetState, doc="See `GetState`");
532 %property(Style, GetStyle, SetStyle, doc="See `GetStyle` and `SetStyle`");
533 };
534
535 //---------------------------------------------------------------------------
536 %newgroup
537
538
539 enum
540 {
541 wxHTML_FIND_EXACT = 1,
542 wxHTML_FIND_NEAREST_BEFORE = 2,
543 wxHTML_FIND_NEAREST_AFTER = 4
544 };
545
546
547 class wxHtmlCell : public wxObject {
548 public:
549 %typemap(out) wxHtmlCell*; // turn off this typemap
550
551 wxHtmlCell();
552 ~wxHtmlCell();
553
554 // Turn it back on again
555 %typemap(out) wxHtmlCell* { $result = wxPyMake_wxObject($1, $owner); }
556
557 int GetPosX();
558 int GetPosY();
559 int GetWidth();
560 int GetHeight();
561 int GetDescent();
562
563 // Returns the maximum possible length of the cell.
564 // Call Layout at least once before using GetMaxTotalWidth()
565 int GetMaxTotalWidth() const;
566
567 const wxString& GetId() const;
568 void SetId(const wxString& id);
569 wxHtmlLinkInfo* GetLink(int x = 0, int y = 0);
570 wxHtmlCell* GetNext();
571 wxHtmlContainerCell* GetParent();
572 wxHtmlCell* GetFirstChild() const;
573
574 // Returns cursor to be used when mouse is over the cell:
575 virtual wxCursor GetMouseCursor(wxHtmlWindowInterface *window) const;
576
577 // Formatting cells are not visible on the screen, they only alter
578 // renderer's state.
579 bool IsFormattingCell() const;
580
581
582 void SetLink(const wxHtmlLinkInfo& link);
583
584 %disownarg(wxHtmlCell*);
585 void SetNext(wxHtmlCell *cell);
586 %cleardisown(wxHtmlCell*);
587
588 void SetParent(wxHtmlContainerCell *p);
589 void SetPos(int x, int y);
590 void Layout(int w);
591 void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2,
592 wxHtmlRenderingInfo& info);
593 void DrawInvisible(wxDC& dc, int x, int y,
594 wxHtmlRenderingInfo& info);
595 const wxHtmlCell* Find(int condition, const void* param);
596
597
598 virtual bool ProcessMouseClick(wxHtmlWindowInterface *window,
599 const wxPoint& pos,
600 const wxMouseEvent& event);
601
602 // TODO: bool AdjustPagebreak(int* INOUT,
603 // wxArrayInt& known_pagebreaks);
604 void SetCanLiveOnPagebreak(bool can);
605
606 // Can the line be broken before this cell?
607 bool IsLinebreakAllowed() const;
608
609 // Returns True for simple == terminal cells, i.e. not composite ones.
610 // This if for internal usage only and may disappear in future versions!
611 bool IsTerminalCell() const;
612
613 // Find a cell inside this cell positioned at the given coordinates
614 // (relative to this's positions). Returns NULL if no such cell exists.
615 // The flag can be used to specify whether to look for terminal or
616 // nonterminal cells or both. In either case, returned cell is deepest
617 // cell in cells tree that contains [x,y].
618 wxHtmlCell *FindCellByPos(wxCoord x, wxCoord y,
619 unsigned flags = wxHTML_FIND_EXACT) const;
620
621 // Returns absolute position of the cell on HTML canvas
622 // If rootCell is provided, then it's considered to be the root of the
623 // hierarchy and the returned value is relative to it.
624 wxPoint GetAbsPos(wxHtmlCell *rootCell = NULL) const;
625
626 // Returns root cell of the hierarchy (i.e. grand-grand-...-parent that
627 // doesn't have a parent itself)
628 wxHtmlCell *GetRootCell() const;
629
630 // Returns first (last) terminal cell inside this cell. It may return NULL,
631 // but it is rare -- only if there are no terminals in the tree.
632 wxHtmlCell *GetFirstTerminal() const ;
633 wxHtmlCell *GetLastTerminal() const ;
634
635 // Returns cell's depth, i.e. how far under the root cell it is
636 // (if it is the root, depth is 0)
637 unsigned GetDepth() const;
638
639 // Returns True if the cell appears before 'cell' in natural order of
640 // cells (= as they are read). If cell A is (grand)parent of cell B,
641 // then both A.IsBefore(B) and B.IsBefore(A) always return True.
642 bool IsBefore(wxHtmlCell *cell) const;
643
644 // Converts the cell into text representation. If sel != NULL then
645 // only part of the cell inside the selection is converted.
646 wxString ConvertToText(wxHtmlSelection *sel) const;
647
648 %property(Depth, GetDepth, doc="See `GetDepth`");
649 %property(Descent, GetDescent, doc="See `GetDescent`");
650 %property(FirstChild, GetFirstChild, doc="See `GetFirstChild`");
651 %property(FirstTerminal, GetFirstTerminal, doc="See `GetFirstTerminal`");
652 %property(Height, GetHeight, doc="See `GetHeight`");
653 %property(Id, GetId, SetId, doc="See `GetId` and `SetId`");
654 %property(LastTerminal, GetLastTerminal, doc="See `GetLastTerminal`");
655 %property(Link, GetLink, SetLink, doc="See `GetLink` and `SetLink`");
656 %property(MaxTotalWidth, GetMaxTotalWidth, doc="See `GetMaxTotalWidth`");
657 %property(MouseCursor, GetMouseCursor, doc="See `GetMouseCursor`");
658 %property(Next, GetNext, SetNext, doc="See `GetNext` and `SetNext`");
659 %property(Parent, GetParent, SetParent, doc="See `GetParent` and `SetParent`");
660 %property(PosX, GetPosX, doc="See `GetPosX`");
661 %property(PosY, GetPosY, doc="See `GetPosY`");
662 %property(RootCell, GetRootCell, doc="See `GetRootCell`");
663 %property(Width, GetWidth, doc="See `GetWidth`");
664 };
665
666
667 class wxHtmlWordCell : public wxHtmlCell
668 {
669 public:
670 wxHtmlWordCell(const wxString& word, wxDC& dc);
671 wxString ConvertToText(wxHtmlSelection *sel) const;
672 bool IsLinebreakAllowed() const;
673 void SetPreviousWord(wxHtmlWordCell *cell);
674 };
675
676
677 class wxHtmlContainerCell : public wxHtmlCell {
678 public:
679 wxHtmlContainerCell(wxHtmlContainerCell *parent);
680
681 %disownarg(wxHtmlCell*);
682 void InsertCell(wxHtmlCell *cell);
683 %cleardisown(wxHtmlCell*);
684
685 void SetAlignHor(int al);
686 int GetAlignHor();
687 void SetAlignVer(int al);
688 int GetAlignVer();
689 void SetIndent(int i, int what, int units = wxHTML_UNITS_PIXELS);
690 int GetIndent(int ind);
691 int GetIndentUnits(int ind);
692 void SetAlign(const wxHtmlTag& tag);
693 void SetWidthFloat(int w, int units);
694 %Rename(SetWidthFloatFromTag, void, SetWidthFloat(const wxHtmlTag& tag));
695 void SetMinHeight(int h, int align = wxHTML_ALIGN_TOP);
696 void SetBackgroundColour(const wxColour& clr);
697 wxColour GetBackgroundColour();
698 void SetBorder(const wxColour& clr1, const wxColour& clr2);
699 wxHtmlCell* GetFirstChild();
700 %pragma(python) addtoclass = "GetFirstCell = GetFirstChild"
701
702 %property(AlignHor, GetAlignHor, SetAlignHor, doc="See `GetAlignHor` and `SetAlignHor`");
703 %property(AlignVer, GetAlignVer, SetAlignVer, doc="See `GetAlignVer` and `SetAlignVer`");
704 %property(BackgroundColour, GetBackgroundColour, SetBackgroundColour, doc="See `GetBackgroundColour` and `SetBackgroundColour`");
705 %property(FirstChild, GetFirstChild, doc="See `GetFirstChild`");
706 %property(Indent, GetIndent, SetIndent, doc="See `GetIndent` and `SetIndent`");
707 %property(IndentUnits, GetIndentUnits, doc="See `GetIndentUnits`");
708 };
709
710
711
712 class wxHtmlColourCell : public wxHtmlCell {
713 public:
714 wxHtmlColourCell(const wxColour& clr, int flags = wxHTML_CLR_FOREGROUND);
715
716 };
717
718
719 class wxHtmlFontCell : public wxHtmlCell
720 {
721 public:
722 wxHtmlFontCell(wxFont *font);
723 };
724
725
726 class wxHtmlWidgetCell : public wxHtmlCell {
727 public:
728 wxHtmlWidgetCell(wxWindow* wnd, int w = 0);
729
730 };
731
732
733
734
735 //---------------------------------------------------------------------------
736 // wxHtmlFilter
737 //---------------------------------------------------------------------------
738 %newgroup
739
740
741 %{ // here's the C++ version
742 class wxPyHtmlFilter : public wxHtmlFilter {
743 DECLARE_ABSTRACT_CLASS(wxPyHtmlFilter)
744 public:
745 wxPyHtmlFilter() : wxHtmlFilter() {}
746
747 // returns True if this filter is able to open&read given file
748 virtual bool CanRead(const wxFSFile& file) const {
749 bool rval = false;
750 bool found;
751 wxPyBlock_t blocked = wxPyBeginBlockThreads();
752 if ((found = wxPyCBH_findCallback(m_myInst, "CanRead"))) {
753 PyObject* obj = wxPyMake_wxObject((wxFSFile*)&file,false); // cast away const
754 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj));
755 Py_DECREF(obj);
756 }
757 wxPyEndBlockThreads(blocked);
758 return rval;
759 }
760
761
762 // Reads given file and returns HTML document.
763 // Returns empty string if opening failed
764 virtual wxString ReadFile(const wxFSFile& file) const {
765 wxString rval;
766 bool found;
767 wxPyBlock_t blocked = wxPyBeginBlockThreads();
768 if ((found = wxPyCBH_findCallback(m_myInst, "ReadFile"))) {
769 PyObject* obj = wxPyMake_wxObject((wxFSFile*)&file,false); // cast away const
770 PyObject* ro;
771 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", obj));
772 Py_DECREF(obj);
773 if (ro) {
774 rval = Py2wxString(ro);
775 Py_DECREF(ro);
776 }
777 }
778 wxPyEndBlockThreads(blocked);
779 return rval;
780 }
781
782 PYPRIVATE;
783 };
784
785 IMPLEMENT_ABSTRACT_CLASS(wxPyHtmlFilter, wxHtmlFilter);
786 %}
787
788
789 // And now the version seen by SWIG
790
791 %rename(HtmlFilter) wxPyHtmlFilter;
792 class wxPyHtmlFilter : public wxObject {
793 public:
794 %pythonAppend wxPyHtmlFilter setCallbackInfo(HtmlFilter)
795 wxPyHtmlFilter();
796
797 void _setCallbackInfo(PyObject* self, PyObject* _class);
798 };
799
800
801 // TODO: wxHtmlFilterHTML
802
803
804 //---------------------------------------------------------------------------
805
806
807 class wxHtmlWindowInterface
808 {
809 public:
810 /// Ctor
811 wxHtmlWindowInterface();
812 virtual ~wxHtmlWindowInterface();
813
814 /**
815 Called by the parser to set window's title to given text.
816 */
817 virtual void SetHTMLWindowTitle(const wxString& title) = 0;
818
819 // /**
820 // Called when a link is clicked.
821
822 // @param link information about the clicked link
823 // */
824 // virtual void OnHTMLLinkClicked(const wxHtmlLinkInfo& link) = 0;
825
826 // /**
827 // Called when the parser needs to open another URL (e.g. an image).
828
829 // @param type Type of the URL request (e.g. image)
830 // @param url URL the parser wants to open
831 // @param redirect If the return value is wxHTML_REDIRECT, then the
832 // URL to redirect to will be stored in this variable
833 // (the pointer must never be NULL)
834
835 // @return indicator of how to treat the request
836 // */
837 // virtual wxHtmlOpeningStatus OnHTMLOpeningURL(wxHtmlURLType type,
838 // const wxString& url,
839 // wxString *redirect) const = 0;
840
841 /**
842 Converts coordinates @a pos relative to given @a cell to
843 physical coordinates in the window.
844 */
845 virtual wxPoint HTMLCoordsToWindow(wxHtmlCell *cell,
846 const wxPoint& pos) const = 0;
847
848 /// Returns the window used for rendering (may be NULL).
849 virtual wxWindow* GetHTMLWindow() = 0;
850
851 /// Returns background colour to use by default.
852 virtual wxColour GetHTMLBackgroundColour() const = 0;
853
854 /// Sets window's background to colour @a clr.
855 virtual void SetHTMLBackgroundColour(const wxColour& clr) = 0;
856
857 /// Sets window's background to given bitmap.
858 virtual void SetHTMLBackgroundImage(const wxBitmap& bmpBg) = 0;
859
860 /// Sets status bar text.
861 virtual void SetHTMLStatusText(const wxString& text) = 0;
862
863 /// Type of mouse cursor
864 enum HTMLCursor
865 {
866 /// Standard mouse cursor (typically an arrow)
867 HTMLCursor_Default,
868 /// Cursor shown over links
869 HTMLCursor_Link,
870 /// Cursor shown over selectable text
871 HTMLCursor_Text
872 };
873
874 /**
875 Returns mouse cursor of given @a type.
876 */
877 // virtual wxCursor GetHTMLCursor(HTMLCursor type) const = 0;
878
879 %property(HTMLBackgroundColour, GetHTMLBackgroundColour, SetHTMLBackgroundColour, doc="See `GetHTMLBackgroundColour` and `SetHTMLBackgroundColour`");
880 %property(HTMLWindow, GetHTMLWindow, doc="See `GetHTMLWindow`");
881 };
882
883
884 //---------------------------------------------------------------------------
885 // wxHtmlWindow
886 //---------------------------------------------------------------------------
887 %newgroup
888
889 // TODO?
890 // wxHtmlWindowInterface and wxHtmlWindowMouseHelper
891
892
893 %{
894 class wxPyHtmlWindow : public wxHtmlWindow {
895 DECLARE_ABSTRACT_CLASS(wxPyHtmlWindow)
896 public:
897 wxPyHtmlWindow(wxWindow *parent, wxWindowID id = -1,
898 const wxPoint& pos = wxDefaultPosition,
899 const wxSize& size = wxDefaultSize,
900 long style = wxHW_DEFAULT_STYLE,
901 const wxString& name = wxPyHtmlWindowNameStr)
902 : wxHtmlWindow(parent, id, pos, size, style, name) {};
903 wxPyHtmlWindow() : wxHtmlWindow() {};
904
905 bool ScrollToAnchor(const wxString& anchor) {
906 return wxHtmlWindow::ScrollToAnchor(anchor);
907 }
908
909 bool HasAnchor(const wxString& anchor) {
910 const wxHtmlCell *c = m_Cell->Find(wxHTML_COND_ISANCHOR, &anchor);
911 return c!=NULL;
912 }
913
914 void OnLinkClicked(const wxHtmlLinkInfo& link);
915
916 wxHtmlOpeningStatus OnOpeningURL(wxHtmlURLType type,
917 const wxString& url,
918 wxString *redirect) const;
919
920 DEC_PYCALLBACK__STRING(OnSetTitle);
921 DEC_PYCALLBACK__CELLINTINT(OnCellMouseHover);
922 DEC_PYCALLBACK_BOOL_CELLINTINTME(OnCellClicked);
923
924 PYPRIVATE;
925 };
926
927 IMPLEMENT_ABSTRACT_CLASS( wxPyHtmlWindow, wxHtmlWindow );
928 IMP_PYCALLBACK__STRING(wxPyHtmlWindow, wxHtmlWindow, OnSetTitle);
929 IMP_PYCALLBACK__CELLINTINT(wxPyHtmlWindow, wxHtmlWindow, OnCellMouseHover);
930 IMP_PYCALLBACK_BOOL_CELLINTINTME(wxPyHtmlWindow, wxHtmlWindow, OnCellClicked);
931
932
933 void wxPyHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link) {
934 bool found;
935 wxPyBlock_t blocked = wxPyBeginBlockThreads();
936 if ((found = wxPyCBH_findCallback(m_myInst, "OnLinkClicked"))) {
937 PyObject* obj = wxPyConstructObject((void*)&link, wxT("wxHtmlLinkInfo"), 0);
938 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj));
939 Py_DECREF(obj);
940 }
941 wxPyEndBlockThreads(blocked);
942 if (! found)
943 wxHtmlWindow::OnLinkClicked(link);
944 }
945
946
947 wxHtmlOpeningStatus wxPyHtmlWindow::OnOpeningURL(wxHtmlURLType type,
948 const wxString& url,
949 wxString *redirect) const {
950 bool found;
951 wxHtmlOpeningStatus rval;
952 wxPyBlock_t blocked = wxPyBeginBlockThreads();
953 if ((found = wxPyCBH_findCallback(m_myInst, "OnOpeningURL"))) {
954 PyObject* ro;
955 PyObject* s = wx2PyString(url);
956 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(iO)", type, s));
957 Py_DECREF(s);
958 if (PyString_Check(ro)
959 #if PYTHON_API_VERSION >= 1009
960 || PyUnicode_Check(ro)
961 #endif
962 ) {
963 *redirect = Py2wxString(ro);
964 rval = wxHTML_REDIRECT;
965 }
966 else {
967 PyObject* num = PyNumber_Int(ro);
968 rval = (wxHtmlOpeningStatus)PyInt_AsLong(num);
969 Py_DECREF(num);
970 }
971 Py_DECREF(ro);
972 }
973 wxPyEndBlockThreads(blocked);
974 if (! found)
975 rval = wxHtmlWindow::OnOpeningURL(type, url, redirect);
976 return rval;
977 }
978
979
980 %}
981
982
983
984 MustHaveApp(wxPyHtmlWindow);
985
986 %rename(HtmlWindow) wxPyHtmlWindow;
987 class wxPyHtmlWindow : public wxScrolledWindow //,
988 // public wxHtmlWindowInterface //,
989 // public wxHtmlWindowMouseHelper
990 {
991 public:
992 %pythonAppend wxPyHtmlWindow "self._setOORInfo(self);" setCallbackInfo(HtmlWindow)
993 %pythonAppend wxPyHtmlWindow() ""
994 %typemap(out) wxPyHtmlWindow*; // turn off this typemap
995
996 wxPyHtmlWindow(wxWindow *parent, int id = -1,
997 const wxPoint& pos = wxDefaultPosition,
998 const wxSize& size = wxDefaultSize,
999 int style=wxHW_DEFAULT_STYLE,
1000 const wxString& name = wxPyHtmlWindowNameStr);
1001 %RenameCtor(PreHtmlWindow, wxPyHtmlWindow());
1002
1003 // Turn it back on again
1004 %typemap(out) wxPyHtmlWindow* { $result = wxPyMake_wxObject($1, $owner); }
1005
1006 bool Create(wxWindow *parent, int id = -1,
1007 const wxPoint& pos = wxDefaultPosition,
1008 const wxSize& size = wxDefaultSize,
1009 int style=wxHW_SCROLLBAR_AUTO,
1010 const wxString& name = wxPyHtmlWindowNameStr);
1011
1012
1013 void _setCallbackInfo(PyObject* self, PyObject* _class);
1014
1015
1016 // Set HTML page and display it. !! source is HTML document itself,
1017 // it is NOT address/filename of HTML document. If you want to
1018 // specify document location, use LoadPage() instead
1019 // Return value : False if an error occurred, True otherwise
1020 bool SetPage(const wxString& source);
1021
1022 // Load HTML page from given location. Location can be either
1023 // a) /usr/wxGTK2/docs/html/wx.htm
1024 // b) http://www.somewhere.uk/document.htm
1025 // c) ftp://ftp.somesite.cz/pub/something.htm
1026 // In case there is no prefix (http:,ftp:), the method
1027 // will try to find it itself (1. local file, then http or ftp)
1028 // After the page is loaded, the method calls SetPage() to display it.
1029 // Note : you can also use path relative to previously loaded page
1030 // Return value : same as SetPage
1031 bool LoadPage(const wxString& location);
1032
1033 // Loads HTML page from file
1034 bool LoadFile(const wxString& filename);
1035
1036 // Append to current page
1037 bool AppendToPage(const wxString& source);
1038
1039 // Returns full location of opened page
1040 wxString GetOpenedPage();
1041
1042 // Returns anchor within opened page
1043 wxString GetOpenedAnchor();
1044
1045 // Returns <TITLE> of opened page or empty string otherwise
1046 wxString GetOpenedPageTitle();
1047
1048 // Sets frame in which page title will be displayed. Format is format of
1049 // frame title, e.g. "HtmlHelp : %s". It must contain exactly one %s
1050 void SetRelatedFrame(wxFrame* frame, const wxString& format);
1051 wxFrame* GetRelatedFrame();
1052
1053 // After(!) calling SetRelatedFrame, this sets statusbar slot where messages
1054 // will be displayed. Default is -1 = no messages.
1055 void SetRelatedStatusBar(int bar);
1056
1057 // Sets fonts to be used when displaying HTML page.
1058 %extend {
1059 void SetFonts(wxString normal_face, wxString fixed_face, PyObject* sizes=NULL) {
1060 int* temp = NULL;
1061 if (sizes) temp = int_LIST_helper(sizes);
1062 self->SetFonts(normal_face, fixed_face, temp);
1063 if (temp)
1064 delete [] temp;
1065 }
1066 }
1067
1068 // Sets font sizes to be relative to the given size or the system
1069 // default size; use either specified or default font
1070 void SetStandardFonts(int size = -1,
1071 const wxString& normal_face = wxPyEmptyString,
1072 const wxString& fixed_face = wxPyEmptyString);
1073
1074 DocDeclStr(
1075 void, SetLabel(const wxString& title),
1076 "", "");
1077
1078 // Sets space between text and window borders.
1079 void SetBorders(int b);
1080
1081 // Sets the bitmap to use for background (currnetly it will be tiled,
1082 // when/if we have CSS support we could add other possibilities...)
1083 void SetBackgroundImage(const wxBitmap& bmpBg);
1084
1085 // Saves custom settings into cfg config. it will use the path 'path'
1086 // if given, otherwise it will save info into currently selected path.
1087 // saved values : things set by SetFonts, SetBorders.
1088 void ReadCustomization(wxConfigBase *cfg, wxString path = wxPyEmptyString);
1089 void WriteCustomization(wxConfigBase *cfg, wxString path = wxPyEmptyString);
1090
1091 // Goes to previous/next page (in browsing history)
1092 // Returns True if successful, False otherwise
1093 bool HistoryBack();
1094 bool HistoryForward();
1095 bool HistoryCanBack();
1096 bool HistoryCanForward();
1097
1098 // Resets History
1099 void HistoryClear();
1100
1101 // Returns pointer to conteiners/cells structure.
1102 wxHtmlContainerCell* GetInternalRepresentation();
1103
1104 // Returns a pointer to the parser.
1105 wxHtmlWinParser* GetParser();
1106
1107 bool ScrollToAnchor(const wxString& anchor);
1108 bool HasAnchor(const wxString& anchor);
1109
1110 //Adds input filter
1111 static void AddFilter(wxPyHtmlFilter *filter);
1112
1113 // Helper functions to select parts of page:
1114 void SelectWord(const wxPoint& pos);
1115 void SelectLine(const wxPoint& pos);
1116 void SelectAll();
1117
1118 // Convert selection to text:
1119 wxString SelectionToText();
1120
1121 // Converts current page to text:
1122 wxString ToText();
1123
1124 void OnLinkClicked(const wxHtmlLinkInfo& link);
1125 void OnSetTitle(const wxString& title);
1126 void OnCellMouseHover(wxHtmlCell *cell, wxCoord x, wxCoord y);
1127 bool OnCellClicked(wxHtmlCell *cell,
1128 wxCoord x, wxCoord y,
1129 const wxMouseEvent& event);
1130 wxHtmlOpeningStatus OnOpeningURL(wxHtmlURLType type,
1131 const wxString& url,
1132 wxString *redirect) const;
1133 %MAKE_BASE_FUNC(HtmlWindow, OnLinkClicked);
1134 %MAKE_BASE_FUNC(HtmlWindow, OnSetTitle);
1135 %MAKE_BASE_FUNC(HtmlWindow, OnCellMouseHover);
1136 %MAKE_BASE_FUNC(HtmlWindow, OnCellClicked);
1137
1138 static wxVisualAttributes
1139 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
1140
1141 /// Type of mouse cursor
1142 enum HTMLCursor
1143 {
1144 /// Standard mouse cursor (typically an arrow)
1145 HTMLCursor_Default,
1146 /// Cursor shown over links
1147 HTMLCursor_Link,
1148 /// Cursor shown over selectable text
1149 HTMLCursor_Text
1150 };
1151
1152 // Returns standard HTML cursor as used by wxHtmlWindow
1153 static wxCursor GetDefaultHTMLCursor(HTMLCursor type);
1154
1155
1156 // private:
1157 // // wxHtmlWindowInterface methods:
1158 // virtual void SetHTMLWindowTitle(const wxString& title);
1159 // virtual void OnHTMLLinkClicked(const wxHtmlLinkInfo& link);
1160 // virtual wxHtmlOpeningStatus OnHTMLOpeningURL(wxHtmlURLType type,
1161 // const wxString& url,
1162 // wxString *redirect) const;
1163 // virtual wxPoint HTMLCoordsToWindow(wxHtmlCell *cell,
1164 // const wxPoint& pos) const;
1165 // virtual wxWindow* GetHTMLWindow();
1166 // virtual wxColour GetHTMLBackgroundColour() const;
1167 // virtual void SetHTMLBackgroundColour(const wxColour& clr);
1168 // virtual void SetHTMLBackgroundImage(const wxBitmap& bmpBg);
1169 // virtual void SetHTMLStatusText(const wxString& text);
1170 // virtual wxCursor GetHTMLCursor(HTMLCursor type) const;
1171
1172 %property(InternalRepresentation, GetInternalRepresentation, doc="See `GetInternalRepresentation`");
1173 %property(OpenedAnchor, GetOpenedAnchor, doc="See `GetOpenedAnchor`");
1174 %property(OpenedPage, GetOpenedPage, doc="See `GetOpenedPage`");
1175 %property(OpenedPageTitle, GetOpenedPageTitle, doc="See `GetOpenedPageTitle`");
1176 %property(Parser, GetParser, doc="See `GetParser`");
1177 %property(RelatedFrame, GetRelatedFrame, doc="See `GetRelatedFrame`");
1178 };
1179
1180
1181
1182
1183 //---------------------------------------------------------------------------
1184 //---------------------------------------------------------------------------
1185 %newgroup
1186
1187
1188 MustHaveApp(wxHtmlDCRenderer);
1189
1190 class wxHtmlDCRenderer : public wxObject {
1191 public:
1192 wxHtmlDCRenderer();
1193 ~wxHtmlDCRenderer();
1194
1195 void SetDC(wxDC *dc, int maxwidth);
1196 void SetSize(int width, int height);
1197 void SetHtmlText(const wxString& html,
1198 const wxString& basepath = wxPyEmptyString,
1199 bool isdir = true);
1200 // Sets fonts to be used when displaying HTML page. (if size null then default sizes used).
1201 %extend {
1202 void SetFonts(wxString normal_face, wxString fixed_face, PyObject* sizes=NULL) {
1203 int* temp = NULL;
1204 if (sizes) temp = int_LIST_helper(sizes);
1205 self->SetFonts(normal_face, fixed_face, temp);
1206 if (temp)
1207 delete [] temp;
1208 }
1209 }
1210
1211 // Sets font sizes to be relative to the given size or the system
1212 // default size; use either specified or default font
1213 void SetStandardFonts(int size = -1,
1214 const wxString& normal_face = wxPyEmptyString,
1215 const wxString& fixed_face = wxPyEmptyString);
1216
1217 int Render(int x, int y, wxArrayInt& known_pagebreaks, int from = 0,
1218 int dont_render = FALSE, int to = INT_MAX);
1219 int GetTotalHeight();
1220 // returns total height of the html document
1221 // (compare Render's return value with this)
1222
1223 %property(TotalHeight, GetTotalHeight, doc="See `GetTotalHeight`");
1224 };
1225
1226
1227 enum {
1228 wxPAGE_ODD,
1229 wxPAGE_EVEN,
1230 wxPAGE_ALL
1231 };
1232
1233
1234 MustHaveApp(wxHtmlPrintout);
1235
1236 class wxHtmlPrintout : public wxPyPrintout {
1237 public:
1238 wxHtmlPrintout(const wxString& title = wxPyHtmlPrintoutTitleStr);
1239 //~wxHtmlPrintout(); wxPrintPreview object takes ownership...
1240
1241 void SetHtmlText(const wxString& html,
1242 const wxString &basepath = wxPyEmptyString,
1243 bool isdir = true);
1244 void SetHtmlFile(const wxString &htmlfile);
1245 void SetHeader(const wxString& header, int pg = wxPAGE_ALL);
1246 void SetFooter(const wxString& footer, int pg = wxPAGE_ALL);
1247
1248 // Sets fonts to be used when displaying HTML page. (if size null then default sizes used).
1249 %extend {
1250 void SetFonts(wxString normal_face, wxString fixed_face, PyObject* sizes=NULL) {
1251 int* temp = NULL;
1252 if (sizes) temp = int_LIST_helper(sizes);
1253 self->SetFonts(normal_face, fixed_face, temp);
1254 if (temp)
1255 delete [] temp;
1256 }
1257 }
1258
1259 // Sets font sizes to be relative to the given size or the system
1260 // default size; use either specified or default font
1261 void SetStandardFonts(int size = -1,
1262 const wxString& normal_face = wxPyEmptyString,
1263 const wxString& fixed_face = wxPyEmptyString);
1264
1265 void SetMargins(float top = 25.2, float bottom = 25.2,
1266 float left = 25.2, float right = 25.2,
1267 float spaces = 5);
1268
1269 // Adds input filter
1270 static void AddFilter(wxHtmlFilter *filter);
1271
1272 // Cleanup
1273 static void CleanUpStatics();
1274 };
1275
1276
1277
1278 MustHaveApp(wxHtmlEasyPrinting);
1279
1280 class wxHtmlEasyPrinting : public wxObject {
1281 public:
1282 wxHtmlEasyPrinting(const wxString& name = wxPyHtmlPrintingTitleStr,
1283 wxWindow *parentWindow = NULL);
1284 ~wxHtmlEasyPrinting();
1285
1286 void PreviewFile(const wxString &htmlfile);
1287 void PreviewText(const wxString &htmltext, const wxString& basepath = wxPyEmptyString);
1288 void PrintFile(const wxString &htmlfile);
1289 void PrintText(const wxString &htmltext, const wxString& basepath = wxPyEmptyString);
1290 // void PrinterSetup();
1291 void PageSetup();
1292 void SetHeader(const wxString& header, int pg = wxPAGE_ALL);
1293 void SetFooter(const wxString& footer, int pg = wxPAGE_ALL);
1294
1295 %extend {
1296 void SetFonts(wxString normal_face, wxString fixed_face, PyObject* sizes=NULL) {
1297 int* temp = NULL;
1298 if (sizes) temp = int_LIST_helper(sizes);
1299 self->SetFonts(normal_face, fixed_face, temp);
1300 if (temp)
1301 delete [] temp;
1302 }
1303 }
1304
1305 // Sets font sizes to be relative to the given size or the system
1306 // default size; use either specified or default font
1307 void SetStandardFonts(int size = -1,
1308 const wxString& normal_face = wxPyEmptyString,
1309 const wxString& fixed_face = wxPyEmptyString);
1310
1311 wxPrintData *GetPrintData() {return m_PrintData;}
1312 wxPageSetupDialogData *GetPageSetupData() {return m_PageSetupData;}
1313
1314 %property(PageSetupData, GetPageSetupData, doc="See `GetPageSetupData`");
1315 %property(PrintData, GetPrintData, doc="See `GetPrintData`");
1316 };
1317
1318
1319 //---------------------------------------------------------------------------
1320 //---------------------------------------------------------------------------
1321 %newgroup
1322
1323
1324 class wxHtmlBookRecord {
1325 public:
1326 wxHtmlBookRecord(const wxString& bookfile, const wxString& basepath,
1327 const wxString& title, const wxString& start);
1328
1329 wxString GetBookFile();
1330 wxString GetTitle();
1331 wxString GetStart();
1332 wxString GetBasePath();
1333
1334 void SetContentsRange(int start, int end);
1335 int GetContentsStart();
1336 int GetContentsEnd();
1337
1338 void SetTitle(const wxString& title);
1339 void SetBasePath(const wxString& path);
1340 void SetStart(const wxString& start);
1341
1342 wxString GetFullPath(const wxString &page) const;
1343
1344 %property(BasePath, GetBasePath, SetBasePath, doc="See `GetBasePath` and `SetBasePath`");
1345 %property(BookFile, GetBookFile, doc="See `GetBookFile`");
1346 %property(ContentsEnd, GetContentsEnd, doc="See `GetContentsEnd`");
1347 %property(ContentsStart, GetContentsStart, doc="See `GetContentsStart`");
1348 %property(FullPath, GetFullPath, doc="See `GetFullPath`");
1349 %property(Start, GetStart, SetStart, doc="See `GetStart` and `SetStart`");
1350 %property(Title, GetTitle, SetTitle, doc="See `GetTitle` and `SetTitle`");
1351 };
1352
1353 //---------------------------------------------------------------------------
1354 // WXWIN_COMPATIBILITY_2_4
1355 #if 0
1356 struct wxHtmlContentsItem
1357 {
1358 %extend {
1359 int GetLevel() { return self->m_Level; }
1360 int GetID() { return self->m_ID; }
1361 wxString GetName() { return self->m_Name; }
1362 wxString GetPage() { return self->m_Page; }
1363 wxHtmlBookRecord* GetBook() { return self->m_Book; }
1364 }
1365 };
1366 #endif
1367 //---------------------------------------------------------------------------
1368
1369 class wxHtmlSearchStatus
1370 {
1371 public:
1372 //wxHtmlSearchStatus(wxHtmlHelpData* base, const wxString& keyword,
1373 // const wxString& book = wxPyEmptyString);
1374 bool Search();
1375 bool IsActive();
1376 int GetCurIndex();
1377 int GetMaxIndex();
1378 const wxString& GetName();
1379
1380 %property(CurIndex, GetCurIndex, doc="See `GetCurIndex`");
1381 %property(MaxIndex, GetMaxIndex, doc="See `GetMaxIndex`");
1382 %property(Name, GetName, doc="See `GetName`");
1383 };
1384
1385 //---------------------------------------------------------------------------
1386
1387 class wxHtmlHelpData {
1388 public:
1389 wxHtmlHelpData();
1390 ~wxHtmlHelpData();
1391
1392 void SetTempDir(const wxString& path);
1393 bool AddBook(const wxString& book);
1394 // bool AddBookParam(const wxString& title, const wxString& contfile,
1395 // const wxString& indexfile=wxPyEmptyString,
1396 // const wxString& deftopic=wxPyEmptyString,
1397 // const wxString& path=wxPyEmptyString);
1398
1399 wxString FindPageByName(const wxString& page);
1400 wxString FindPageById(int id);
1401
1402 // TODO: this one needs fixed...
1403 const wxHtmlBookRecArray& GetBookRecArray();
1404
1405 %property(BookRecArray, GetBookRecArray, doc="See `GetBookRecArray`");
1406 };
1407
1408 //---------------------------------------------------------------------------
1409
1410 enum {
1411 wxHF_TOOLBAR,
1412 wxHF_CONTENTS,
1413 wxHF_INDEX,
1414 wxHF_SEARCH,
1415 wxHF_BOOKMARKS,
1416 wxHF_OPEN_FILES,
1417 wxHF_PRINT,
1418 wxHF_FLAT_TOOLBAR,
1419 wxHF_MERGE_BOOKS,
1420 wxHF_ICONS_BOOK,
1421 wxHF_ICONS_BOOK_CHAPTER,
1422 wxHF_ICONS_FOLDER,
1423 wxHF_DEFAULT_STYLE,
1424
1425 wxHF_EMBEDDED,
1426 wxHF_DIALOG,
1427 wxHF_FRAME,
1428 wxHF_MODAL,
1429 };
1430
1431 enum {
1432 wxID_HTML_PANEL,
1433 wxID_HTML_BACK,
1434 wxID_HTML_FORWARD,
1435 wxID_HTML_UPNODE,
1436 wxID_HTML_UP,
1437 wxID_HTML_DOWN,
1438 wxID_HTML_PRINT,
1439 wxID_HTML_OPENFILE,
1440 wxID_HTML_OPTIONS,
1441 wxID_HTML_BOOKMARKSLIST,
1442 wxID_HTML_BOOKMARKSADD,
1443 wxID_HTML_BOOKMARKSREMOVE,
1444 wxID_HTML_TREECTRL,
1445 wxID_HTML_INDEXPAGE,
1446 wxID_HTML_INDEXLIST,
1447 wxID_HTML_INDEXTEXT,
1448 wxID_HTML_INDEXBUTTON,
1449 wxID_HTML_INDEXBUTTONALL,
1450 wxID_HTML_NOTEBOOK,
1451 wxID_HTML_SEARCHPAGE,
1452 wxID_HTML_SEARCHTEXT,
1453 wxID_HTML_SEARCHLIST,
1454 wxID_HTML_SEARCHBUTTON,
1455 wxID_HTML_SEARCHCHOICE,
1456 wxID_HTML_COUNTINFO
1457 };
1458
1459
1460 %{
1461 typedef wxTreeCtrl wxPyTreeCtrl;
1462 %}
1463
1464 MustHaveApp(wxHtmlHelpWindow);
1465
1466 class wxHtmlHelpWindow : public wxWindow
1467 {
1468 public:
1469 %pythonAppend wxHtmlHelpWindow "self._setOORInfo(self)"
1470 %pythonAppend wxHtmlHelpWindow() ""
1471 %typemap(out) wxHtmlHelpWindow*; // turn off this typemap
1472
1473 wxHtmlHelpWindow(wxWindow* parent, wxWindowID wxWindowID,
1474 const wxPoint& pos = wxDefaultPosition,
1475 const wxSize& size = wxDefaultSize,
1476 int style = wxTAB_TRAVERSAL|wxNO_BORDER,
1477 int helpStyle = wxHF_DEFAULT_STYLE,
1478 wxHtmlHelpData* data = NULL);
1479 %RenameCtor(PreHtmlHelpWindow, wxHtmlHelpWindow(wxHtmlHelpData* data = NULL));
1480
1481 // Turn it back on again
1482 %typemap(out) wxHtmlHelpWindow* { $result = wxPyMake_wxObject($1, $owner); }
1483
1484 bool Create(wxWindow* parent, wxWindowID id,
1485 const wxPoint& pos = wxDefaultPosition,
1486 const wxSize& size = wxDefaultSize,
1487 int style = wxTAB_TRAVERSAL|wxNO_BORDER,
1488 int helpStyle = wxHF_DEFAULT_STYLE);
1489
1490 wxHtmlHelpData* GetData();
1491 wxHtmlHelpController* GetController() const;
1492
1493 %disownarg( wxHtmlHelpController* controller );
1494 void SetController(wxHtmlHelpController* controller);
1495 %cleardisown( wxHtmlHelpController* controller );
1496
1497 // Displays page x. If not found it will offect the user a choice of
1498 // searching books.
1499 // Looking for the page runs in these steps:
1500 // 1. try to locate file named x (if x is for example "doc/howto.htm")
1501 // 2. try to open starting page of book x
1502 // 3. try to find x in contents (if x is for example "How To ...")
1503 // 4. try to find x in index (if x is for example "How To ...")
1504 bool Display(const wxString& x);
1505
1506 // Alternative version that works with numeric ID.
1507 // (uses extension to MS format, <param name="ID" value=id>, see docs)
1508 %Rename(DisplayID, bool, Display(int id));
1509
1510 // Displays help window and focuses contents.
1511 bool DisplayContents();
1512
1513 // Displays help window and focuses index.
1514 bool DisplayIndex();
1515
1516 // Searches for keyword. Returns true and display page if found, return
1517 // false otherwise
1518 // Syntax of keyword is Altavista-like:
1519 // * words are separated by spaces
1520 // (but "\"hello world\"" is only one world "hello world")
1521 // * word may be pretended by + or -
1522 // (+ : page must contain the word ; - : page can't contain the word)
1523 // * if there is no + or - before the word, + is default
1524 bool KeywordSearch(const wxString& keyword,
1525 wxHelpSearchMode mode = wxHELP_SEARCH_ALL);
1526
1527 void UseConfig(wxConfigBase *config, const wxString& rootpath = wxEmptyString);
1528
1529 // Saves custom settings into cfg config. it will use the path 'path'
1530 // if given, otherwise it will save info into currently selected path.
1531 // saved values : things set by SetFonts, SetBorders.
1532 void ReadCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString);
1533 void WriteCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString);
1534
1535 // call this to let wxHtmlHelpWindow know page changed
1536 void NotifyPageChanged();
1537
1538 // Refreshes Contents and Index tabs
1539 void RefreshLists();
1540
1541 // Gets the HTML window
1542 wxPyHtmlWindow* GetHtmlWindow() const;
1543
1544 // Gets the splitter window
1545 wxSplitterWindow* GetSplitterWindow();
1546
1547 // Gets the toolbar
1548 wxToolBar* GetToolBar() const;
1549
1550 // Gets the configuration data
1551 wxHtmlHelpFrameCfg& GetCfgData();
1552
1553 // Gets the tree control
1554 wxPyTreeCtrl *GetTreeCtrl() const;
1555
1556 %property(CfgData, GetCfgData, doc="See `GetCfgData`");
1557 %property(Controller, GetController, SetController, doc="See `GetController` and `SetController`");
1558 %property(Data, GetData, doc="See `GetData`");
1559 %property(HtmlWindow, GetHtmlWindow, doc="See `GetHtmlWindow`");
1560 %property(SplitterWindow, GetSplitterWindow, doc="See `GetSplitterWindow`");
1561 %property(ToolBar, GetToolBar, doc="See `GetToolBar`");
1562 %property(TreeCtrl, GetTreeCtrl, doc="See `GetTreeCtrl`");
1563 };
1564
1565 //---------------------------------------------------------------------------
1566
1567
1568 %constant wxEventType wxEVT_COMMAND_HTML_CELL_CLICKED;
1569 %constant wxEventType wxEVT_COMMAND_HTML_CELL_HOVER;
1570 %constant wxEventType wxEVT_COMMAND_HTML_LINK_CLICKED;
1571
1572
1573 class wxHtmlCellEvent : public wxCommandEvent
1574 {
1575 public:
1576 wxHtmlCellEvent(wxEventType commandType, int id,
1577 wxHtmlCell *cell, const wxPoint &pt,
1578 const wxMouseEvent &ev);
1579
1580 wxHtmlCell* GetCell() const;
1581 wxPoint GetPoint() const;
1582 wxMouseEvent GetMouseEvent() const;
1583
1584 void SetLinkClicked(bool linkclicked);
1585 bool GetLinkClicked() const;
1586 };
1587
1588
1589 class wxHtmlLinkEvent : public wxCommandEvent
1590 {
1591 public:
1592 wxHtmlLinkEvent(int id, const wxHtmlLinkInfo &linkinfo);
1593
1594 const wxHtmlLinkInfo &GetLinkInfo() const;
1595 };
1596
1597
1598 %pythoncode {
1599 EVT_HTML_CELL_CLICKED = wx.PyEventBinder( wxEVT_COMMAND_HTML_CELL_CLICKED, 1 )
1600 EVT_HTML_CELL_HOVER = wx.PyEventBinder( wxEVT_COMMAND_HTML_CELL_HOVER, 1 )
1601 EVT_HTML_LINK_CLICKED = wx.PyEventBinder( wxEVT_COMMAND_HTML_LINK_CLICKED, 1 )
1602 }
1603
1604 //---------------------------------------------------------------------------
1605
1606
1607 MustHaveApp(wxHtmlHelpFrame);
1608
1609 class wxHtmlHelpFrame : public wxFrame {
1610 public:
1611 %pythonAppend wxHtmlHelpFrame "self._setOORInfo(self)"
1612 %pythonAppend wxHtmlHelpFrame() ""
1613 %typemap(out) wxHtmlHelpFrame*; // turn off this typemap
1614
1615 wxHtmlHelpFrame(wxWindow* parent, int wxWindowID,
1616 const wxString& title = wxPyEmptyString,
1617 int style = wxHF_DEFAULTSTYLE, wxHtmlHelpData* data = NULL,
1618 wxConfigBase *config=NULL,
1619 const wxString& rootpath = wxPyEmptyString);
1620 %RenameCtor(PreHtmlHelpFrame, wxHtmlHelpFrame(wxHtmlHelpData* data = NULL));
1621
1622 // Turn it back on again
1623 %typemap(out) wxHtmlHelpFrame* { $result = wxPyMake_wxObject($1, $owner); }
1624
1625 bool Create(wxWindow* parent, wxWindowID id,
1626 const wxString& title = wxPyEmptyString,
1627 int style = wxHF_DEFAULT_STYLE,
1628 wxConfigBase *config=NULL,
1629 const wxString& rootpath = wxPyEmptyString);
1630
1631 wxHtmlHelpData* GetData();
1632 void SetTitleFormat(const wxString& format);
1633
1634 void AddGrabIfNeeded();
1635
1636 /// Returns the help controller associated with the window.
1637 wxHtmlHelpController* GetController() const;
1638
1639 /// Sets the help controller associated with the window.
1640 %disownarg( wxHtmlHelpController* controller );
1641 void SetController(wxHtmlHelpController* controller);
1642 %cleardisown( wxHtmlHelpController* controller );
1643
1644 /// Returns the help window.
1645 wxHtmlHelpWindow* GetHelpWindow() const;
1646
1647 %pythoncode {
1648 %# For compatibility from before the refactor
1649 def Display(self, x):
1650 return self.GetHelpWindow().Display(x)
1651 def DisplayID(self, x):
1652 return self.GetHelpWindow().DisplayID(id)
1653 def DisplayContents(self):
1654 return self.GetHelpWindow().DisplayContents()
1655 def DisplayIndex(self):
1656 return self.GetHelpWindow().DisplayIndex()
1657
1658 def KeywordSearch(self, keyword):
1659 return self.GetHelpWindow().KeywordSearch(keyword)
1660
1661 def UseConfig(self, config, rootpath=""):
1662 return self.GetHelpWindow().UseConfig(config, rootpath)
1663 def ReadCustomization(self, config, rootpath=""):
1664 return self.GetHelpWindow().ReadCustomization(config, rootpath)
1665 def WriteCustomization(self, config, rootpath=""):
1666 return self.GetHelpWindow().WriteCustomization(config, rootpath)
1667 %}
1668
1669 %property(Controller, GetController, SetController, doc="See `GetController` and `SetController`");
1670 %property(Data, GetData, doc="See `GetData`");
1671 %property(HelpWindow, GetHelpWindow, doc="See `GetHelpWindow`");
1672 };
1673
1674
1675
1676 MustHaveApp(wxHtmlHelpDialog);
1677
1678 class wxHtmlHelpDialog : public wxDialog
1679 {
1680 public:
1681 %pythonAppend wxHtmlHelpDialog "self._setOORInfo(self)"
1682 %pythonAppend wxHtmlHelpDialog() ""
1683 %typemap(out) wxHtmlHelpDialog*; // turn off this typemap
1684
1685 wxHtmlHelpDialog(wxWindow* parent, wxWindowID wxWindowID,
1686 const wxString& title = wxPyEmptyString,
1687 int style = wxHF_DEFAULT_STYLE, wxHtmlHelpData* data = NULL);
1688 %RenameCtor(PreHtmlHelpDialog, wxHtmlHelpDialog(wxHtmlHelpData* data = NULL));
1689
1690 // Turn it back on again
1691 %typemap(out) wxHtmlHelpDialog* { $result = wxPyMake_wxObject($1, $owner); }
1692
1693 bool Create(wxWindow* parent, wxWindowID id, const wxString& title = wxPyEmptyString,
1694 int style = wxHF_DEFAULT_STYLE);
1695
1696 /// Returns the data associated with this dialog.
1697 wxHtmlHelpData* GetData();
1698
1699 /// Returns the controller that created this dialog.
1700 wxHtmlHelpController* GetController() const;
1701
1702 /// Sets the controller associated with this dialog.
1703 %disownarg( wxHtmlHelpController* controller );
1704 void SetController(wxHtmlHelpController* controller);
1705 %cleardisown( wxHtmlHelpController* controller );
1706
1707 /// Returns the help window.
1708 wxHtmlHelpWindow* GetHelpWindow() const;
1709
1710 // Sets format of title of the frame. Must contain exactly one "%s"
1711 // (for title of displayed HTML page)
1712 void SetTitleFormat(const wxString& format);
1713
1714 // Override to add custom buttons to the toolbar
1715 // virtual void AddToolbarButtons(wxToolBar* WXUNUSED(toolBar), int WXUNUSED(style)) {};
1716
1717 %property(Controller, GetController, SetController, doc="See `GetController` and `SetController`");
1718 %property(Data, GetData, doc="See `GetData`");
1719 %property(HelpWindow, GetHelpWindow, doc="See `GetHelpWindow`");
1720 };
1721
1722
1723 //---------------------------------------------------------------------------
1724
1725
1726 // TODO: Make virtual methods of this class overridable in Python.
1727
1728 MustHaveApp(wxHelpControllerBase);
1729
1730 class wxHelpControllerBase: public wxObject
1731 {
1732 public:
1733 // wxHelpControllerBase(wxWindow* parentWindow = NULL);
1734 // ~wxHelpControllerBase();
1735
1736 %nokwargs Initialize;
1737 virtual bool Initialize(const wxString& file, int server );
1738 virtual bool Initialize(const wxString& file);
1739
1740 virtual void SetViewer(const wxString& viewer, long flags = 0);
1741
1742 // If file is "", reloads file given in Initialize
1743 virtual bool LoadFile(const wxString& file = wxEmptyString) /* = 0 */;
1744
1745 // Displays the contents
1746 virtual bool DisplayContents(void) /* = 0 */;
1747
1748 %nokwargs DisplaySection;
1749
1750 // Display the given section
1751 virtual bool DisplaySection(int sectionNo) /* = 0 */;
1752
1753 // Display the section using a context id
1754 virtual bool DisplayContextPopup(int contextId);
1755
1756 // Display the text in a popup, if possible
1757 virtual bool DisplayTextPopup(const wxString& text, const wxPoint& pos);
1758
1759 // By default, uses KeywordSection to display a topic. Implementations
1760 // may override this for more specific behaviour.
1761 virtual bool DisplaySection(const wxString& section);
1762
1763 virtual bool DisplayBlock(long blockNo) /* = 0 */;
1764 virtual bool KeywordSearch(const wxString& k,
1765 wxHelpSearchMode mode = wxHELP_SEARCH_ALL) /* = 0 */;
1766
1767 /// Allows one to override the default settings for the help frame.
1768 virtual void SetFrameParameters(const wxString& title,
1769 const wxSize& size,
1770 const wxPoint& pos = wxDefaultPosition,
1771 bool newFrameEachTime = false);
1772
1773 /// Obtains the latest settings used by the help frame and the help
1774 /// frame.
1775 virtual wxFrame *GetFrameParameters(wxSize *size = NULL,
1776 wxPoint *pos = NULL,
1777 bool *newFrameEachTime = NULL);
1778
1779 virtual bool Quit() /* = 0 */;
1780
1781 virtual void OnQuit();
1782
1783 /// Set the window that can optionally be used for the help window's parent.
1784 virtual void SetParentWindow(wxWindow* win);
1785
1786 /// Get the window that can optionally be used for the help window's parent.
1787 virtual wxWindow* GetParentWindow() const;
1788
1789 %property(ParentWindow, GetParentWindow, SetParentWindow, doc="See `GetParentWindow` and `SetParentWindow`");
1790 };
1791
1792
1793
1794
1795 MustHaveApp(wxHtmlHelpController);
1796
1797 class wxHtmlHelpController : public wxHelpControllerBase
1798 {
1799 public:
1800 // %pythonAppend wxHtmlHelpController "self._setOORInfo(self)"
1801
1802 wxHtmlHelpController(int style = wxHF_DEFAULT_STYLE, wxWindow* parentWindow = NULL);
1803 ~wxHtmlHelpController();
1804
1805 wxHtmlHelpWindow* GetHelpWindow();
1806 void SetHelpWindow(wxHtmlHelpWindow* helpWindow);
1807
1808 wxHtmlHelpFrame* GetFrame();
1809 wxHtmlHelpDialog* GetDialog();
1810
1811 void SetTitleFormat(const wxString& format);
1812 void SetTempDir(const wxString& path);
1813 bool AddBook(const wxString& book, int show_wait_msg = false);
1814 void Display(const wxString& x);
1815 %Rename(DisplayID, void, Display(int id));
1816 void DisplayContents();
1817 void DisplayIndex();
1818 bool KeywordSearch(const wxString& keyword);
1819 void UseConfig(wxConfigBase *config, const wxString& rootpath = wxPyEmptyString);
1820 void ReadCustomization(wxConfigBase *cfg, wxString path = wxPyEmptyString);
1821 void WriteCustomization(wxConfigBase *cfg, wxString path = wxPyEmptyString);
1822
1823 void MakeModalIfNeeded();
1824 wxWindow* FindTopLevelWindow();
1825
1826 %property(Dialog, GetDialog, doc="See `GetDialog`");
1827 %property(Frame, GetFrame, doc="See `GetFrame`");
1828 %property(HelpWindow, GetHelpWindow, SetHelpWindow, doc="See `GetHelpWindow` and `SetHelpWindow`");
1829 };
1830
1831
1832 /*
1833 * wxHtmlModalHelp
1834 * A convenience class particularly for use on wxMac,
1835 * where you can only show modal dialogs from a modal
1836 * dialog.
1837 *
1838 * Use like this:
1839 *
1840 * wxHtmlModalHelp help(parent, filename, topic);
1841 *
1842 * If topic is empty, the help contents is displayed.
1843 */
1844
1845 class wxHtmlModalHelp
1846 {
1847 public:
1848 wxHtmlModalHelp(wxWindow* parent, const wxString& helpFile,
1849 const wxString& topic = wxEmptyString,
1850 int style = wxHF_DEFAULT_STYLE | wxHF_DIALOG | wxHF_MODAL);
1851 };
1852
1853
1854 //---------------------------------------------------------------------------
1855 %init %{
1856 wxPyPtrTypeMap_Add("wxHtmlTagHandler", "wxPyHtmlTagHandler");
1857 wxPyPtrTypeMap_Add("wxHtmlWinTagHandler", "wxPyHtmlWinTagHandler");
1858 wxPyPtrTypeMap_Add("wxHtmlWindow", "wxPyHtmlWindow");
1859 wxPyPtrTypeMap_Add("wxHtmlFilter", "wxPyHtmlFilter");
1860 %}
1861 //---------------------------------------------------------------------------
1862 //---------------------------------------------------------------------------
1863
1864
1865