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