]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/html.i
changed to behave in same way as native win32 control and generic wxListCtrl when...
[wxWidgets.git] / wxPython / src / html.i
CommitLineData
4b123bb9
HH
1/////////////////////////////////////////////////////////////////////////////
2// Name: html.i
3// Purpose: SWIG definitions of html classes
4//
5// Author: Robin Dunn
6//
d14a1e28 7// Created: 25-Nov-1998
4b123bb9 8// RCS-ID: $Id$
d14a1e28 9// Copyright: (c) 2003 by Total Control Software
4b123bb9
HH
10// Licence: wxWindows license
11/////////////////////////////////////////////////////////////////////////////
12
c8fac2b6
RD
13%define DOCSTRING
14"Classes for a simple HTML rendering window, HTML Help Window, etc."
15%enddef
4b123bb9 16
b2eb030f 17%module(package="wx", docstring=DOCSTRING) html
4b123bb9
HH
18
19%{
d14a1e28
RD
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
4b123bb9 25#include <wx/html/htmlwin.h>
dc2f8a65 26#include <wx/html/htmprint.h>
d14a1e28 27#include <wx/html/helpctrl.h>
4b123bb9 28
137b5242
RD
29%}
30
b2dc1044 31
0f66a9f3 32//---------------------------------------------------------------------------
e166644c 33
d14a1e28 34%import windows.i
54f9ee45 35%pythoncode { wx = _core }
99109c0f 36%pythoncode { __docfilter__ = wx.__DocFilter(globals()) }
d14a1e28
RD
37
38%include _html_rename.i
39
40
b2dc1044 41MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
089142a5
RD
42MAKE_CONST_WXSTRING2(HtmlWindowNameStr, wxT("htmlWindow"))
43MAKE_CONST_WXSTRING2(HtmlPrintoutTitleStr, wxT("Printout"))
44MAKE_CONST_WXSTRING2(HtmlPrintingTitleStr, wxT("Printing"))
b2dc1044
RD
45
46
d14a1e28
RD
47// TODO: Split this file into multiple %included files that coresponds to the
48// wx/html include files (more or less.)
49
50//---------------------------------------------------------------------------
51//---------------------------------------------------------------------------
52%newgroup
53
54
e166644c 55enum {
9d8bd15f
RD
56 wxHTML_ALIGN_LEFT,
57 wxHTML_ALIGN_CENTER,
58 wxHTML_ALIGN_RIGHT,
59 wxHTML_ALIGN_BOTTOM,
60 wxHTML_ALIGN_TOP,
61
62 wxHTML_CLR_FOREGROUND,
63 wxHTML_CLR_BACKGROUND,
64
65 wxHTML_UNITS_PIXELS,
66 wxHTML_UNITS_PERCENT,
67
68 wxHTML_INDENT_LEFT,
69 wxHTML_INDENT_RIGHT,
70 wxHTML_INDENT_TOP,
71 wxHTML_INDENT_BOTTOM,
72
73 wxHTML_INDENT_HORIZONTAL,
74 wxHTML_INDENT_VERTICAL,
75 wxHTML_INDENT_ALL,
76
77 wxHTML_COND_ISANCHOR,
78 wxHTML_COND_ISIMAGEMAP,
79 wxHTML_COND_USER,
4eeb5705
RD
80
81
82 wxHTML_FONT_SIZE_1,
83 wxHTML_FONT_SIZE_2,
84 wxHTML_FONT_SIZE_3,
85 wxHTML_FONT_SIZE_4,
86 wxHTML_FONT_SIZE_5,
87 wxHTML_FONT_SIZE_6,
88 wxHTML_FONT_SIZE_7,
e166644c
RD
89};
90
91
c6c593e8
RD
92enum {
93 wxHW_SCROLLBAR_NEVER,
94 wxHW_SCROLLBAR_AUTO,
3ef86e32
RD
95 wxHW_NO_SELECTION,
96 wxHW_DEFAULT_STYLE,
c6c593e8
RD
97};
98
99
100// enums for wxHtmlWindow::OnOpeningURL
101enum wxHtmlOpeningStatus
102{
103 wxHTML_OPEN,
104 wxHTML_BLOCK,
105 wxHTML_REDIRECT
106};
107
108enum wxHtmlURLType
109{
110 wxHTML_URL_PAGE,
111 wxHTML_URL_IMAGE,
112 wxHTML_URL_OTHER
113};
114
d14a1e28
RD
115
116
9c00cfa3
RD
117//---------------------------------------------------------------------------
118
9416aa89 119class wxHtmlLinkInfo : public wxObject {
9c00cfa3 120public:
137b5242 121 wxHtmlLinkInfo(const wxString& href, const wxString& target = wxPyEmptyString);
9c00cfa3
RD
122 wxString GetHref();
123 wxString GetTarget();
c8bc03c3
RD
124 wxMouseEvent* GetEvent();
125 wxHtmlCell* GetHtmlCell();
7a446686
RD
126
127 void SetEvent(const wxMouseEvent *e);
128 void SetHtmlCell(const wxHtmlCell * e);
9c00cfa3
RD
129};
130
0f66a9f3
RD
131//---------------------------------------------------------------------------
132
9416aa89 133class wxHtmlTag : public wxObject {
0f66a9f3 134public:
e166644c 135 // Never need to create a new tag from Python...
0f66a9f3
RD
136 //wxHtmlTag(const wxString& source, int pos, int end_pos, wxHtmlTagsCache* cache);
137
138 wxString GetName();
139 bool HasParam(const wxString& par);
dd9f7fea 140 wxString GetParam(const wxString& par, int with_commas = False);
0f66a9f3
RD
141
142 // Can't do this one as-is, but GetParam should be enough...
143 //int ScanParam(const wxString& par, const char *format, void* param);
144
145 wxString GetAllParams();
0f66a9f3
RD
146 bool HasEnding();
147 int GetBeginPos();
148 int GetEndPos1();
149 int GetEndPos2();
150};
151
0f66a9f3
RD
152//---------------------------------------------------------------------------
153
9416aa89 154class wxHtmlParser : public wxObject {
0f66a9f3
RD
155public:
156 // wxHtmlParser(); This is an abstract base class...
157
158 void SetFS(wxFileSystem *fs);
159 wxFileSystem* GetFS();
160 wxObject* Parse(const wxString& source);
161 void InitParser(const wxString& source);
162 void DoneParser();
163 void DoParsing(int begin_pos, int end_pos);
1e4a197e 164 void StopParsing();
0f66a9f3 165 // wxObject* GetProduct();
1e4a197e 166
0f66a9f3
RD
167 void AddTagHandler(wxHtmlTagHandler *handler);
168 wxString* GetSource();
dc2f8a65
RD
169 void PushTagHandler(wxHtmlTagHandler* handler, wxString tags);
170 void PopTagHandler();
0f66a9f3 171
c6c593e8 172 // virtual wxFSFile *OpenURL(wxHtmlURLType type, const wxString& url) const;
0f66a9f3
RD
173
174 // void AddText(const char* txt) = 0;
175 // void AddTag(const wxHtmlTag& tag);
176};
177
178
179//---------------------------------------------------------------------------
180
181class wxHtmlWinParser : public wxHtmlParser {
182public:
1fded56b 183 wxHtmlWinParser(wxPyHtmlWindow *wnd = NULL);
0f66a9f3
RD
184
185 void SetDC(wxDC *dc);
186 wxDC* GetDC();
187 int GetCharHeight();
188 int GetCharWidth();
1fded56b 189 wxPyHtmlWindow* GetWindow();
d14a1e28 190
1fded56b 191 // Sets fonts to be used when displaying HTML page. (if size null then default sizes used).
d14a1e28 192 %extend {
9cbf6f6e
RD
193 void SetFonts(wxString normal_face, wxString fixed_face, PyObject* sizes=NULL) {
194 int* temp = NULL;
195 if (sizes) temp = int_LIST_helper(sizes);
196 self->SetFonts(normal_face, fixed_face, temp);
197 if (temp)
f6bcfd97 198 delete [] temp;
f6bcfd97
BP
199 }
200 }
0f66a9f3
RD
201
202 wxHtmlContainerCell* GetContainer();
203 wxHtmlContainerCell* OpenContainer();
dc2f8a65 204 wxHtmlContainerCell *SetContainer(wxHtmlContainerCell *c);
0f66a9f3 205 wxHtmlContainerCell* CloseContainer();
dc2f8a65 206
0f66a9f3
RD
207 int GetFontSize();
208 void SetFontSize(int s);
209 int GetFontBold();
210 void SetFontBold(int x);
211 int GetFontItalic();
212 void SetFontItalic(int x);
213 int GetFontUnderlined();
214 void SetFontUnderlined(int x);
215 int GetFontFixed();
216 void SetFontFixed(int x);
217 int GetAlign();
218 void SetAlign(int a);
c5943253 219 wxColour GetLinkColor();
0f66a9f3 220 void SetLinkColor(const wxColour& clr);
c5943253 221 wxColour GetActualColor();
0f66a9f3 222 void SetActualColor(const wxColour& clr);
0f66a9f3
RD
223 void SetLink(const wxString& link);
224 wxFont* CreateCurrentFont();
9c00cfa3
RD
225 wxHtmlLinkInfo GetLink();
226
0f66a9f3
RD
227};
228
229
0f66a9f3
RD
230//---------------------------------------------------------------------------
231
232%{
233class wxPyHtmlTagHandler : public wxHtmlTagHandler {
9416aa89 234 DECLARE_DYNAMIC_CLASS(wxPyHtmlTagHandler);
0f66a9f3
RD
235public:
236 wxPyHtmlTagHandler() : wxHtmlTagHandler() {};
237
238 wxHtmlParser* GetParser() { return m_Parser; }
239 void ParseInner(const wxHtmlTag& tag) { wxHtmlTagHandler::ParseInner(tag); }
240
241 DEC_PYCALLBACK_STRING__pure(GetSupportedTags);
242 DEC_PYCALLBACK_BOOL_TAG_pure(HandleTag);
243
244 PYPRIVATE;
245};
246
9416aa89
RD
247IMPLEMENT_DYNAMIC_CLASS(wxPyHtmlTagHandler, wxHtmlTagHandler);
248
0f66a9f3
RD
249IMP_PYCALLBACK_STRING__pure(wxPyHtmlTagHandler, wxHtmlTagHandler, GetSupportedTags);
250IMP_PYCALLBACK_BOOL_TAG_pure(wxPyHtmlTagHandler, wxHtmlTagHandler, HandleTag);
0f66a9f3
RD
251%}
252
253
d14a1e28 254%name(HtmlTagHandler) class wxPyHtmlTagHandler : public wxObject {
0f66a9f3 255public:
2b9048c5 256 %pythonAppend wxPyHtmlTagHandler "self._setCallbackInfo(self, HtmlTagHandler)"
0f66a9f3
RD
257 wxPyHtmlTagHandler();
258
0122b7e3 259 void _setCallbackInfo(PyObject* self, PyObject* _class);
0f66a9f3
RD
260
261 void SetParser(wxHtmlParser *parser);
262 wxHtmlParser* GetParser();
263 void ParseInner(const wxHtmlTag& tag);
264};
265
266
267//---------------------------------------------------------------------------
268
269%{
270class wxPyHtmlWinTagHandler : public wxHtmlWinTagHandler {
9416aa89 271 DECLARE_DYNAMIC_CLASS(wxPyHtmlWinTagHandler);
0f66a9f3
RD
272public:
273 wxPyHtmlWinTagHandler() : wxHtmlWinTagHandler() {};
274
275 wxHtmlWinParser* GetParser() { return m_WParser; }
276 void ParseInner(const wxHtmlTag& tag)
277 { wxHtmlWinTagHandler::ParseInner(tag); }
278
279 DEC_PYCALLBACK_STRING__pure(GetSupportedTags);
280 DEC_PYCALLBACK_BOOL_TAG_pure(HandleTag);
281
282 PYPRIVATE;
283};
284
9416aa89
RD
285IMPLEMENT_DYNAMIC_CLASS( wxPyHtmlWinTagHandler, wxHtmlWinTagHandler);
286
0f66a9f3
RD
287IMP_PYCALLBACK_STRING__pure(wxPyHtmlWinTagHandler, wxHtmlWinTagHandler, GetSupportedTags);
288IMP_PYCALLBACK_BOOL_TAG_pure(wxPyHtmlWinTagHandler, wxHtmlWinTagHandler, HandleTag);
0f66a9f3
RD
289%}
290
291
d14a1e28 292%name(HtmlWinTagHandler) class wxPyHtmlWinTagHandler : public wxPyHtmlTagHandler {
0f66a9f3 293public:
2b9048c5 294 %pythonAppend wxPyHtmlWinTagHandler "self._setCallbackInfo(self, HtmlWinTagHandler)"
0f66a9f3
RD
295 wxPyHtmlWinTagHandler();
296
0122b7e3 297 void _setCallbackInfo(PyObject* self, PyObject* _class);
0f66a9f3
RD
298
299 void SetParser(wxHtmlParser *parser);
300 wxHtmlWinParser* GetParser();
301 void ParseInner(const wxHtmlTag& tag);
302};
303
304
305//---------------------------------------------------------------------------
306
307%{
308
309class wxPyHtmlTagsModule : public wxHtmlTagsModule {
310public:
311 wxPyHtmlTagsModule(PyObject* thc) : wxHtmlTagsModule() {
312 m_tagHandlerClass = thc;
313 Py_INCREF(m_tagHandlerClass);
314 RegisterModule(this);
315 wxHtmlWinParser::AddModule(this);
316 }
317
318 void OnExit() {
da32eb53 319 bool blocked = wxPyBeginBlockThreads();
0f66a9f3
RD
320 Py_DECREF(m_tagHandlerClass);
321 m_tagHandlerClass = NULL;
dc2f8a65 322 for (size_t x=0; x < m_objArray.GetCount(); x++) {
0f66a9f3
RD
323 PyObject* obj = (PyObject*)m_objArray.Item(x);
324 Py_DECREF(obj);
325 }
da32eb53 326 wxPyEndBlockThreads(blocked);
0f66a9f3
RD
327 };
328
329 void FillHandlersTable(wxHtmlWinParser *parser) {
330 // Wave our magic wand... (if it works it's a miracle! ;-)
331
332 // First, make a new instance of the tag handler
da32eb53 333 bool blocked = wxPyBeginBlockThreads();
fb757066
RD
334 PyObject* arg = PyTuple_New(0);
335 PyObject* obj = PyObject_CallObject(m_tagHandlerClass, arg);
0f66a9f3 336 Py_DECREF(arg);
fb757066 337
0f66a9f3
RD
338 // now figure out where it's C++ object is...
339 wxPyHtmlWinTagHandler* thPtr;
fb757066 340 if (! wxPyConvertSwigPtr(obj, (void **)&thPtr, wxT("wxPyHtmlWinTagHandler"))) {
da32eb53 341 wxPyEndBlockThreads(blocked);
0f66a9f3 342 return;
fb757066 343 }
da32eb53 344 wxPyEndBlockThreads(blocked);
0f66a9f3
RD
345
346 // add it,
347 parser->AddTagHandler(thPtr);
348
349 // and track it.
350 m_objArray.Add(obj);
351 }
352
353private:
354 PyObject* m_tagHandlerClass;
355 wxArrayPtrVoid m_objArray;
356
357};
358%}
359
360
361
362%inline %{
363 void wxHtmlWinParser_AddTagHandler(PyObject* tagHandlerClass) {
364 // Dynamically create a new wxModule. Refcounts tagHandlerClass
365 // and adds itself to the wxModules list and to the wxHtmlWinParser.
366 new wxPyHtmlTagsModule(tagHandlerClass);
367 }
368%}
369
dc2f8a65 370
e166644c
RD
371//---------------------------------------------------------------------------
372//---------------------------------------------------------------------------
d14a1e28 373%newgroup
e166644c 374
dd116e73
RD
375
376// wxHtmlSelection is data holder with information about text selection.
377// Selection is defined by two positions (beginning and end of the selection)
378// and two leaf(!) cells at these positions.
379class wxHtmlSelection
380{
381public:
382 wxHtmlSelection();
383 ~wxHtmlSelection();
384
385 void Set(const wxPoint& fromPos, const wxHtmlCell *fromCell,
386 const wxPoint& toPos, const wxHtmlCell *toCell);
387 %name(SetCells)void Set(const wxHtmlCell *fromCell, const wxHtmlCell *toCell);
388
389 const wxHtmlCell *GetFromCell() const;
390 const wxHtmlCell *GetToCell() const;
391
392 // these values are in absolute coordinates:
393 const wxPoint& GetFromPos() const;
394 const wxPoint& GetToPos() const;
395
396 // these are From/ToCell's private data
397 const wxPoint& GetFromPrivPos() const;
398 const wxPoint& GetToPrivPos() const;
399 void SetFromPrivPos(const wxPoint& pos);
400 void SetToPrivPos(const wxPoint& pos);
401 void ClearPrivPos();
402
403 const bool IsEmpty() const;
404
405};
406
407
408enum wxHtmlSelectionState
409{
410 wxHTML_SEL_OUT, // currently rendered cell is outside the selection
411 wxHTML_SEL_IN, // ... is inside selection
412 wxHTML_SEL_CHANGING // ... is the cell on which selection state changes
413};
414
d14a1e28
RD
415
416
dd116e73
RD
417// Selection state is passed to wxHtmlCell::Draw so that it can render itself
418// differently e.g. when inside text selection or outside it.
419class wxHtmlRenderingState
420{
421public:
422 wxHtmlRenderingState();
423 ~wxHtmlRenderingState();
424
425 void SetSelectionState(wxHtmlSelectionState s);
426 wxHtmlSelectionState GetSelectionState() const;
427
428 void SetFgColour(const wxColour& c);
429 const wxColour& GetFgColour() const;
430 void SetBgColour(const wxColour& c);
431 const wxColour& GetBgColour() const;
432};
433
434
d14a1e28 435
dd116e73
RD
436// HTML rendering customization. This class is used when rendering wxHtmlCells
437// as a callback:
438class wxHtmlRenderingStyle
439{
440public:
441 virtual wxColour GetSelectedTextColour(const wxColour& clr) = 0;
442 virtual wxColour GetSelectedTextBgColour(const wxColour& clr) = 0;
443};
444
445// Standard style:
446class wxDefaultHtmlRenderingStyle : public wxHtmlRenderingStyle
447{
448public:
449 virtual wxColour GetSelectedTextColour(const wxColour& clr);
450 virtual wxColour GetSelectedTextBgColour(const wxColour& clr);
451};
452
453
454
455// Information given to cells when drawing them. Contains rendering state,
456// selection information and rendering style object that can be used to
457// customize the output.
458class wxHtmlRenderingInfo
459{
460public:
461 wxHtmlRenderingInfo();
462 ~wxHtmlRenderingInfo();
463
464 void SetSelection(wxHtmlSelection *s);
465 wxHtmlSelection *GetSelection() const;
466
467 void SetStyle(wxHtmlRenderingStyle *style);
468 wxHtmlRenderingStyle& GetStyle();
469
470 wxHtmlRenderingState& GetState();
471};
472
473//---------------------------------------------------------------------------
d14a1e28 474%newgroup
dd116e73 475
3ef86e32
RD
476
477enum
478{
479 wxHTML_FIND_EXACT = 1,
480 wxHTML_FIND_NEAREST_BEFORE = 2,
481 wxHTML_FIND_NEAREST_AFTER = 4
482};
483
484
9416aa89 485class wxHtmlCell : public wxObject {
e166644c
RD
486public:
487 wxHtmlCell();
488
e166644c
RD
489 int GetPosX();
490 int GetPosY();
491 int GetWidth();
492 int GetHeight();
493 int GetDescent();
0d267606
RD
494
495 // Returns the maximum possible length of the cell.
496 // Call Layout at least once before using GetMaxTotalWidth()
497 int GetMaxTotalWidth() const;
498
2678dd26
RD
499 const wxString& GetId() const;
500 void SetId(const wxString& id);
9c00cfa3 501 wxHtmlLinkInfo* GetLink(int x = 0, int y = 0);
e166644c 502 wxHtmlCell* GetNext();
9c00cfa3 503 wxHtmlContainerCell* GetParent();
3ef86e32
RD
504 wxHtmlCell* GetFirstChild() const;
505
506 // Returns cursor to be used when mouse is over the cell:
507 wxCursor GetCursor() const;
508
509 // Formatting cells are not visible on the screen, they only alter
510 // renderer's state.
511 bool IsFormattingCell() const;
512
513
9c00cfa3 514 void SetLink(const wxHtmlLinkInfo& link);
e166644c 515 void SetNext(wxHtmlCell *cell);
9c00cfa3
RD
516 void SetParent(wxHtmlContainerCell *p);
517 void SetPos(int x, int y);
e166644c 518 void Layout(int w);
dd116e73
RD
519 void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2,
520 wxHtmlRenderingInfo& info);
521 void DrawInvisible(wxDC& dc, int x, int y,
522 wxHtmlRenderingInfo& info);
e166644c 523 const wxHtmlCell* Find(int condition, const void* param);
dc2f8a65 524
1fded56b 525 bool AdjustPagebreak(int* INOUT);
dc2f8a65 526 void SetCanLiveOnPagebreak(bool can);
9c00cfa3 527
3ef86e32
RD
528 // Can the line be broken before this cell?
529 bool IsLinebreakAllowed() const;
530
dd9f7fea 531 // Returns True for simple == terminal cells, i.e. not composite ones.
3ef86e32
RD
532 // This if for internal usage only and may disappear in future versions!
533 bool IsTerminalCell() const;
534
535 // Find a cell inside this cell positioned at the given coordinates
536 // (relative to this's positions). Returns NULL if no such cell exists.
537 // The flag can be used to specify whether to look for terminal or
538 // nonterminal cells or both. In either case, returned cell is deepest
539 // cell in cells tree that contains [x,y].
540 wxHtmlCell *FindCellByPos(wxCoord x, wxCoord y,
541 unsigned flags = wxHTML_FIND_EXACT) const;
542
543 // Returns absolute position of the cell on HTML canvas
544 wxPoint GetAbsPos() const;
545
546 // Returns first (last) terminal cell inside this cell. It may return NULL,
547 // but it is rare -- only if there are no terminals in the tree.
548 wxHtmlCell *GetFirstTerminal() const ;
549 wxHtmlCell *GetLastTerminal() const ;
550
551 // Returns cell's depth, i.e. how far under the root cell it is
552 // (if it is the root, depth is 0)
553 unsigned GetDepth() const;
554
dd9f7fea 555 // Returns True if the cell appears before 'cell' in natural order of
3ef86e32 556 // cells (= as they are read). If cell A is (grand)parent of cell B,
dd9f7fea 557 // then both A.IsBefore(B) and B.IsBefore(A) always return True.
3ef86e32
RD
558 bool IsBefore(wxHtmlCell *cell) const;
559
560 // Converts the cell into text representation. If sel != NULL then
561 // only part of the cell inside the selection is converted.
562 wxString ConvertToText(wxHtmlSelection *sel) const;
e166644c
RD
563};
564
565
9416aa89
RD
566class wxHtmlWordCell : public wxHtmlCell
567{
568public:
569 wxHtmlWordCell(const wxString& word, wxDC& dc);
570};
571
572
e166644c
RD
573class wxHtmlContainerCell : public wxHtmlCell {
574public:
575 wxHtmlContainerCell(wxHtmlContainerCell *parent);
576
577 void InsertCell(wxHtmlCell *cell);
578 void SetAlignHor(int al);
579 int GetAlignHor();
580 void SetAlignVer(int al);
581 int GetAlignVer();
9d8bd15f 582 void SetIndent(int i, int what, int units = wxHTML_UNITS_PIXELS);
e166644c
RD
583 int GetIndent(int ind);
584 int GetIndentUnits(int ind);
585 void SetAlign(const wxHtmlTag& tag);
586 void SetWidthFloat(int w, int units);
587 %name(SetWidthFloatFromTag)void SetWidthFloat(const wxHtmlTag& tag);
9d8bd15f 588 void SetMinHeight(int h, int align = wxHTML_ALIGN_TOP);
e166644c 589 void SetBackgroundColour(const wxColour& clr);
1e4a197e 590 wxColour GetBackgroundColour();
e166644c 591 void SetBorder(const wxColour& clr1, const wxColour& clr2);
dd116e73
RD
592 wxHtmlCell* GetFirstChild();
593 %pragma(python) addtoclass = "GetFirstCell = GetFirstChild"
e166644c
RD
594};
595
596
597
9c00cfa3
RD
598class wxHtmlColourCell : public wxHtmlCell {
599public:
600 wxHtmlColourCell(wxColour clr, int flags = wxHTML_CLR_FOREGROUND);
601
602};
603
604
9416aa89
RD
605class wxHtmlFontCell : public wxHtmlCell
606{
607public:
608 wxHtmlFontCell(wxFont *font);
609};
610
e166644c
RD
611
612class wxHtmlWidgetCell : public wxHtmlCell {
613public:
614 wxHtmlWidgetCell(wxWindow* wnd, int w = 0);
615
616};
617
0f66a9f3 618
d14a1e28
RD
619
620
0f66a9f3 621//---------------------------------------------------------------------------
1e4a197e
RD
622// wxHtmlFilter
623//---------------------------------------------------------------------------
d14a1e28 624%newgroup
1e4a197e
RD
625
626
627%{ // here's the C++ version
628class wxPyHtmlFilter : public wxHtmlFilter {
629 DECLARE_ABSTRACT_CLASS(wxPyHtmlFilter);
630public:
631 wxPyHtmlFilter() : wxHtmlFilter() {}
632
dd9f7fea 633 // returns True if this filter is able to open&read given file
1e4a197e 634 virtual bool CanRead(const wxFSFile& file) const {
dd9f7fea 635 bool rval = False;
1e4a197e 636 bool found;
da32eb53 637 bool blocked = wxPyBeginBlockThreads();
1e4a197e 638 if ((found = wxPyCBH_findCallback(m_myInst, "CanRead"))) {
6d450e1a 639 PyObject* obj = wxPyMake_wxObject((wxFSFile*)&file,false); // cast away const
1e4a197e
RD
640 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj));
641 Py_DECREF(obj);
642 }
da32eb53 643 wxPyEndBlockThreads(blocked);
1e4a197e
RD
644 return rval;
645 }
646
647
648 // Reads given file and returns HTML document.
649 // Returns empty string if opening failed
650 virtual wxString ReadFile(const wxFSFile& file) const {
651 wxString rval;
652 bool found;
da32eb53 653 bool blocked = wxPyBeginBlockThreads();
1e4a197e 654 if ((found = wxPyCBH_findCallback(m_myInst, "ReadFile"))) {
6d450e1a 655 PyObject* obj = wxPyMake_wxObject((wxFSFile*)&file,false); // cast away const
1e4a197e
RD
656 PyObject* ro;
657 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", obj));
658 Py_DECREF(obj);
659 if (ro) {
660 rval = Py2wxString(ro);
661 Py_DECREF(ro);
662 }
663 }
da32eb53 664 wxPyEndBlockThreads(blocked);
1e4a197e
RD
665 return rval;
666 }
667
668 PYPRIVATE;
669};
670
671IMPLEMENT_ABSTRACT_CLASS(wxPyHtmlFilter, wxHtmlFilter);
672%}
673
674
675// And now the version seen by SWIG
676
d14a1e28 677%name(HtmlFilter) class wxPyHtmlFilter : public wxObject {
1e4a197e 678public:
2b9048c5 679 %pythonAppend wxPyHtmlFilter "self._setCallbackInfo(self, HtmlFilter)"
1e4a197e
RD
680 wxPyHtmlFilter();
681
682 void _setCallbackInfo(PyObject* self, PyObject* _class);
1e4a197e
RD
683};
684
685
686// TODO: wxHtmlFilterHTML
687
688
0f66a9f3 689//---------------------------------------------------------------------------
1e4a197e 690// wxHtmlWindow
4b123bb9 691//---------------------------------------------------------------------------
d14a1e28 692%newgroup
4b123bb9 693
0f66a9f3
RD
694%{
695class wxPyHtmlWindow : public wxHtmlWindow {
cdf14688 696 DECLARE_ABSTRACT_CLASS(wxPyHtmlWindow);
0f66a9f3
RD
697public:
698 wxPyHtmlWindow(wxWindow *parent, wxWindowID id = -1,
699 const wxPoint& pos = wxDefaultPosition,
700 const wxSize& size = wxDefaultSize,
3ef86e32 701 long style = wxHW_DEFAULT_STYLE,
1e4a197e 702 const wxString& name = wxPyHtmlWindowNameStr)
0f66a9f3 703 : wxHtmlWindow(parent, id, pos, size, style, name) {};
7b7ac0ab 704 wxPyHtmlWindow() : wxHtmlWindow() {};
0f66a9f3 705
e5d41db0
RD
706 bool ScrollToAnchor(const wxString& anchor) {
707 return wxHtmlWindow::ScrollToAnchor(anchor);
708 }
709
710 bool HasAnchor(const wxString& anchor) {
711 const wxHtmlCell *c = m_Cell->Find(wxHTML_COND_ISANCHOR, &anchor);
712 return c!=NULL;
713 }
714
c8bc03c3
RD
715 void OnLinkClicked(const wxHtmlLinkInfo& link);
716 void base_OnLinkClicked(const wxHtmlLinkInfo& link);
9c00cfa3 717
e5d41db0 718 wxHtmlOpeningStatus OnOpeningURL(wxHtmlURLType type,
c6c593e8
RD
719 const wxString& url,
720 wxString *redirect) const;
721
9c00cfa3 722 DEC_PYCALLBACK__STRING(OnSetTitle);
0122b7e3
RD
723 DEC_PYCALLBACK__CELLINTINT(OnCellMouseHover);
724 DEC_PYCALLBACK__CELLINTINTME(OnCellClicked);
0f66a9f3
RD
725 PYPRIVATE;
726};
727
cdf14688 728IMPLEMENT_ABSTRACT_CLASS( wxPyHtmlWindow, wxHtmlWindow );
9c00cfa3 729IMP_PYCALLBACK__STRING(wxPyHtmlWindow, wxHtmlWindow, OnSetTitle);
0122b7e3
RD
730IMP_PYCALLBACK__CELLINTINT(wxPyHtmlWindow, wxHtmlWindow, OnCellMouseHover);
731IMP_PYCALLBACK__CELLINTINTME(wxPyHtmlWindow, wxHtmlWindow, OnCellClicked);
732
0f66a9f3 733
9416aa89 734void wxPyHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link) {
19a97bd6 735 bool found;
da32eb53 736 bool blocked = wxPyBeginBlockThreads();
0122b7e3 737 if ((found = wxPyCBH_findCallback(m_myInst, "OnLinkClicked"))) {
1e4a197e 738 PyObject* obj = wxPyConstructObject((void*)&link, wxT("wxHtmlLinkInfo"), 0);
1e7ecb7b 739 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj));
de20db99 740 Py_DECREF(obj);
9c00cfa3 741 }
da32eb53 742 wxPyEndBlockThreads(blocked);
19a97bd6 743 if (! found)
9c00cfa3 744 wxHtmlWindow::OnLinkClicked(link);
9c00cfa3 745}
c8bc03c3 746void wxPyHtmlWindow::base_OnLinkClicked(const wxHtmlLinkInfo& link) {
9c00cfa3
RD
747 wxHtmlWindow::OnLinkClicked(link);
748}
0122b7e3 749
c6c593e8
RD
750
751wxHtmlOpeningStatus wxPyHtmlWindow::OnOpeningURL(wxHtmlURLType type,
752 const wxString& url,
753 wxString *redirect) const {
754 bool found;
755 wxHtmlOpeningStatus rval;
da32eb53 756 bool blocked = wxPyBeginBlockThreads();
c6c593e8
RD
757 if ((found = wxPyCBH_findCallback(m_myInst, "OnOpeningURL"))) {
758 PyObject* ro;
a66212dc
RD
759 PyObject* s = wx2PyString(url);
760 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(iO)", type, s));
761 Py_DECREF(s);
c6c593e8
RD
762 if (PyString_Check(ro)
763#if PYTHON_API_VERSION >= 1009
764 || PyUnicode_Check(ro)
765#endif
766 ) {
a541c325 767 *redirect = Py2wxString(ro);
c6c593e8
RD
768 rval = wxHTML_REDIRECT;
769 }
770 else {
771 PyObject* num = PyNumber_Int(ro);
772 rval = (wxHtmlOpeningStatus)PyInt_AsLong(num);
773 Py_DECREF(num);
774 }
775 Py_DECREF(ro);
776 }
da32eb53 777 wxPyEndBlockThreads(blocked);
c6c593e8
RD
778 if (! found)
779 rval = wxHtmlWindow::OnOpeningURL(type, url, redirect);
780 return rval;
781}
782
783
0f66a9f3
RD
784%}
785
786
95837b4d 787
ab1f7d2a
RD
788MustHaveApp(wxPyHtmlWindow);
789
d14a1e28 790%name(HtmlWindow) class wxPyHtmlWindow : public wxScrolledWindow {
0f66a9f3 791public:
2b9048c5
RD
792 %pythonAppend wxPyHtmlWindow "self._setCallbackInfo(self, HtmlWindow); self._setOORInfo(self)"
793 %pythonAppend wxPyHtmlWindow() ""
b39c3fa0 794 %typemap(out) wxPyHtmlWindow*; // turn off this typemap
d14a1e28 795
0f66a9f3 796 wxPyHtmlWindow(wxWindow *parent, int id = -1,
d14a1e28
RD
797 const wxPoint& pos = wxDefaultPosition,
798 const wxSize& size = wxDefaultSize,
3ef86e32 799 int style=wxHW_DEFAULT_STYLE,
137b5242 800 const wxString& name = wxPyHtmlWindowNameStr);
d14a1e28 801 %name(PreHtmlWindow)wxPyHtmlWindow();
7b7ac0ab 802
b39c3fa0
RD
803 // Turn it back on again
804 %typemap(out) wxPyHtmlWindow* { $result = wxPyMake_wxObject($1, $owner); }
805
7b7ac0ab 806 bool Create(wxWindow *parent, int id = -1,
d14a1e28
RD
807 const wxPoint& pos = wxDefaultPosition,
808 const wxSize& size = wxDefaultSize,
fc51b8c3 809 int style=wxHW_SCROLLBAR_AUTO,
137b5242 810 const wxString& name = wxPyHtmlWindowNameStr);
7b7ac0ab 811
0f66a9f3 812
0122b7e3 813 void _setCallbackInfo(PyObject* self, PyObject* _class);
0f66a9f3 814
d14a1e28 815
1e4a197e
RD
816 // Set HTML page and display it. !! source is HTML document itself,
817 // it is NOT address/filename of HTML document. If you want to
818 // specify document location, use LoadPage() istead
dd9f7fea 819 // Return value : False if an error occured, True otherwise
7a446686 820 bool SetPage(const wxString& source);
1e4a197e
RD
821
822 // Load HTML page from given location. Location can be either
823 // a) /usr/wxGTK2/docs/html/wx.htm
824 // b) http://www.somewhere.uk/document.htm
825 // c) ftp://ftp.somesite.cz/pub/something.htm
826 // In case there is no prefix (http:,ftp:), the method
827 // will try to find it itself (1. local file, then http or ftp)
828 // After the page is loaded, the method calls SetPage() to display it.
829 // Note : you can also use path relative to previously loaded page
830 // Return value : same as SetPage
7a446686 831 bool LoadPage(const wxString& location);
1e4a197e 832
9cbf6f6e 833 // Loads HTML page from file
1fded56b 834 bool LoadFile(const wxString& filename);
9cbf6f6e 835
1e4a197e 836 // Append to current page
de112a55 837 bool AppendToPage(const wxString& source);
1e4a197e
RD
838
839 // Returns full location of opened page
0f66a9f3 840 wxString GetOpenedPage();
1e4a197e
RD
841
842 // Returns anchor within opened page
7a446686 843 wxString GetOpenedAnchor();
1e4a197e
RD
844
845 // Returns <TITLE> of opened page or empty string otherwise
7a446686
RD
846 wxString GetOpenedPageTitle();
847
1e4a197e
RD
848 // Sets frame in which page title will be displayed. Format is format of
849 // frame title, e.g. "HtmlHelp : %s". It must contain exactly one %s
137b5242 850 void SetRelatedFrame(wxFrame* frame, const wxString& format);
0f66a9f3 851 wxFrame* GetRelatedFrame();
1e4a197e
RD
852
853 // After(!) calling SetRelatedFrame, this sets statusbar slot where messages
854 // will be displayed. Default is -1 = no messages.
0f66a9f3 855 void SetRelatedStatusBar(int bar);
f6bcfd97 856
1e4a197e 857 // Sets fonts to be used when displaying HTML page.
d14a1e28 858 %extend {
9cbf6f6e
RD
859 void SetFonts(wxString normal_face, wxString fixed_face, PyObject* sizes=NULL) {
860 int* temp = NULL;
861 if (sizes) temp = int_LIST_helper(sizes);
862 self->SetFonts(normal_face, fixed_face, temp);
863 if (temp)
f6bcfd97 864 delete [] temp;
f6bcfd97
BP
865 }
866 }
867
36c8c471
RD
868 DocDeclStr(
869 void, SetTitle(const wxString& title),
d07d2bc9 870 "", "");
1e4a197e
RD
871
872 // Sets space between text and window borders.
0f66a9f3 873 void SetBorders(int b);
1e4a197e
RD
874
875 // Saves custom settings into cfg config. it will use the path 'path'
876 // if given, otherwise it will save info into currently selected path.
877 // saved values : things set by SetFonts, SetBorders.
137b5242
RD
878 void ReadCustomization(wxConfigBase *cfg, wxString path = wxPyEmptyString);
879 void WriteCustomization(wxConfigBase *cfg, wxString path = wxPyEmptyString);
1e4a197e
RD
880
881 // Goes to previous/next page (in browsing history)
dd9f7fea 882 // Returns True if successful, False otherwise
0f66a9f3
RD
883 bool HistoryBack();
884 bool HistoryForward();
7a446686
RD
885 bool HistoryCanBack();
886 bool HistoryCanForward();
1e4a197e
RD
887
888 // Resets History
0f66a9f3 889 void HistoryClear();
1e4a197e
RD
890
891 // Returns pointer to conteiners/cells structure.
a65c6e14 892 wxHtmlContainerCell* GetInternalRepresentation();
1e4a197e
RD
893
894 // Returns a pointer to the parser.
e166644c
RD
895 wxHtmlWinParser* GetParser();
896
e5d41db0
RD
897 bool ScrollToAnchor(const wxString& anchor);
898 bool HasAnchor(const wxString& anchor);
899
1e4a197e
RD
900 //Adds input filter
901 static void AddFilter(wxPyHtmlFilter *filter);
902
927d7cfa
RD
903 // Helper functions to select parts of page:
904 void SelectWord(const wxPoint& pos);
905 void SelectLine(const wxPoint& pos);
906 void SelectAll();
1e4a197e 907
31ad423e
RD
908 // Convert selection to text:
909 wxString SelectionToText();
910
911 // Converts current page to text:
912 wxString ToText();
927d7cfa 913
c8bc03c3 914 void base_OnLinkClicked(const wxHtmlLinkInfo& link);
137b5242 915 void base_OnSetTitle(const wxString& title);
0122b7e3
RD
916 void base_OnCellMouseHover(wxHtmlCell *cell, wxCoord x, wxCoord y);
917 void base_OnCellClicked(wxHtmlCell *cell,
918 wxCoord x, wxCoord y,
919 const wxMouseEvent& event);
880715c9
RD
920
921 static wxVisualAttributes
922 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
4b123bb9
HH
923};
924
5ca24bf4 925
5ca24bf4 926
d14a1e28 927
dc2f8a65
RD
928//---------------------------------------------------------------------------
929//---------------------------------------------------------------------------
d14a1e28 930%newgroup
dc2f8a65
RD
931
932
ab1f7d2a
RD
933MustHaveApp(wxHtmlDCRenderer);
934
9416aa89 935class wxHtmlDCRenderer : public wxObject {
dc2f8a65
RD
936public:
937 wxHtmlDCRenderer();
938 ~wxHtmlDCRenderer();
939
940 void SetDC(wxDC *dc, int maxwidth);
941 void SetSize(int width, int height);
942 void SetHtmlText(const wxString& html,
137b5242 943 const wxString& basepath = wxPyEmptyString,
dd9f7fea 944 bool isdir = True);
1fded56b 945 // Sets fonts to be used when displaying HTML page. (if size null then default sizes used).
d14a1e28 946 %extend {
9cbf6f6e
RD
947 void SetFonts(wxString normal_face, wxString fixed_face, PyObject* sizes=NULL) {
948 int* temp = NULL;
949 if (sizes) temp = int_LIST_helper(sizes);
950 self->SetFonts(normal_face, fixed_face, temp);
951 if (temp)
952 delete [] temp;
953 }
954 }
dd9f7fea 955 int Render(int x, int y, int from = 0, int dont_render = False, int to = INT_MAX,
3ef86e32
RD
956 //int *known_pagebreaks = NULL, int number_of_pages = 0
957 int* choices=NULL, int LCOUNT = 0
958 );
dc2f8a65
RD
959 int GetTotalHeight();
960 // returns total height of the html document
961 // (compare Render's return value with this)
962};
963
d14a1e28 964
dc2f8a65
RD
965enum {
966 wxPAGE_ODD,
967 wxPAGE_EVEN,
968 wxPAGE_ALL
969};
970
971
ab1f7d2a
RD
972MustHaveApp(wxHtmlPrintout);
973
dc2f8a65
RD
974class wxHtmlPrintout : public wxPyPrintout {
975public:
137b5242 976 wxHtmlPrintout(const wxString& title = wxPyHtmlPrintoutTitleStr);
f3d9dc1d 977 //~wxHtmlPrintout(); wxPrintPreview object takes ownership...
dc2f8a65
RD
978
979 void SetHtmlText(const wxString& html,
137b5242 980 const wxString &basepath = wxPyEmptyString,
dd9f7fea 981 bool isdir = True);
dc2f8a65
RD
982 void SetHtmlFile(const wxString &htmlfile);
983 void SetHeader(const wxString& header, int pg = wxPAGE_ALL);
984 void SetFooter(const wxString& footer, int pg = wxPAGE_ALL);
d14a1e28 985
1fded56b 986 // Sets fonts to be used when displaying HTML page. (if size null then default sizes used).
d14a1e28 987 %extend {
9cbf6f6e
RD
988 void SetFonts(wxString normal_face, wxString fixed_face, PyObject* sizes=NULL) {
989 int* temp = NULL;
990 if (sizes) temp = int_LIST_helper(sizes);
991 self->SetFonts(normal_face, fixed_face, temp);
992 if (temp)
993 delete [] temp;
994 }
995 }
dc2f8a65
RD
996 void SetMargins(float top = 25.2, float bottom = 25.2,
997 float left = 25.2, float right = 25.2,
998 float spaces = 5);
3ef86e32
RD
999
1000 // Adds input filter
1001 static void AddFilter(wxHtmlFilter *filter);
1002
1003 // Cleanup
1004 static void CleanUpStatics();
dc2f8a65
RD
1005};
1006
1007
1008
ab1f7d2a
RD
1009MustHaveApp(wxHtmlEasyPrinting);
1010
9416aa89 1011class wxHtmlEasyPrinting : public wxObject {
dc2f8a65 1012public:
137b5242 1013 wxHtmlEasyPrinting(const wxString& name = wxPyHtmlPrintingTitleStr,
3ef86e32 1014 wxWindow *parentWindow = NULL);
dc2f8a65
RD
1015 ~wxHtmlEasyPrinting();
1016
1017 void PreviewFile(const wxString &htmlfile);
137b5242 1018 void PreviewText(const wxString &htmltext, const wxString& basepath = wxPyEmptyString);
dc2f8a65 1019 void PrintFile(const wxString &htmlfile);
137b5242 1020 void PrintText(const wxString &htmltext, const wxString& basepath = wxPyEmptyString);
dc2f8a65
RD
1021 void PrinterSetup();
1022 void PageSetup();
1023 void SetHeader(const wxString& header, int pg = wxPAGE_ALL);
1024 void SetFooter(const wxString& footer, int pg = wxPAGE_ALL);
1025
d14a1e28 1026 %extend {
9cbf6f6e
RD
1027 void SetFonts(wxString normal_face, wxString fixed_face, PyObject* sizes=NULL) {
1028 int* temp = NULL;
1029 if (sizes) temp = int_LIST_helper(sizes);
1030 self->SetFonts(normal_face, fixed_face, temp);
1031 if (temp)
1032 delete [] temp;
1033 }
1034 }
1035
dc2f8a65
RD
1036 wxPrintData *GetPrintData() {return m_PrintData;}
1037 wxPageSetupDialogData *GetPageSetupData() {return m_PageSetupData;}
1038
1039};
1040
1041
0f66a9f3
RD
1042//---------------------------------------------------------------------------
1043//---------------------------------------------------------------------------
d14a1e28 1044%newgroup
5ca24bf4 1045
4b123bb9 1046
d14a1e28
RD
1047class wxHtmlBookRecord {
1048public:
1049 wxHtmlBookRecord(const wxString& bookfile, const wxString& basepath,
1050 const wxString& title, const wxString& start);
4b123bb9 1051
d14a1e28
RD
1052 wxString GetBookFile();
1053 wxString GetTitle();
1054 wxString GetStart();
1055 wxString GetBasePath();
1056
1057 void SetContentsRange(int start, int end);
1058 int GetContentsStart();
1059 int GetContentsEnd();
4b123bb9 1060
d14a1e28
RD
1061 void SetTitle(const wxString& title);
1062 void SetBasePath(const wxString& path);
1063 void SetStart(const wxString& start);
1064
1065 wxString GetFullPath(const wxString &page) const;
1066};
1067
1068//---------------------------------------------------------------------------
0f66a9f3 1069
d14a1e28
RD
1070struct wxHtmlContentsItem
1071{
1072 %extend {
1073 int GetLevel() { return self->m_Level; }
1074 int GetID() { return self->m_ID; }
1075 wxString GetName() { return self->m_Name; }
1076 wxString GetPage() { return self->m_Page; }
1077 wxHtmlBookRecord* GetBook() { return self->m_Book; }
1078 }
1079};
1080
1081//---------------------------------------------------------------------------
1082
1083class wxHtmlSearchStatus
1084{
1085public:
1086 //wxHtmlSearchStatus(wxHtmlHelpData* base, const wxString& keyword,
1087 // const wxString& book = wxPyEmptyString);
1088 bool Search();
1089 bool IsActive();
1090 int GetCurIndex();
1091 int GetMaxIndex();
1092 const wxString& GetName();
1093 wxHtmlContentsItem* GetContentsItem();
1094};
1095
1096//---------------------------------------------------------------------------
1097
1098class wxHtmlHelpData {
1099public:
1100 wxHtmlHelpData();
1101 ~wxHtmlHelpData();
1102
1103 void SetTempDir(const wxString& path);
1104 bool AddBook(const wxString& book);
1105// bool AddBookParam(const wxString& title, const wxString& contfile,
1106// const wxString& indexfile=wxPyEmptyString,
1107// const wxString& deftopic=wxPyEmptyString,
1108// const wxString& path=wxPyEmptyString);
1109
1110 wxString FindPageByName(const wxString& page);
1111 wxString FindPageById(int id);
1112
1113 // TODO: this one needs fixed...
1114 const wxHtmlBookRecArray& GetBookRecArray();
1115
1116 wxHtmlContentsItem* GetContents();
1117 int GetContentsCnt();
1118 wxHtmlContentsItem* GetIndex();
1119 int GetIndexCnt();
1120};
1121
1122//---------------------------------------------------------------------------
1123
ab1f7d2a
RD
1124MustHaveApp(wxHtmlHelpFrame);
1125
d14a1e28
RD
1126class wxHtmlHelpFrame : public wxFrame {
1127public:
2b9048c5 1128 %pythonAppend wxHtmlHelpFrame "self._setOORInfo(self)"
d14a1e28
RD
1129
1130 wxHtmlHelpFrame(wxWindow* parent, int wxWindowID,
1131 const wxString& title = wxPyEmptyString,
1132 int style = wxHF_DEFAULTSTYLE, wxHtmlHelpData* data = NULL);
1133
1134 wxHtmlHelpData* GetData();
1135 void SetTitleFormat(const wxString& format);
1136 void Display(const wxString& x);
1137 %name(DisplayID) void Display(int id);
1138 void DisplayContents();
1139 void DisplayIndex();
1140 bool KeywordSearch(const wxString& keyword);
1141 void UseConfig(wxConfigBase *config, const wxString& rootpath = wxPyEmptyString);
1142 void ReadCustomization(wxConfigBase *cfg, wxString path = wxPyEmptyString);
1143 void WriteCustomization(wxConfigBase *cfg, wxString path = wxPyEmptyString);
1144};
1145
1146
1147//---------------------------------------------------------------------------
1148
1149
1150enum {
1151 wxHF_TOOLBAR,
1152 wxHF_FLATTOOLBAR,
1153 wxHF_CONTENTS,
1154 wxHF_INDEX,
1155 wxHF_SEARCH,
1156 wxHF_BOOKMARKS,
1157 wxHF_OPENFILES,
1158 wxHF_PRINT,
1159 wxHF_DEFAULTSTYLE,
1160};
1161
1162
ab1f7d2a
RD
1163MustHaveApp(wxHtmlHelpController);
1164
d14a1e28
RD
1165class wxHtmlHelpController : public wxEvtHandler {
1166public:
2b9048c5 1167 %pythonAppend wxHtmlHelpController "self._setOORInfo(self)"
d14a1e28
RD
1168
1169 wxHtmlHelpController(int style = wxHF_DEFAULTSTYLE);
1170 ~wxHtmlHelpController();
1171
1172 void SetTitleFormat(const wxString& format);
1173 void SetTempDir(const wxString& path);
dd9f7fea 1174 bool AddBook(const wxString& book, int show_wait_msg = False);
d14a1e28
RD
1175 void Display(const wxString& x);
1176 %name(DisplayID) void Display(int id);
1177 void DisplayContents();
1178 void DisplayIndex();
1179 bool KeywordSearch(const wxString& keyword);
1180 void UseConfig(wxConfigBase *config, const wxString& rootpath = wxPyEmptyString);
1181 void ReadCustomization(wxConfigBase *cfg, wxString path = wxPyEmptyString);
1182 void WriteCustomization(wxConfigBase *cfg, wxString path = wxPyEmptyString);
1183 wxHtmlHelpFrame* GetFrame();
1184};
1185
1186
1187
1188
1189//---------------------------------------------------------------------------
1190%init %{
1191 wxPyPtrTypeMap_Add("wxHtmlTagHandler", "wxPyHtmlTagHandler");
9416aa89 1192 wxPyPtrTypeMap_Add("wxHtmlWinTagHandler", "wxPyHtmlWinTagHandler");
d14a1e28
RD
1193 wxPyPtrTypeMap_Add("wxHtmlWindow", "wxPyHtmlWindow");
1194 wxPyPtrTypeMap_Add("wxHtmlFilter", "wxPyHtmlFilter");
4b123bb9 1195%}
d14a1e28
RD
1196//---------------------------------------------------------------------------
1197//---------------------------------------------------------------------------
4b123bb9 1198
e166644c 1199
e166644c 1200