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