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