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