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