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