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