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