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