]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/html.i
always let the multiline text control process the Enter key presses
[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//
7// Created: 25-nov-1998
8// RCS-ID: $Id$
9// Copyright: (c) 1998 by Total Control Software
10// Licence: wxWindows license
11/////////////////////////////////////////////////////////////////////////////
12
13
14%module html
15
16%{
1e7ecb7b 17#include "export.h"
4b123bb9 18#include <wx/html/htmlwin.h>
dc2f8a65 19#include <wx/html/htmprint.h>
4b123bb9
HH
20#include <wx/image.h>
21#include <wx/fs_zip.h>
22#include <wx/fs_inet.h>
5ca24bf4 23#include <wx/wfstream.h>
dc2f8a65
RD
24
25#include "printfw.h"
4b123bb9
HH
26%}
27
28//---------------------------------------------------------------------------
29
30%include typemaps.i
31%include my_typemaps.i
32
33%extern wx.i
34%extern windows.i
35%extern _defs.i
36%extern events.i
5ca24bf4
HH
37%extern controls.i
38%extern controls2.i
dc2f8a65 39%extern printfw.i
4b123bb9 40
0f66a9f3
RD
41%extern utils.i
42
2f90df85 43%pragma(python) code = "import wx"
4b123bb9 44
4b123bb9 45
137b5242
RD
46//----------------------------------------------------------------------
47
48%{
49 // Put some wx default wxChar* values into wxStrings.
50 static const wxChar* wxHtmlWindowNameStr = wxT("htmlWindow");
51 DECLARE_DEF_STRING(HtmlWindowNameStr);
52
53 static const wxChar* wxHtmlPrintoutTitleStr = wxT("Printout");
54 DECLARE_DEF_STRING(HtmlPrintoutTitleStr);
55
56 static const wxChar* wxHtmlPrintingTitleStr = wxT("Printing");
57 DECLARE_DEF_STRING(HtmlPrintingTitleStr);
58
59 static const wxString wxPyEmptyString(wxT(""));
60%}
61
0f66a9f3 62//---------------------------------------------------------------------------
e166644c
RD
63
64enum {
9d8bd15f
RD
65 wxHTML_ALIGN_LEFT,
66 wxHTML_ALIGN_CENTER,
67 wxHTML_ALIGN_RIGHT,
68 wxHTML_ALIGN_BOTTOM,
69 wxHTML_ALIGN_TOP,
70
71 wxHTML_CLR_FOREGROUND,
72 wxHTML_CLR_BACKGROUND,
73
74 wxHTML_UNITS_PIXELS,
75 wxHTML_UNITS_PERCENT,
76
77 wxHTML_INDENT_LEFT,
78 wxHTML_INDENT_RIGHT,
79 wxHTML_INDENT_TOP,
80 wxHTML_INDENT_BOTTOM,
81
82 wxHTML_INDENT_HORIZONTAL,
83 wxHTML_INDENT_VERTICAL,
84 wxHTML_INDENT_ALL,
85
86 wxHTML_COND_ISANCHOR,
87 wxHTML_COND_ISIMAGEMAP,
88 wxHTML_COND_USER,
e166644c
RD
89};
90
91
c6c593e8
RD
92enum {
93 wxHW_SCROLLBAR_NEVER,
94 wxHW_SCROLLBAR_AUTO,
95};
96
97
98// enums for wxHtmlWindow::OnOpeningURL
99enum wxHtmlOpeningStatus
100{
101 wxHTML_OPEN,
102 wxHTML_BLOCK,
103 wxHTML_REDIRECT
104};
105
106enum wxHtmlURLType
107{
108 wxHTML_URL_PAGE,
109 wxHTML_URL_IMAGE,
110 wxHTML_URL_OTHER
111};
112
9c00cfa3
RD
113//---------------------------------------------------------------------------
114
9416aa89 115class wxHtmlLinkInfo : public wxObject {
9c00cfa3 116public:
137b5242 117 wxHtmlLinkInfo(const wxString& href, const wxString& target = wxPyEmptyString);
9c00cfa3
RD
118 wxString GetHref();
119 wxString GetTarget();
c8bc03c3
RD
120 wxMouseEvent* GetEvent();
121 wxHtmlCell* GetHtmlCell();
7a446686
RD
122
123 void SetEvent(const wxMouseEvent *e);
124 void SetHtmlCell(const wxHtmlCell * e);
9c00cfa3
RD
125};
126
0f66a9f3
RD
127//---------------------------------------------------------------------------
128
9416aa89 129class wxHtmlTag : public wxObject {
0f66a9f3 130public:
e166644c 131 // Never need to create a new tag from Python...
0f66a9f3
RD
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();
0f66a9f3
RD
142 bool HasEnding();
143 int GetBeginPos();
144 int GetEndPos1();
145 int GetEndPos2();
146};
147
148
149//---------------------------------------------------------------------------
150
9416aa89 151class wxHtmlParser : public wxObject {
0f66a9f3
RD
152public:
153 // wxHtmlParser(); This is an abstract base class...
154
155 void SetFS(wxFileSystem *fs);
156 wxFileSystem* GetFS();
157 wxObject* Parse(const wxString& source);
158 void InitParser(const wxString& source);
159 void DoneParser();
160 void DoParsing(int begin_pos, int end_pos);
161 // wxObject* GetProduct();
162 void AddTagHandler(wxHtmlTagHandler *handler);
163 wxString* GetSource();
dc2f8a65
RD
164 void PushTagHandler(wxHtmlTagHandler* handler, wxString tags);
165 void PopTagHandler();
0f66a9f3 166
c6c593e8 167 // virtual wxFSFile *OpenURL(wxHtmlURLType type, const wxString& url) const;
0f66a9f3
RD
168
169 // void AddText(const char* txt) = 0;
170 // void AddTag(const wxHtmlTag& tag);
171};
172
173
174//---------------------------------------------------------------------------
175
176class wxHtmlWinParser : public wxHtmlParser {
177public:
ce914f73 178 wxHtmlWinParser(wxHtmlWindow *wnd = NULL);
0f66a9f3
RD
179
180 void SetDC(wxDC *dc);
181 wxDC* GetDC();
182 int GetCharHeight();
183 int GetCharWidth();
6c5ae2d2 184 wxHtmlWindow* GetWindow();
f6bcfd97
BP
185 //void SetFonts(wxString normal_face, wxString fixed_face, int *LIST);
186 %addmethods {
187 void SetFonts(wxString normal_face, wxString fixed_face, PyObject* sizes) {
188 int* temp = int_LIST_helper(sizes);
189 if (temp) {
190 self->SetFonts(normal_face, fixed_face, temp);
191 delete [] temp;
192 }
193 }
194 }
0f66a9f3
RD
195
196 wxHtmlContainerCell* GetContainer();
197 wxHtmlContainerCell* OpenContainer();
dc2f8a65 198 wxHtmlContainerCell *SetContainer(wxHtmlContainerCell *c);
0f66a9f3 199 wxHtmlContainerCell* CloseContainer();
dc2f8a65 200
0f66a9f3
RD
201 int GetFontSize();
202 void SetFontSize(int s);
203 int GetFontBold();
204 void SetFontBold(int x);
205 int GetFontItalic();
206 void SetFontItalic(int x);
207 int GetFontUnderlined();
208 void SetFontUnderlined(int x);
209 int GetFontFixed();
210 void SetFontFixed(int x);
211 int GetAlign();
212 void SetAlign(int a);
c5943253 213 wxColour GetLinkColor();
0f66a9f3 214 void SetLinkColor(const wxColour& clr);
c5943253 215 wxColour GetActualColor();
0f66a9f3 216 void SetActualColor(const wxColour& clr);
0f66a9f3
RD
217 void SetLink(const wxString& link);
218 wxFont* CreateCurrentFont();
9c00cfa3
RD
219 wxHtmlLinkInfo GetLink();
220
0f66a9f3
RD
221};
222
223
224
225//---------------------------------------------------------------------------
226
227%{
228class wxPyHtmlTagHandler : public wxHtmlTagHandler {
9416aa89 229 DECLARE_DYNAMIC_CLASS(wxPyHtmlTagHandler);
0f66a9f3
RD
230public:
231 wxPyHtmlTagHandler() : wxHtmlTagHandler() {};
232
233 wxHtmlParser* GetParser() { return m_Parser; }
234 void ParseInner(const wxHtmlTag& tag) { wxHtmlTagHandler::ParseInner(tag); }
235
236 DEC_PYCALLBACK_STRING__pure(GetSupportedTags);
237 DEC_PYCALLBACK_BOOL_TAG_pure(HandleTag);
238
239 PYPRIVATE;
240};
241
9416aa89
RD
242IMPLEMENT_DYNAMIC_CLASS(wxPyHtmlTagHandler, wxHtmlTagHandler);
243
0f66a9f3
RD
244IMP_PYCALLBACK_STRING__pure(wxPyHtmlTagHandler, wxHtmlTagHandler, GetSupportedTags);
245IMP_PYCALLBACK_BOOL_TAG_pure(wxPyHtmlTagHandler, wxHtmlTagHandler, HandleTag);
0f66a9f3
RD
246%}
247
248
9416aa89 249%name(wxHtmlTagHandler) class wxPyHtmlTagHandler : public wxObject {
0f66a9f3
RD
250public:
251 wxPyHtmlTagHandler();
252
0122b7e3
RD
253 void _setCallbackInfo(PyObject* self, PyObject* _class);
254 %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxHtmlTagHandler)"
0f66a9f3
RD
255
256 void SetParser(wxHtmlParser *parser);
257 wxHtmlParser* GetParser();
258 void ParseInner(const wxHtmlTag& tag);
259};
260
261
262//---------------------------------------------------------------------------
263
264%{
265class wxPyHtmlWinTagHandler : public wxHtmlWinTagHandler {
9416aa89 266 DECLARE_DYNAMIC_CLASS(wxPyHtmlWinTagHandler);
0f66a9f3
RD
267public:
268 wxPyHtmlWinTagHandler() : wxHtmlWinTagHandler() {};
269
270 wxHtmlWinParser* GetParser() { return m_WParser; }
271 void ParseInner(const wxHtmlTag& tag)
272 { wxHtmlWinTagHandler::ParseInner(tag); }
273
274 DEC_PYCALLBACK_STRING__pure(GetSupportedTags);
275 DEC_PYCALLBACK_BOOL_TAG_pure(HandleTag);
276
277 PYPRIVATE;
278};
279
9416aa89
RD
280IMPLEMENT_DYNAMIC_CLASS( wxPyHtmlWinTagHandler, wxHtmlWinTagHandler);
281
0f66a9f3
RD
282IMP_PYCALLBACK_STRING__pure(wxPyHtmlWinTagHandler, wxHtmlWinTagHandler, GetSupportedTags);
283IMP_PYCALLBACK_BOOL_TAG_pure(wxPyHtmlWinTagHandler, wxHtmlWinTagHandler, HandleTag);
0f66a9f3
RD
284%}
285
286
287%name(wxHtmlWinTagHandler) class wxPyHtmlWinTagHandler : public wxPyHtmlTagHandler {
288public:
289 wxPyHtmlWinTagHandler();
290
0122b7e3
RD
291 void _setCallbackInfo(PyObject* self, PyObject* _class);
292 %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxHtmlWinTagHandler)"
0f66a9f3
RD
293
294 void SetParser(wxHtmlParser *parser);
295 wxHtmlWinParser* GetParser();
296 void ParseInner(const wxHtmlTag& tag);
297};
298
299
300//---------------------------------------------------------------------------
301
302%{
303
304class wxPyHtmlTagsModule : public wxHtmlTagsModule {
305public:
306 wxPyHtmlTagsModule(PyObject* thc) : wxHtmlTagsModule() {
307 m_tagHandlerClass = thc;
308 Py_INCREF(m_tagHandlerClass);
309 RegisterModule(this);
310 wxHtmlWinParser::AddModule(this);
311 }
312
313 void OnExit() {
4268f798 314 wxPyBeginBlockThreads();
0f66a9f3
RD
315 Py_DECREF(m_tagHandlerClass);
316 m_tagHandlerClass = NULL;
dc2f8a65 317 for (size_t x=0; x < m_objArray.GetCount(); x++) {
0f66a9f3
RD
318 PyObject* obj = (PyObject*)m_objArray.Item(x);
319 Py_DECREF(obj);
320 }
4268f798 321 wxPyEndBlockThreads();
0f66a9f3
RD
322 };
323
324 void FillHandlersTable(wxHtmlWinParser *parser) {
325 // Wave our magic wand... (if it works it's a miracle! ;-)
326
327 // First, make a new instance of the tag handler
4268f798 328 wxPyBeginBlockThreads();
0f66a9f3
RD
329 PyObject* arg = Py_BuildValue("()");
330 PyObject* obj = PyInstance_New(m_tagHandlerClass, arg, NULL);
331 Py_DECREF(arg);
4268f798 332 wxPyEndBlockThreads();
0f66a9f3
RD
333
334 // now figure out where it's C++ object is...
335 wxPyHtmlWinTagHandler* thPtr;
336 if (SWIG_GetPtrObj(obj, (void **)&thPtr, "_wxPyHtmlWinTagHandler_p"))
337 return;
338
339 // add it,
340 parser->AddTagHandler(thPtr);
341
342 // and track it.
343 m_objArray.Add(obj);
344 }
345
346private:
347 PyObject* m_tagHandlerClass;
348 wxArrayPtrVoid m_objArray;
349
350};
351%}
352
353
354
355%inline %{
356 void wxHtmlWinParser_AddTagHandler(PyObject* tagHandlerClass) {
357 // Dynamically create a new wxModule. Refcounts tagHandlerClass
358 // and adds itself to the wxModules list and to the wxHtmlWinParser.
359 new wxPyHtmlTagsModule(tagHandlerClass);
360 }
361%}
362
dc2f8a65 363
e166644c
RD
364//---------------------------------------------------------------------------
365//---------------------------------------------------------------------------
366
9416aa89 367class wxHtmlCell : public wxObject {
e166644c
RD
368public:
369 wxHtmlCell();
370
e166644c
RD
371 int GetPosX();
372 int GetPosY();
373 int GetWidth();
374 int GetHeight();
375 int GetDescent();
9c00cfa3 376 wxHtmlLinkInfo* GetLink(int x = 0, int y = 0);
e166644c 377 wxHtmlCell* GetNext();
9c00cfa3
RD
378 wxHtmlContainerCell* GetParent();
379 void SetLink(const wxHtmlLinkInfo& link);
e166644c 380 void SetNext(wxHtmlCell *cell);
9c00cfa3
RD
381 void SetParent(wxHtmlContainerCell *p);
382 void SetPos(int x, int y);
e166644c
RD
383 void Layout(int w);
384 void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2);
385 void DrawInvisible(wxDC& dc, int x, int y);
386 const wxHtmlCell* Find(int condition, const void* param);
dc2f8a65
RD
387
388 bool AdjustPagebreak(int * pagebreak);
389 void SetCanLiveOnPagebreak(bool can);
9c00cfa3 390
e166644c
RD
391};
392
393
9416aa89
RD
394class wxHtmlWordCell : public wxHtmlCell
395{
396public:
397 wxHtmlWordCell(const wxString& word, wxDC& dc);
398};
399
400
e166644c
RD
401class wxHtmlContainerCell : public wxHtmlCell {
402public:
403 wxHtmlContainerCell(wxHtmlContainerCell *parent);
404
405 void InsertCell(wxHtmlCell *cell);
406 void SetAlignHor(int al);
407 int GetAlignHor();
408 void SetAlignVer(int al);
409 int GetAlignVer();
9d8bd15f 410 void SetIndent(int i, int what, int units = wxHTML_UNITS_PIXELS);
e166644c
RD
411 int GetIndent(int ind);
412 int GetIndentUnits(int ind);
413 void SetAlign(const wxHtmlTag& tag);
414 void SetWidthFloat(int w, int units);
415 %name(SetWidthFloatFromTag)void SetWidthFloat(const wxHtmlTag& tag);
9d8bd15f 416 void SetMinHeight(int h, int align = wxHTML_ALIGN_TOP);
e166644c
RD
417 void SetBackgroundColour(const wxColour& clr);
418 void SetBorder(const wxColour& clr1, const wxColour& clr2);
419 wxHtmlCell* GetFirstCell();
420};
421
422
423
9c00cfa3
RD
424class wxHtmlColourCell : public wxHtmlCell {
425public:
426 wxHtmlColourCell(wxColour clr, int flags = wxHTML_CLR_FOREGROUND);
427
428};
429
430
9416aa89
RD
431class wxHtmlFontCell : public wxHtmlCell
432{
433public:
434 wxHtmlFontCell(wxFont *font);
435};
436
e166644c
RD
437
438class wxHtmlWidgetCell : public wxHtmlCell {
439public:
440 wxHtmlWidgetCell(wxWindow* wnd, int w = 0);
441
442};
443
0f66a9f3
RD
444
445
446//---------------------------------------------------------------------------
447//---------------------------------------------------------------------------
4b123bb9
HH
448//---------------------------------------------------------------------------
449
0f66a9f3
RD
450%{
451class wxPyHtmlWindow : public wxHtmlWindow {
cdf14688 452 DECLARE_ABSTRACT_CLASS(wxPyHtmlWindow);
0f66a9f3
RD
453public:
454 wxPyHtmlWindow(wxWindow *parent, wxWindowID id = -1,
455 const wxPoint& pos = wxDefaultPosition,
456 const wxSize& size = wxDefaultSize,
457 long style = wxHW_SCROLLBAR_AUTO,
458 const wxString& name = "htmlWindow")
459 : wxHtmlWindow(parent, id, pos, size, style, name) {};
7b7ac0ab 460 wxPyHtmlWindow() : wxHtmlWindow() {};
0f66a9f3 461
e5d41db0
RD
462 bool ScrollToAnchor(const wxString& anchor) {
463 return wxHtmlWindow::ScrollToAnchor(anchor);
464 }
465
466 bool HasAnchor(const wxString& anchor) {
467 const wxHtmlCell *c = m_Cell->Find(wxHTML_COND_ISANCHOR, &anchor);
468 return c!=NULL;
469 }
470
c8bc03c3
RD
471 void OnLinkClicked(const wxHtmlLinkInfo& link);
472 void base_OnLinkClicked(const wxHtmlLinkInfo& link);
9c00cfa3 473
e5d41db0 474 wxHtmlOpeningStatus OnOpeningURL(wxHtmlURLType type,
c6c593e8
RD
475 const wxString& url,
476 wxString *redirect) const;
477
9c00cfa3 478 DEC_PYCALLBACK__STRING(OnSetTitle);
0122b7e3
RD
479 DEC_PYCALLBACK__CELLINTINT(OnCellMouseHover);
480 DEC_PYCALLBACK__CELLINTINTME(OnCellClicked);
c6c593e8 481// DEC_PYCALLBACK_BOOL_STRING(OnOpeningURL);
0f66a9f3
RD
482 PYPRIVATE;
483};
484
cdf14688 485IMPLEMENT_ABSTRACT_CLASS( wxPyHtmlWindow, wxHtmlWindow );
9c00cfa3 486IMP_PYCALLBACK__STRING(wxPyHtmlWindow, wxHtmlWindow, OnSetTitle);
0122b7e3
RD
487IMP_PYCALLBACK__CELLINTINT(wxPyHtmlWindow, wxHtmlWindow, OnCellMouseHover);
488IMP_PYCALLBACK__CELLINTINTME(wxPyHtmlWindow, wxHtmlWindow, OnCellClicked);
c6c593e8 489// IMP_PYCALLBACK_BOOL_STRING(wxPyHtmlWindow, wxHtmlWindow, OnOpeningURL);
0122b7e3 490
0f66a9f3 491
9416aa89 492void wxPyHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link) {
19a97bd6 493 bool found;
4268f798 494 wxPyBeginBlockThreads();
0122b7e3 495 if ((found = wxPyCBH_findCallback(m_myInst, "OnLinkClicked"))) {
1e7ecb7b
RD
496 PyObject* obj = wxPyConstructObject((void*)&link, "wxHtmlLinkInfo", 0);
497 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj));
de20db99 498 Py_DECREF(obj);
9c00cfa3 499 }
4268f798 500 wxPyEndBlockThreads();
19a97bd6 501 if (! found)
9c00cfa3 502 wxHtmlWindow::OnLinkClicked(link);
9c00cfa3 503}
c8bc03c3 504void wxPyHtmlWindow::base_OnLinkClicked(const wxHtmlLinkInfo& link) {
9c00cfa3
RD
505 wxHtmlWindow::OnLinkClicked(link);
506}
0122b7e3 507
c6c593e8
RD
508
509wxHtmlOpeningStatus wxPyHtmlWindow::OnOpeningURL(wxHtmlURLType type,
510 const wxString& url,
511 wxString *redirect) const {
512 bool found;
513 wxHtmlOpeningStatus rval;
514 wxPyBeginBlockThreads();
515 if ((found = wxPyCBH_findCallback(m_myInst, "OnOpeningURL"))) {
516 PyObject* ro;
a541c325 517 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(iO)", type, wx2PyString(url)));
c6c593e8
RD
518 if (PyString_Check(ro)
519#if PYTHON_API_VERSION >= 1009
520 || PyUnicode_Check(ro)
521#endif
522 ) {
a541c325 523 *redirect = Py2wxString(ro);
c6c593e8
RD
524 rval = wxHTML_REDIRECT;
525 }
526 else {
527 PyObject* num = PyNumber_Int(ro);
528 rval = (wxHtmlOpeningStatus)PyInt_AsLong(num);
529 Py_DECREF(num);
530 }
531 Py_DECREF(ro);
532 }
533 wxPyEndBlockThreads();
534 if (! found)
535 rval = wxHtmlWindow::OnOpeningURL(type, url, redirect);
536 return rval;
537}
538
539
0f66a9f3
RD
540%}
541
542
95837b4d 543
0f66a9f3
RD
544%name(wxHtmlWindow) class wxPyHtmlWindow : public wxScrolledWindow {
545public:
546 wxPyHtmlWindow(wxWindow *parent, int id = -1,
1e7ecb7b
RD
547 wxPoint& pos = wxDefaultPosition,
548 wxSize& size = wxDefaultSize,
fc51b8c3 549 int style=wxHW_SCROLLBAR_AUTO,
137b5242 550 const wxString& name = wxPyHtmlWindowNameStr);
7b7ac0ab
RD
551 %name(wxPreHtmlWindow)wxPyHtmlWindow();
552
553 bool Create(wxWindow *parent, int id = -1,
554 wxPoint& pos = wxDefaultPosition,
555 wxSize& size = wxDefaultSize,
fc51b8c3 556 int style=wxHW_SCROLLBAR_AUTO,
137b5242 557 const wxString& name = wxPyHtmlWindowNameStr);
7b7ac0ab 558
0f66a9f3 559
0122b7e3
RD
560 void _setCallbackInfo(PyObject* self, PyObject* _class);
561 %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxHtmlWindow)"
0122b7e3 562 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
7b7ac0ab 563 %pragma(python) addtomethod = "wxPreHtmlWindow:val._setOORInfo(val)"
0f66a9f3 564
7a446686
RD
565 bool SetPage(const wxString& source);
566 bool LoadPage(const wxString& location);
de112a55 567 bool AppendToPage(const wxString& source);
0f66a9f3 568 wxString GetOpenedPage();
7a446686
RD
569 wxString GetOpenedAnchor();
570 wxString GetOpenedPageTitle();
571
137b5242 572 void SetRelatedFrame(wxFrame* frame, const wxString& format);
0f66a9f3 573 wxFrame* GetRelatedFrame();
0f66a9f3 574 void SetRelatedStatusBar(int bar);
f6bcfd97
BP
575
576 //void SetFonts(wxString normal_face, wxString fixed_face, int *LIST);
577 %addmethods {
578 void SetFonts(wxString normal_face, wxString fixed_face, PyObject* sizes) {
579 int* temp = int_LIST_helper(sizes);
580 if (temp) {
581 self->SetFonts(normal_face, fixed_face, temp);
582 delete [] temp;
583 }
584 }
585 }
586
7a446686 587 void SetTitle(const wxString& title);
0f66a9f3 588 void SetBorders(int b);
137b5242
RD
589 void ReadCustomization(wxConfigBase *cfg, wxString path = wxPyEmptyString);
590 void WriteCustomization(wxConfigBase *cfg, wxString path = wxPyEmptyString);
0f66a9f3
RD
591 bool HistoryBack();
592 bool HistoryForward();
7a446686
RD
593 bool HistoryCanBack();
594 bool HistoryCanForward();
0f66a9f3 595 void HistoryClear();
a65c6e14 596 wxHtmlContainerCell* GetInternalRepresentation();
e166644c
RD
597 wxHtmlWinParser* GetParser();
598
e5d41db0
RD
599 bool ScrollToAnchor(const wxString& anchor);
600 bool HasAnchor(const wxString& anchor);
601
c8bc03c3 602 void base_OnLinkClicked(const wxHtmlLinkInfo& link);
137b5242 603 void base_OnSetTitle(const wxString& title);
0122b7e3
RD
604 void base_OnCellMouseHover(wxHtmlCell *cell, wxCoord x, wxCoord y);
605 void base_OnCellClicked(wxHtmlCell *cell,
606 wxCoord x, wxCoord y,
607 const wxMouseEvent& event);
4b123bb9
HH
608};
609
0f66a9f3
RD
610// Static methods are mapped to stand-alone functions
611%inline %{
612 void wxHtmlWindow_AddFilter(wxHtmlFilter *filter) {
613 wxHtmlWindow::AddFilter(filter);
614 }
615%}
5ca24bf4 616
5ca24bf4 617
dc2f8a65
RD
618//---------------------------------------------------------------------------
619//---------------------------------------------------------------------------
620
621
9416aa89 622class wxHtmlDCRenderer : public wxObject {
dc2f8a65
RD
623public:
624 wxHtmlDCRenderer();
625 ~wxHtmlDCRenderer();
626
627 void SetDC(wxDC *dc, int maxwidth);
628 void SetSize(int width, int height);
629 void SetHtmlText(const wxString& html,
137b5242 630 const wxString& basepath = wxPyEmptyString,
dc2f8a65
RD
631 bool isdir = TRUE);
632 int Render(int x, int y, int from = 0, int dont_render = FALSE);
633 int GetTotalHeight();
634 // returns total height of the html document
635 // (compare Render's return value with this)
636};
637
638enum {
639 wxPAGE_ODD,
640 wxPAGE_EVEN,
641 wxPAGE_ALL
642};
643
644
645class wxHtmlPrintout : public wxPyPrintout {
646public:
137b5242 647 wxHtmlPrintout(const wxString& title = wxPyHtmlPrintoutTitleStr);
f3d9dc1d 648 //~wxHtmlPrintout(); wxPrintPreview object takes ownership...
dc2f8a65
RD
649
650 void SetHtmlText(const wxString& html,
137b5242 651 const wxString &basepath = wxPyEmptyString,
dc2f8a65
RD
652 bool isdir = TRUE);
653 void SetHtmlFile(const wxString &htmlfile);
654 void SetHeader(const wxString& header, int pg = wxPAGE_ALL);
655 void SetFooter(const wxString& footer, int pg = wxPAGE_ALL);
656 void SetMargins(float top = 25.2, float bottom = 25.2,
657 float left = 25.2, float right = 25.2,
658 float spaces = 5);
659};
660
661
662
9416aa89 663class wxHtmlEasyPrinting : public wxObject {
dc2f8a65 664public:
137b5242 665 wxHtmlEasyPrinting(const wxString& name = wxPyHtmlPrintingTitleStr,
dc2f8a65
RD
666 wxFrame *parent_frame = NULL);
667 ~wxHtmlEasyPrinting();
668
669 void PreviewFile(const wxString &htmlfile);
137b5242 670 void PreviewText(const wxString &htmltext, const wxString& basepath = wxPyEmptyString);
dc2f8a65 671 void PrintFile(const wxString &htmlfile);
137b5242 672 void PrintText(const wxString &htmltext, const wxString& basepath = wxPyEmptyString);
dc2f8a65
RD
673 void PrinterSetup();
674 void PageSetup();
675 void SetHeader(const wxString& header, int pg = wxPAGE_ALL);
676 void SetFooter(const wxString& footer, int pg = wxPAGE_ALL);
677
678 wxPrintData *GetPrintData() {return m_PrintData;}
679 wxPageSetupDialogData *GetPageSetupData() {return m_PageSetupData;}
680
681};
682
683
684
0f66a9f3
RD
685//---------------------------------------------------------------------------
686//---------------------------------------------------------------------------
5ca24bf4 687
0f66a9f3
RD
688%{
689 extern "C" SWIGEXPORT(void) inithtmlhelpc();
690%}
4b123bb9 691
4b123bb9
HH
692
693%init %{
694
2f90df85 695 inithtmlhelpc();
0f66a9f3 696
e508a2b6
RD
697 wxClassInfo::CleanUpClasses();
698 wxClassInfo::InitializeClasses();
9416aa89
RD
699
700 wxPyPtrTypeMap_Add("wxHtmlTagHandler", "wxPyHtmlTagHandler");
701 wxPyPtrTypeMap_Add("wxHtmlWinTagHandler", "wxPyHtmlWinTagHandler");
702 wxPyPtrTypeMap_Add("wxHtmlWindow", "wxPyHtmlWindow");
4b123bb9
HH
703%}
704
e166644c
RD
705//----------------------------------------------------------------------
706// And this gets appended to the shadow class file.
707//----------------------------------------------------------------------
708
f6bcfd97 709%pragma(python) include="_htmlextras.py";
e166644c 710
4b123bb9 711//---------------------------------------------------------------------------