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