]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/html.i
Added autoconf makefiles for FoldBar extended samples
[wxWidgets.git] / wxPython / src / html.i
CommitLineData
4b123bb9
HH
1/////////////////////////////////////////////////////////////////////////////
2// Name: html.i
3// Purpose: SWIG definitions of html classes
4//
5// Author: Robin Dunn
6//
d14a1e28 7// Created: 25-Nov-1998
4b123bb9 8// RCS-ID: $Id$
d14a1e28 9// Copyright: (c) 2003 by Total Control Software
4b123bb9
HH
10// Licence: wxWindows license
11/////////////////////////////////////////////////////////////////////////////
12
c8fac2b6
RD
13%define DOCSTRING
14"Classes for a simple HTML rendering window, HTML Help Window, etc."
15%enddef
4b123bb9 16
b2eb030f 17%module(package="wx", docstring=DOCSTRING) html
4b123bb9
HH
18
19%{
d14a1e28
RD
20#include "wx/wxPython/wxPython.h"
21#include "wx/wxPython/pyclasses.h"
22#include "wx/wxPython/pyistream.h"
23#include "wx/wxPython/printfw.h"
24
4b123bb9 25#include <wx/html/htmlwin.h>
dc2f8a65 26#include <wx/html/htmprint.h>
d14a1e28 27#include <wx/html/helpctrl.h>
4b123bb9 28
137b5242
RD
29%}
30
b2dc1044 31
0f66a9f3 32//---------------------------------------------------------------------------
e166644c 33
d14a1e28 34%import windows.i
54f9ee45 35%pythoncode { wx = _core }
99109c0f 36%pythoncode { __docfilter__ = wx.__DocFilter(globals()) }
d14a1e28
RD
37
38%include _html_rename.i
39
40
b2dc1044 41MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
089142a5
RD
42MAKE_CONST_WXSTRING2(HtmlWindowNameStr, wxT("htmlWindow"))
43MAKE_CONST_WXSTRING2(HtmlPrintoutTitleStr, wxT("Printout"))
44MAKE_CONST_WXSTRING2(HtmlPrintingTitleStr, wxT("Printing"))
b2dc1044
RD
45
46
d14a1e28
RD
47// TODO: Split this file into multiple %included files that coresponds to the
48// wx/html include files (more or less.)
49
50//---------------------------------------------------------------------------
51//---------------------------------------------------------------------------
52%newgroup
53
54
e166644c 55enum {
9d8bd15f
RD
56 wxHTML_ALIGN_LEFT,
57 wxHTML_ALIGN_CENTER,
58 wxHTML_ALIGN_RIGHT,
59 wxHTML_ALIGN_BOTTOM,
60 wxHTML_ALIGN_TOP,
61
62 wxHTML_CLR_FOREGROUND,
63 wxHTML_CLR_BACKGROUND,
64
65 wxHTML_UNITS_PIXELS,
66 wxHTML_UNITS_PERCENT,
67
68 wxHTML_INDENT_LEFT,
69 wxHTML_INDENT_RIGHT,
70 wxHTML_INDENT_TOP,
71 wxHTML_INDENT_BOTTOM,
72
73 wxHTML_INDENT_HORIZONTAL,
74 wxHTML_INDENT_VERTICAL,
75 wxHTML_INDENT_ALL,
76
77 wxHTML_COND_ISANCHOR,
78 wxHTML_COND_ISIMAGEMAP,
79 wxHTML_COND_USER,
4eeb5705
RD
80
81
82 wxHTML_FONT_SIZE_1,
83 wxHTML_FONT_SIZE_2,
84 wxHTML_FONT_SIZE_3,
85 wxHTML_FONT_SIZE_4,
86 wxHTML_FONT_SIZE_5,
87 wxHTML_FONT_SIZE_6,
88 wxHTML_FONT_SIZE_7,
e166644c
RD
89};
90
91
c6c593e8
RD
92enum {
93 wxHW_SCROLLBAR_NEVER,
94 wxHW_SCROLLBAR_AUTO,
3ef86e32
RD
95 wxHW_NO_SELECTION,
96 wxHW_DEFAULT_STYLE,
c6c593e8
RD
97};
98
99
100// enums for wxHtmlWindow::OnOpeningURL
101enum wxHtmlOpeningStatus
102{
103 wxHTML_OPEN,
104 wxHTML_BLOCK,
105 wxHTML_REDIRECT
106};
107
108enum wxHtmlURLType
109{
110 wxHTML_URL_PAGE,
111 wxHTML_URL_IMAGE,
112 wxHTML_URL_OTHER
113};
114
d14a1e28
RD
115
116
9c00cfa3
RD
117//---------------------------------------------------------------------------
118
9416aa89 119class wxHtmlLinkInfo : public wxObject {
9c00cfa3 120public:
137b5242 121 wxHtmlLinkInfo(const wxString& href, const wxString& target = wxPyEmptyString);
9c00cfa3
RD
122 wxString GetHref();
123 wxString GetTarget();
c8bc03c3
RD
124 wxMouseEvent* GetEvent();
125 wxHtmlCell* GetHtmlCell();
7a446686
RD
126
127 void SetEvent(const wxMouseEvent *e);
128 void SetHtmlCell(const wxHtmlCell * e);
9c00cfa3
RD
129};
130
0f66a9f3
RD
131//---------------------------------------------------------------------------
132
9416aa89 133class wxHtmlTag : public wxObject {
0f66a9f3 134public:
e166644c 135 // Never need to create a new tag from Python...
0f66a9f3
RD
136 //wxHtmlTag(const wxString& source, int pos, int end_pos, wxHtmlTagsCache* cache);
137
138 wxString GetName();
139 bool HasParam(const wxString& par);
a72f4631 140 wxString GetParam(const wxString& par, int with_commas = false);
0f66a9f3
RD
141
142 // Can't do this one as-is, but GetParam should be enough...
143 //int ScanParam(const wxString& par, const char *format, void* param);
144
145 wxString GetAllParams();
0f66a9f3
RD
146 bool HasEnding();
147 int GetBeginPos();
148 int GetEndPos1();
149 int GetEndPos2();
150};
151
0f66a9f3
RD
152//---------------------------------------------------------------------------
153
9416aa89 154class wxHtmlParser : public wxObject {
0f66a9f3
RD
155public:
156 // wxHtmlParser(); This is an abstract base class...
157
158 void SetFS(wxFileSystem *fs);
159 wxFileSystem* GetFS();
160 wxObject* Parse(const wxString& source);
161 void InitParser(const wxString& source);
162 void DoneParser();
163 void DoParsing(int begin_pos, int end_pos);
1e4a197e 164 void StopParsing();
0f66a9f3 165 // wxObject* GetProduct();
1e4a197e 166
0f66a9f3
RD
167 void AddTagHandler(wxHtmlTagHandler *handler);
168 wxString* GetSource();
dc2f8a65
RD
169 void PushTagHandler(wxHtmlTagHandler* handler, wxString tags);
170 void PopTagHandler();
0f66a9f3 171
c6c593e8 172 // virtual wxFSFile *OpenURL(wxHtmlURLType type, const wxString& url) const;
0f66a9f3
RD
173
174 // void AddText(const char* txt) = 0;
175 // void AddTag(const wxHtmlTag& tag);
176};
177
178
179//---------------------------------------------------------------------------
180
181class wxHtmlWinParser : public wxHtmlParser {
182public:
1fded56b 183 wxHtmlWinParser(wxPyHtmlWindow *wnd = NULL);
0f66a9f3
RD
184
185 void SetDC(wxDC *dc);
186 wxDC* GetDC();
187 int GetCharHeight();
188 int GetCharWidth();
1fded56b 189 wxPyHtmlWindow* GetWindow();
d14a1e28 190
1fded56b 191 // Sets fonts to be used when displaying HTML page. (if size null then default sizes used).
d14a1e28 192 %extend {
9cbf6f6e
RD
193 void SetFonts(wxString normal_face, wxString fixed_face, PyObject* sizes=NULL) {
194 int* temp = NULL;
195 if (sizes) temp = int_LIST_helper(sizes);
196 self->SetFonts(normal_face, fixed_face, temp);
197 if (temp)
f6bcfd97 198 delete [] temp;
f6bcfd97
BP
199 }
200 }
0f66a9f3 201
385721a8
RD
202 // Sets font sizes to be relative to the given size or the system
203 // default size; use either specified or default font
204 void SetStandardFonts(int size = -1,
205 const wxString& normal_face = wxPyEmptyString,
206 const wxString& fixed_face = wxPyEmptyString);
207
7acd3625 208
0f66a9f3
RD
209 wxHtmlContainerCell* GetContainer();
210 wxHtmlContainerCell* OpenContainer();
dc2f8a65 211 wxHtmlContainerCell *SetContainer(wxHtmlContainerCell *c);
0f66a9f3 212 wxHtmlContainerCell* CloseContainer();
dc2f8a65 213
0f66a9f3
RD
214 int GetFontSize();
215 void SetFontSize(int s);
216 int GetFontBold();
217 void SetFontBold(int x);
218 int GetFontItalic();
219 void SetFontItalic(int x);
220 int GetFontUnderlined();
221 void SetFontUnderlined(int x);
222 int GetFontFixed();
223 void SetFontFixed(int x);
224 int GetAlign();
225 void SetAlign(int a);
c5943253 226 wxColour GetLinkColor();
0f66a9f3 227 void SetLinkColor(const wxColour& clr);
c5943253 228 wxColour GetActualColor();
0f66a9f3 229 void SetActualColor(const wxColour& clr);
85f9dd19
RD
230 %pythoncode {
231 GetActualColour = GetActualColor
232 SetActualColour = SetActualColor
233 }
0f66a9f3
RD
234 void SetLink(const wxString& link);
235 wxFont* CreateCurrentFont();
9c00cfa3
RD
236 wxHtmlLinkInfo GetLink();
237
0f66a9f3
RD
238};
239
240
0f66a9f3
RD
241//---------------------------------------------------------------------------
242
243%{
244class wxPyHtmlTagHandler : public wxHtmlTagHandler {
9416aa89 245 DECLARE_DYNAMIC_CLASS(wxPyHtmlTagHandler);
0f66a9f3
RD
246public:
247 wxPyHtmlTagHandler() : wxHtmlTagHandler() {};
248
249 wxHtmlParser* GetParser() { return m_Parser; }
250 void ParseInner(const wxHtmlTag& tag) { wxHtmlTagHandler::ParseInner(tag); }
251
252 DEC_PYCALLBACK_STRING__pure(GetSupportedTags);
253 DEC_PYCALLBACK_BOOL_TAG_pure(HandleTag);
254
255 PYPRIVATE;
256};
257
9416aa89
RD
258IMPLEMENT_DYNAMIC_CLASS(wxPyHtmlTagHandler, wxHtmlTagHandler);
259
0f66a9f3
RD
260IMP_PYCALLBACK_STRING__pure(wxPyHtmlTagHandler, wxHtmlTagHandler, GetSupportedTags);
261IMP_PYCALLBACK_BOOL_TAG_pure(wxPyHtmlTagHandler, wxHtmlTagHandler, HandleTag);
0f66a9f3
RD
262%}
263
264
1b8c7ba6
RD
265%rename(HtmlTagHandler) wxPyHtmlTagHandler;
266class wxPyHtmlTagHandler : public wxObject {
0f66a9f3 267public:
2b9048c5 268 %pythonAppend wxPyHtmlTagHandler "self._setCallbackInfo(self, HtmlTagHandler)"
0f66a9f3
RD
269 wxPyHtmlTagHandler();
270
0122b7e3 271 void _setCallbackInfo(PyObject* self, PyObject* _class);
0f66a9f3
RD
272
273 void SetParser(wxHtmlParser *parser);
274 wxHtmlParser* GetParser();
275 void ParseInner(const wxHtmlTag& tag);
276};
277
278
279//---------------------------------------------------------------------------
280
281%{
282class wxPyHtmlWinTagHandler : public wxHtmlWinTagHandler {
9416aa89 283 DECLARE_DYNAMIC_CLASS(wxPyHtmlWinTagHandler);
0f66a9f3
RD
284public:
285 wxPyHtmlWinTagHandler() : wxHtmlWinTagHandler() {};
286
287 wxHtmlWinParser* GetParser() { return m_WParser; }
288 void ParseInner(const wxHtmlTag& tag)
289 { wxHtmlWinTagHandler::ParseInner(tag); }
290
291 DEC_PYCALLBACK_STRING__pure(GetSupportedTags);
292 DEC_PYCALLBACK_BOOL_TAG_pure(HandleTag);
293
294 PYPRIVATE;
295};
296
9416aa89
RD
297IMPLEMENT_DYNAMIC_CLASS( wxPyHtmlWinTagHandler, wxHtmlWinTagHandler);
298
0f66a9f3
RD
299IMP_PYCALLBACK_STRING__pure(wxPyHtmlWinTagHandler, wxHtmlWinTagHandler, GetSupportedTags);
300IMP_PYCALLBACK_BOOL_TAG_pure(wxPyHtmlWinTagHandler, wxHtmlWinTagHandler, HandleTag);
0f66a9f3
RD
301%}
302
303
1b8c7ba6
RD
304%rename(HtmlWinTagHandler) wxPyHtmlWinTagHandler;
305class wxPyHtmlWinTagHandler : public wxPyHtmlTagHandler {
0f66a9f3 306public:
2b9048c5 307 %pythonAppend wxPyHtmlWinTagHandler "self._setCallbackInfo(self, HtmlWinTagHandler)"
0f66a9f3
RD
308 wxPyHtmlWinTagHandler();
309
0122b7e3 310 void _setCallbackInfo(PyObject* self, PyObject* _class);
0f66a9f3
RD
311
312 void SetParser(wxHtmlParser *parser);
313 wxHtmlWinParser* GetParser();
314 void ParseInner(const wxHtmlTag& tag);
315};
316
317
318//---------------------------------------------------------------------------
319
320%{
321
322class wxPyHtmlTagsModule : public wxHtmlTagsModule {
323public:
324 wxPyHtmlTagsModule(PyObject* thc) : wxHtmlTagsModule() {
325 m_tagHandlerClass = thc;
326 Py_INCREF(m_tagHandlerClass);
327 RegisterModule(this);
328 wxHtmlWinParser::AddModule(this);
329 }
330
331 void OnExit() {
6e6b3557 332 wxPyBlock_t blocked = wxPyBeginBlockThreads();
0f66a9f3
RD
333 Py_DECREF(m_tagHandlerClass);
334 m_tagHandlerClass = NULL;
dc2f8a65 335 for (size_t x=0; x < m_objArray.GetCount(); x++) {
0f66a9f3
RD
336 PyObject* obj = (PyObject*)m_objArray.Item(x);
337 Py_DECREF(obj);
338 }
da32eb53 339 wxPyEndBlockThreads(blocked);
0f66a9f3
RD
340 };
341
342 void FillHandlersTable(wxHtmlWinParser *parser) {
343 // Wave our magic wand... (if it works it's a miracle! ;-)
344
345 // First, make a new instance of the tag handler
6e6b3557 346 wxPyBlock_t blocked = wxPyBeginBlockThreads();
fb757066
RD
347 PyObject* arg = PyTuple_New(0);
348 PyObject* obj = PyObject_CallObject(m_tagHandlerClass, arg);
0f66a9f3 349 Py_DECREF(arg);
fb757066 350
0f66a9f3
RD
351 // now figure out where it's C++ object is...
352 wxPyHtmlWinTagHandler* thPtr;
fb757066 353 if (! wxPyConvertSwigPtr(obj, (void **)&thPtr, wxT("wxPyHtmlWinTagHandler"))) {
da32eb53 354 wxPyEndBlockThreads(blocked);
0f66a9f3 355 return;
fb757066 356 }
da32eb53 357 wxPyEndBlockThreads(blocked);
0f66a9f3
RD
358
359 // add it,
360 parser->AddTagHandler(thPtr);
361
362 // and track it.
363 m_objArray.Add(obj);
364 }
365
366private:
367 PyObject* m_tagHandlerClass;
368 wxArrayPtrVoid m_objArray;
369
370};
371%}
372
373
374
375%inline %{
376 void wxHtmlWinParser_AddTagHandler(PyObject* tagHandlerClass) {
377 // Dynamically create a new wxModule. Refcounts tagHandlerClass
378 // and adds itself to the wxModules list and to the wxHtmlWinParser.
379 new wxPyHtmlTagsModule(tagHandlerClass);
380 }
381%}
382
dc2f8a65 383
e166644c
RD
384//---------------------------------------------------------------------------
385//---------------------------------------------------------------------------
d14a1e28 386%newgroup
e166644c 387
dd116e73
RD
388
389// wxHtmlSelection is data holder with information about text selection.
390// Selection is defined by two positions (beginning and end of the selection)
391// and two leaf(!) cells at these positions.
392class wxHtmlSelection
393{
394public:
395 wxHtmlSelection();
396 ~wxHtmlSelection();
397
398 void Set(const wxPoint& fromPos, const wxHtmlCell *fromCell,
399 const wxPoint& toPos, const wxHtmlCell *toCell);
1b8c7ba6 400 %Rename(SetCells, void, Set(const wxHtmlCell *fromCell, const wxHtmlCell *toCell));
dd116e73
RD
401
402 const wxHtmlCell *GetFromCell() const;
403 const wxHtmlCell *GetToCell() const;
404
405 // these values are in absolute coordinates:
406 const wxPoint& GetFromPos() const;
407 const wxPoint& GetToPos() const;
408
409 // these are From/ToCell's private data
410 const wxPoint& GetFromPrivPos() const;
411 const wxPoint& GetToPrivPos() const;
412 void SetFromPrivPos(const wxPoint& pos);
413 void SetToPrivPos(const wxPoint& pos);
414 void ClearPrivPos();
415
416 const bool IsEmpty() const;
417
418};
419
420
421enum wxHtmlSelectionState
422{
423 wxHTML_SEL_OUT, // currently rendered cell is outside the selection
424 wxHTML_SEL_IN, // ... is inside selection
425 wxHTML_SEL_CHANGING // ... is the cell on which selection state changes
426};
427
d14a1e28
RD
428
429
dd116e73
RD
430// Selection state is passed to wxHtmlCell::Draw so that it can render itself
431// differently e.g. when inside text selection or outside it.
432class wxHtmlRenderingState
433{
434public:
435 wxHtmlRenderingState();
436 ~wxHtmlRenderingState();
437
438 void SetSelectionState(wxHtmlSelectionState s);
439 wxHtmlSelectionState GetSelectionState() const;
440
441 void SetFgColour(const wxColour& c);
442 const wxColour& GetFgColour() const;
443 void SetBgColour(const wxColour& c);
444 const wxColour& GetBgColour() const;
445};
446
447
d14a1e28 448
dd116e73
RD
449// HTML rendering customization. This class is used when rendering wxHtmlCells
450// as a callback:
451class wxHtmlRenderingStyle
452{
453public:
454 virtual wxColour GetSelectedTextColour(const wxColour& clr) = 0;
455 virtual wxColour GetSelectedTextBgColour(const wxColour& clr) = 0;
456};
457
458// Standard style:
459class wxDefaultHtmlRenderingStyle : public wxHtmlRenderingStyle
460{
461public:
462 virtual wxColour GetSelectedTextColour(const wxColour& clr);
463 virtual wxColour GetSelectedTextBgColour(const wxColour& clr);
464};
465
466
467
468// Information given to cells when drawing them. Contains rendering state,
469// selection information and rendering style object that can be used to
470// customize the output.
471class wxHtmlRenderingInfo
472{
473public:
474 wxHtmlRenderingInfo();
475 ~wxHtmlRenderingInfo();
476
477 void SetSelection(wxHtmlSelection *s);
478 wxHtmlSelection *GetSelection() const;
479
480 void SetStyle(wxHtmlRenderingStyle *style);
481 wxHtmlRenderingStyle& GetStyle();
482
483 wxHtmlRenderingState& GetState();
484};
485
486//---------------------------------------------------------------------------
d14a1e28 487%newgroup
dd116e73 488
3ef86e32
RD
489
490enum
491{
492 wxHTML_FIND_EXACT = 1,
493 wxHTML_FIND_NEAREST_BEFORE = 2,
494 wxHTML_FIND_NEAREST_AFTER = 4
495};
496
497
9416aa89 498class wxHtmlCell : public wxObject {
e166644c
RD
499public:
500 wxHtmlCell();
501
e166644c
RD
502 int GetPosX();
503 int GetPosY();
504 int GetWidth();
505 int GetHeight();
506 int GetDescent();
0d267606
RD
507
508 // Returns the maximum possible length of the cell.
509 // Call Layout at least once before using GetMaxTotalWidth()
510 int GetMaxTotalWidth() const;
511
2678dd26
RD
512 const wxString& GetId() const;
513 void SetId(const wxString& id);
9c00cfa3 514 wxHtmlLinkInfo* GetLink(int x = 0, int y = 0);
e166644c 515 wxHtmlCell* GetNext();
9c00cfa3 516 wxHtmlContainerCell* GetParent();
3ef86e32
RD
517 wxHtmlCell* GetFirstChild() const;
518
519 // Returns cursor to be used when mouse is over the cell:
520 wxCursor GetCursor() const;
521
522 // Formatting cells are not visible on the screen, they only alter
523 // renderer's state.
524 bool IsFormattingCell() const;
525
526
9c00cfa3 527 void SetLink(const wxHtmlLinkInfo& link);
e166644c 528 void SetNext(wxHtmlCell *cell);
9c00cfa3
RD
529 void SetParent(wxHtmlContainerCell *p);
530 void SetPos(int x, int y);
e166644c 531 void Layout(int w);
dd116e73
RD
532 void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2,
533 wxHtmlRenderingInfo& info);
534 void DrawInvisible(wxDC& dc, int x, int y,
535 wxHtmlRenderingInfo& info);
e166644c 536 const wxHtmlCell* Find(int condition, const void* param);
dc2f8a65 537
1fded56b 538 bool AdjustPagebreak(int* INOUT);
dc2f8a65 539 void SetCanLiveOnPagebreak(bool can);
9c00cfa3 540
3ef86e32
RD
541 // Can the line be broken before this cell?
542 bool IsLinebreakAllowed() const;
543
dd9f7fea 544 // Returns True for simple == terminal cells, i.e. not composite ones.
3ef86e32
RD
545 // This if for internal usage only and may disappear in future versions!
546 bool IsTerminalCell() const;
547
548 // Find a cell inside this cell positioned at the given coordinates
549 // (relative to this's positions). Returns NULL if no such cell exists.
550 // The flag can be used to specify whether to look for terminal or
551 // nonterminal cells or both. In either case, returned cell is deepest
552 // cell in cells tree that contains [x,y].
553 wxHtmlCell *FindCellByPos(wxCoord x, wxCoord y,
554 unsigned flags = wxHTML_FIND_EXACT) const;
555
556 // Returns absolute position of the cell on HTML canvas
557 wxPoint GetAbsPos() const;
558
559 // Returns first (last) terminal cell inside this cell. It may return NULL,
560 // but it is rare -- only if there are no terminals in the tree.
561 wxHtmlCell *GetFirstTerminal() const ;
562 wxHtmlCell *GetLastTerminal() const ;
563
564 // Returns cell's depth, i.e. how far under the root cell it is
565 // (if it is the root, depth is 0)
566 unsigned GetDepth() const;
567
dd9f7fea 568 // Returns True if the cell appears before 'cell' in natural order of
3ef86e32 569 // cells (= as they are read). If cell A is (grand)parent of cell B,
dd9f7fea 570 // then both A.IsBefore(B) and B.IsBefore(A) always return True.
3ef86e32
RD
571 bool IsBefore(wxHtmlCell *cell) const;
572
573 // Converts the cell into text representation. If sel != NULL then
574 // only part of the cell inside the selection is converted.
575 wxString ConvertToText(wxHtmlSelection *sel) const;
e166644c
RD
576};
577
578
9416aa89
RD
579class wxHtmlWordCell : public wxHtmlCell
580{
581public:
582 wxHtmlWordCell(const wxString& word, wxDC& dc);
583};
584
585
e166644c
RD
586class wxHtmlContainerCell : public wxHtmlCell {
587public:
588 wxHtmlContainerCell(wxHtmlContainerCell *parent);
589
590 void InsertCell(wxHtmlCell *cell);
591 void SetAlignHor(int al);
592 int GetAlignHor();
593 void SetAlignVer(int al);
594 int GetAlignVer();
9d8bd15f 595 void SetIndent(int i, int what, int units = wxHTML_UNITS_PIXELS);
e166644c
RD
596 int GetIndent(int ind);
597 int GetIndentUnits(int ind);
598 void SetAlign(const wxHtmlTag& tag);
599 void SetWidthFloat(int w, int units);
1b8c7ba6 600 %Rename(SetWidthFloatFromTag, void, SetWidthFloat(const wxHtmlTag& tag));
9d8bd15f 601 void SetMinHeight(int h, int align = wxHTML_ALIGN_TOP);
e166644c 602 void SetBackgroundColour(const wxColour& clr);
1e4a197e 603 wxColour GetBackgroundColour();
e166644c 604 void SetBorder(const wxColour& clr1, const wxColour& clr2);
dd116e73
RD
605 wxHtmlCell* GetFirstChild();
606 %pragma(python) addtoclass = "GetFirstCell = GetFirstChild"
e166644c
RD
607};
608
609
610
9c00cfa3
RD
611class wxHtmlColourCell : public wxHtmlCell {
612public:
85f9dd19 613 wxHtmlColourCell(const wxColour& clr, int flags = wxHTML_CLR_FOREGROUND);
9c00cfa3
RD
614
615};
616
617
9416aa89
RD
618class wxHtmlFontCell : public wxHtmlCell
619{
620public:
621 wxHtmlFontCell(wxFont *font);
622};
623
e166644c
RD
624
625class wxHtmlWidgetCell : public wxHtmlCell {
626public:
627 wxHtmlWidgetCell(wxWindow* wnd, int w = 0);
628
629};
630
0f66a9f3 631
d14a1e28
RD
632
633
0f66a9f3 634//---------------------------------------------------------------------------
1e4a197e
RD
635// wxHtmlFilter
636//---------------------------------------------------------------------------
d14a1e28 637%newgroup
1e4a197e
RD
638
639
640%{ // here's the C++ version
641class wxPyHtmlFilter : public wxHtmlFilter {
642 DECLARE_ABSTRACT_CLASS(wxPyHtmlFilter);
643public:
644 wxPyHtmlFilter() : wxHtmlFilter() {}
645
dd9f7fea 646 // returns True if this filter is able to open&read given file
1e4a197e 647 virtual bool CanRead(const wxFSFile& file) const {
a72f4631 648 bool rval = false;
1e4a197e 649 bool found;
6e6b3557 650 wxPyBlock_t blocked = wxPyBeginBlockThreads();
1e4a197e 651 if ((found = wxPyCBH_findCallback(m_myInst, "CanRead"))) {
6d450e1a 652 PyObject* obj = wxPyMake_wxObject((wxFSFile*)&file,false); // cast away const
1e4a197e
RD
653 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj));
654 Py_DECREF(obj);
655 }
da32eb53 656 wxPyEndBlockThreads(blocked);
1e4a197e
RD
657 return rval;
658 }
659
660
661 // Reads given file and returns HTML document.
662 // Returns empty string if opening failed
663 virtual wxString ReadFile(const wxFSFile& file) const {
664 wxString rval;
665 bool found;
6e6b3557 666 wxPyBlock_t blocked = wxPyBeginBlockThreads();
1e4a197e 667 if ((found = wxPyCBH_findCallback(m_myInst, "ReadFile"))) {
6d450e1a 668 PyObject* obj = wxPyMake_wxObject((wxFSFile*)&file,false); // cast away const
1e4a197e
RD
669 PyObject* ro;
670 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", obj));
671 Py_DECREF(obj);
672 if (ro) {
673 rval = Py2wxString(ro);
674 Py_DECREF(ro);
675 }
676 }
da32eb53 677 wxPyEndBlockThreads(blocked);
1e4a197e
RD
678 return rval;
679 }
680
681 PYPRIVATE;
682};
683
684IMPLEMENT_ABSTRACT_CLASS(wxPyHtmlFilter, wxHtmlFilter);
685%}
686
687
688// And now the version seen by SWIG
689
1b8c7ba6
RD
690%rename(HtmlFilter) wxPyHtmlFilter;
691class wxPyHtmlFilter : public wxObject {
1e4a197e 692public:
2b9048c5 693 %pythonAppend wxPyHtmlFilter "self._setCallbackInfo(self, HtmlFilter)"
1e4a197e
RD
694 wxPyHtmlFilter();
695
696 void _setCallbackInfo(PyObject* self, PyObject* _class);
1e4a197e
RD
697};
698
699
700// TODO: wxHtmlFilterHTML
701
702
0f66a9f3 703//---------------------------------------------------------------------------
1e4a197e 704// wxHtmlWindow
4b123bb9 705//---------------------------------------------------------------------------
d14a1e28 706%newgroup
4b123bb9 707
0f66a9f3
RD
708%{
709class wxPyHtmlWindow : public wxHtmlWindow {
cdf14688 710 DECLARE_ABSTRACT_CLASS(wxPyHtmlWindow);
0f66a9f3
RD
711public:
712 wxPyHtmlWindow(wxWindow *parent, wxWindowID id = -1,
713 const wxPoint& pos = wxDefaultPosition,
714 const wxSize& size = wxDefaultSize,
3ef86e32 715 long style = wxHW_DEFAULT_STYLE,
1e4a197e 716 const wxString& name = wxPyHtmlWindowNameStr)
0f66a9f3 717 : wxHtmlWindow(parent, id, pos, size, style, name) {};
7b7ac0ab 718 wxPyHtmlWindow() : wxHtmlWindow() {};
0f66a9f3 719
e5d41db0
RD
720 bool ScrollToAnchor(const wxString& anchor) {
721 return wxHtmlWindow::ScrollToAnchor(anchor);
722 }
723
724 bool HasAnchor(const wxString& anchor) {
725 const wxHtmlCell *c = m_Cell->Find(wxHTML_COND_ISANCHOR, &anchor);
726 return c!=NULL;
727 }
728
c8bc03c3
RD
729 void OnLinkClicked(const wxHtmlLinkInfo& link);
730 void base_OnLinkClicked(const wxHtmlLinkInfo& link);
9c00cfa3 731
e5d41db0 732 wxHtmlOpeningStatus OnOpeningURL(wxHtmlURLType type,
c6c593e8
RD
733 const wxString& url,
734 wxString *redirect) const;
735
9c00cfa3 736 DEC_PYCALLBACK__STRING(OnSetTitle);
0122b7e3
RD
737 DEC_PYCALLBACK__CELLINTINT(OnCellMouseHover);
738 DEC_PYCALLBACK__CELLINTINTME(OnCellClicked);
0f66a9f3
RD
739 PYPRIVATE;
740};
741
cdf14688 742IMPLEMENT_ABSTRACT_CLASS( wxPyHtmlWindow, wxHtmlWindow );
9c00cfa3 743IMP_PYCALLBACK__STRING(wxPyHtmlWindow, wxHtmlWindow, OnSetTitle);
0122b7e3
RD
744IMP_PYCALLBACK__CELLINTINT(wxPyHtmlWindow, wxHtmlWindow, OnCellMouseHover);
745IMP_PYCALLBACK__CELLINTINTME(wxPyHtmlWindow, wxHtmlWindow, OnCellClicked);
746
0f66a9f3 747
9416aa89 748void wxPyHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link) {
19a97bd6 749 bool found;
6e6b3557 750 wxPyBlock_t blocked = wxPyBeginBlockThreads();
0122b7e3 751 if ((found = wxPyCBH_findCallback(m_myInst, "OnLinkClicked"))) {
1e4a197e 752 PyObject* obj = wxPyConstructObject((void*)&link, wxT("wxHtmlLinkInfo"), 0);
1e7ecb7b 753 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj));
de20db99 754 Py_DECREF(obj);
9c00cfa3 755 }
da32eb53 756 wxPyEndBlockThreads(blocked);
19a97bd6 757 if (! found)
9c00cfa3 758 wxHtmlWindow::OnLinkClicked(link);
9c00cfa3 759}
c8bc03c3 760void wxPyHtmlWindow::base_OnLinkClicked(const wxHtmlLinkInfo& link) {
9c00cfa3
RD
761 wxHtmlWindow::OnLinkClicked(link);
762}
0122b7e3 763
c6c593e8
RD
764
765wxHtmlOpeningStatus wxPyHtmlWindow::OnOpeningURL(wxHtmlURLType type,
766 const wxString& url,
767 wxString *redirect) const {
768 bool found;
769 wxHtmlOpeningStatus rval;
6e6b3557 770 wxPyBlock_t blocked = wxPyBeginBlockThreads();
c6c593e8
RD
771 if ((found = wxPyCBH_findCallback(m_myInst, "OnOpeningURL"))) {
772 PyObject* ro;
a66212dc
RD
773 PyObject* s = wx2PyString(url);
774 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(iO)", type, s));
775 Py_DECREF(s);
c6c593e8
RD
776 if (PyString_Check(ro)
777#if PYTHON_API_VERSION >= 1009
778 || PyUnicode_Check(ro)
779#endif
780 ) {
a541c325 781 *redirect = Py2wxString(ro);
c6c593e8
RD
782 rval = wxHTML_REDIRECT;
783 }
784 else {
785 PyObject* num = PyNumber_Int(ro);
786 rval = (wxHtmlOpeningStatus)PyInt_AsLong(num);
787 Py_DECREF(num);
788 }
789 Py_DECREF(ro);
790 }
da32eb53 791 wxPyEndBlockThreads(blocked);
c6c593e8
RD
792 if (! found)
793 rval = wxHtmlWindow::OnOpeningURL(type, url, redirect);
794 return rval;
795}
796
797
0f66a9f3
RD
798%}
799
800
95837b4d 801
ab1f7d2a
RD
802MustHaveApp(wxPyHtmlWindow);
803
1b8c7ba6
RD
804%rename(HtmlWindow) wxPyHtmlWindow;
805class wxPyHtmlWindow : public wxScrolledWindow {
0f66a9f3 806public:
2b9048c5
RD
807 %pythonAppend wxPyHtmlWindow "self._setCallbackInfo(self, HtmlWindow); self._setOORInfo(self)"
808 %pythonAppend wxPyHtmlWindow() ""
b39c3fa0 809 %typemap(out) wxPyHtmlWindow*; // turn off this typemap
d14a1e28 810
0f66a9f3 811 wxPyHtmlWindow(wxWindow *parent, int id = -1,
d14a1e28
RD
812 const wxPoint& pos = wxDefaultPosition,
813 const wxSize& size = wxDefaultSize,
3ef86e32 814 int style=wxHW_DEFAULT_STYLE,
137b5242 815 const wxString& name = wxPyHtmlWindowNameStr);
1b8c7ba6 816 %RenameCtor(PreHtmlWindow, wxPyHtmlWindow());
7b7ac0ab 817
b39c3fa0
RD
818 // Turn it back on again
819 %typemap(out) wxPyHtmlWindow* { $result = wxPyMake_wxObject($1, $owner); }
820
7b7ac0ab 821 bool Create(wxWindow *parent, int id = -1,
d14a1e28
RD
822 const wxPoint& pos = wxDefaultPosition,
823 const wxSize& size = wxDefaultSize,
fc51b8c3 824 int style=wxHW_SCROLLBAR_AUTO,
137b5242 825 const wxString& name = wxPyHtmlWindowNameStr);
7b7ac0ab 826
0f66a9f3 827
0122b7e3 828 void _setCallbackInfo(PyObject* self, PyObject* _class);
0f66a9f3 829
d14a1e28 830
1e4a197e
RD
831 // Set HTML page and display it. !! source is HTML document itself,
832 // it is NOT address/filename of HTML document. If you want to
833 // specify document location, use LoadPage() istead
dd9f7fea 834 // Return value : False if an error occured, True otherwise
7a446686 835 bool SetPage(const wxString& source);
1e4a197e
RD
836
837 // Load HTML page from given location. Location can be either
838 // a) /usr/wxGTK2/docs/html/wx.htm
839 // b) http://www.somewhere.uk/document.htm
840 // c) ftp://ftp.somesite.cz/pub/something.htm
841 // In case there is no prefix (http:,ftp:), the method
842 // will try to find it itself (1. local file, then http or ftp)
843 // After the page is loaded, the method calls SetPage() to display it.
844 // Note : you can also use path relative to previously loaded page
845 // Return value : same as SetPage
7a446686 846 bool LoadPage(const wxString& location);
1e4a197e 847
9cbf6f6e 848 // Loads HTML page from file
1fded56b 849 bool LoadFile(const wxString& filename);
9cbf6f6e 850
1e4a197e 851 // Append to current page
de112a55 852 bool AppendToPage(const wxString& source);
1e4a197e
RD
853
854 // Returns full location of opened page
0f66a9f3 855 wxString GetOpenedPage();
1e4a197e
RD
856
857 // Returns anchor within opened page
7a446686 858 wxString GetOpenedAnchor();
1e4a197e
RD
859
860 // Returns <TITLE> of opened page or empty string otherwise
7a446686
RD
861 wxString GetOpenedPageTitle();
862
1e4a197e
RD
863 // Sets frame in which page title will be displayed. Format is format of
864 // frame title, e.g. "HtmlHelp : %s". It must contain exactly one %s
137b5242 865 void SetRelatedFrame(wxFrame* frame, const wxString& format);
0f66a9f3 866 wxFrame* GetRelatedFrame();
1e4a197e
RD
867
868 // After(!) calling SetRelatedFrame, this sets statusbar slot where messages
869 // will be displayed. Default is -1 = no messages.
0f66a9f3 870 void SetRelatedStatusBar(int bar);
f6bcfd97 871
1e4a197e 872 // Sets fonts to be used when displaying HTML page.
d14a1e28 873 %extend {
9cbf6f6e
RD
874 void SetFonts(wxString normal_face, wxString fixed_face, PyObject* sizes=NULL) {
875 int* temp = NULL;
876 if (sizes) temp = int_LIST_helper(sizes);
877 self->SetFonts(normal_face, fixed_face, temp);
878 if (temp)
f6bcfd97 879 delete [] temp;
f6bcfd97
BP
880 }
881 }
882
385721a8
RD
883 // Sets font sizes to be relative to the given size or the system
884 // default size; use either specified or default font
885 void SetStandardFonts(int size = -1,
886 const wxString& normal_face = wxPyEmptyString,
887 const wxString& fixed_face = wxPyEmptyString);
7acd3625 888
36c8c471
RD
889 DocDeclStr(
890 void, SetTitle(const wxString& title),
d07d2bc9 891 "", "");
1e4a197e
RD
892
893 // Sets space between text and window borders.
0f66a9f3 894 void SetBorders(int b);
1e4a197e 895
3136b082
RD
896 // Sets the bitmap to use for background (currnetly it will be tiled,
897 // when/if we have CSS support we could add other possibilities...)
898 void SetBackgroundImage(const wxBitmap& bmpBg);
899
1e4a197e
RD
900 // Saves custom settings into cfg config. it will use the path 'path'
901 // if given, otherwise it will save info into currently selected path.
902 // saved values : things set by SetFonts, SetBorders.
137b5242
RD
903 void ReadCustomization(wxConfigBase *cfg, wxString path = wxPyEmptyString);
904 void WriteCustomization(wxConfigBase *cfg, wxString path = wxPyEmptyString);
1e4a197e
RD
905
906 // Goes to previous/next page (in browsing history)
dd9f7fea 907 // Returns True if successful, False otherwise
0f66a9f3
RD
908 bool HistoryBack();
909 bool HistoryForward();
7a446686
RD
910 bool HistoryCanBack();
911 bool HistoryCanForward();
1e4a197e
RD
912
913 // Resets History
0f66a9f3 914 void HistoryClear();
1e4a197e
RD
915
916 // Returns pointer to conteiners/cells structure.
a65c6e14 917 wxHtmlContainerCell* GetInternalRepresentation();
1e4a197e
RD
918
919 // Returns a pointer to the parser.
e166644c
RD
920 wxHtmlWinParser* GetParser();
921
e5d41db0
RD
922 bool ScrollToAnchor(const wxString& anchor);
923 bool HasAnchor(const wxString& anchor);
924
1e4a197e
RD
925 //Adds input filter
926 static void AddFilter(wxPyHtmlFilter *filter);
927
927d7cfa
RD
928 // Helper functions to select parts of page:
929 void SelectWord(const wxPoint& pos);
930 void SelectLine(const wxPoint& pos);
931 void SelectAll();
1e4a197e 932
31ad423e
RD
933 // Convert selection to text:
934 wxString SelectionToText();
935
936 // Converts current page to text:
937 wxString ToText();
927d7cfa 938
c8bc03c3 939 void base_OnLinkClicked(const wxHtmlLinkInfo& link);
137b5242 940 void base_OnSetTitle(const wxString& title);
0122b7e3
RD
941 void base_OnCellMouseHover(wxHtmlCell *cell, wxCoord x, wxCoord y);
942 void base_OnCellClicked(wxHtmlCell *cell,
943 wxCoord x, wxCoord y,
944 const wxMouseEvent& event);
880715c9
RD
945
946 static wxVisualAttributes
947 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
4b123bb9
HH
948};
949
5ca24bf4 950
5ca24bf4 951
d14a1e28 952
dc2f8a65
RD
953//---------------------------------------------------------------------------
954//---------------------------------------------------------------------------
d14a1e28 955%newgroup
dc2f8a65
RD
956
957
ab1f7d2a
RD
958MustHaveApp(wxHtmlDCRenderer);
959
9416aa89 960class wxHtmlDCRenderer : public wxObject {
dc2f8a65
RD
961public:
962 wxHtmlDCRenderer();
963 ~wxHtmlDCRenderer();
964
965 void SetDC(wxDC *dc, int maxwidth);
966 void SetSize(int width, int height);
967 void SetHtmlText(const wxString& html,
137b5242 968 const wxString& basepath = wxPyEmptyString,
a72f4631 969 bool isdir = true);
1fded56b 970 // Sets fonts to be used when displaying HTML page. (if size null then default sizes used).
d14a1e28 971 %extend {
9cbf6f6e
RD
972 void SetFonts(wxString normal_face, wxString fixed_face, PyObject* sizes=NULL) {
973 int* temp = NULL;
974 if (sizes) temp = int_LIST_helper(sizes);
975 self->SetFonts(normal_face, fixed_face, temp);
976 if (temp)
977 delete [] temp;
978 }
979 }
7acd3625 980
385721a8
RD
981 // Sets font sizes to be relative to the given size or the system
982 // default size; use either specified or default font
983 void SetStandardFonts(int size = -1,
984 const wxString& normal_face = wxPyEmptyString,
985 const wxString& fixed_face = wxPyEmptyString);
7acd3625 986
020303e6 987 int Render(int x, int y, int from = 0, int dont_render = false, int maxHeight = INT_MAX,
3ef86e32
RD
988 //int *known_pagebreaks = NULL, int number_of_pages = 0
989 int* choices=NULL, int LCOUNT = 0
990 );
dc2f8a65
RD
991 int GetTotalHeight();
992 // returns total height of the html document
993 // (compare Render's return value with this)
994};
995
d14a1e28 996
dc2f8a65
RD
997enum {
998 wxPAGE_ODD,
999 wxPAGE_EVEN,
1000 wxPAGE_ALL
1001};
1002
1003
ab1f7d2a
RD
1004MustHaveApp(wxHtmlPrintout);
1005
dc2f8a65
RD
1006class wxHtmlPrintout : public wxPyPrintout {
1007public:
137b5242 1008 wxHtmlPrintout(const wxString& title = wxPyHtmlPrintoutTitleStr);
f3d9dc1d 1009 //~wxHtmlPrintout(); wxPrintPreview object takes ownership...
dc2f8a65
RD
1010
1011 void SetHtmlText(const wxString& html,
137b5242 1012 const wxString &basepath = wxPyEmptyString,
a72f4631 1013 bool isdir = true);
dc2f8a65
RD
1014 void SetHtmlFile(const wxString &htmlfile);
1015 void SetHeader(const wxString& header, int pg = wxPAGE_ALL);
1016 void SetFooter(const wxString& footer, int pg = wxPAGE_ALL);
d14a1e28 1017
1fded56b 1018 // Sets fonts to be used when displaying HTML page. (if size null then default sizes used).
d14a1e28 1019 %extend {
9cbf6f6e
RD
1020 void SetFonts(wxString normal_face, wxString fixed_face, PyObject* sizes=NULL) {
1021 int* temp = NULL;
1022 if (sizes) temp = int_LIST_helper(sizes);
1023 self->SetFonts(normal_face, fixed_face, temp);
1024 if (temp)
1025 delete [] temp;
1026 }
1027 }
7acd3625 1028
385721a8
RD
1029 // Sets font sizes to be relative to the given size or the system
1030 // default size; use either specified or default font
1031 void SetStandardFonts(int size = -1,
1032 const wxString& normal_face = wxPyEmptyString,
1033 const wxString& fixed_face = wxPyEmptyString);
7acd3625 1034
dc2f8a65
RD
1035 void SetMargins(float top = 25.2, float bottom = 25.2,
1036 float left = 25.2, float right = 25.2,
1037 float spaces = 5);
3ef86e32
RD
1038
1039 // Adds input filter
1040 static void AddFilter(wxHtmlFilter *filter);
1041
1042 // Cleanup
1043 static void CleanUpStatics();
dc2f8a65
RD
1044};
1045
1046
1047
ab1f7d2a
RD
1048MustHaveApp(wxHtmlEasyPrinting);
1049
9416aa89 1050class wxHtmlEasyPrinting : public wxObject {
dc2f8a65 1051public:
137b5242 1052 wxHtmlEasyPrinting(const wxString& name = wxPyHtmlPrintingTitleStr,
3ef86e32 1053 wxWindow *parentWindow = NULL);
dc2f8a65
RD
1054 ~wxHtmlEasyPrinting();
1055
1056 void PreviewFile(const wxString &htmlfile);
137b5242 1057 void PreviewText(const wxString &htmltext, const wxString& basepath = wxPyEmptyString);
dc2f8a65 1058 void PrintFile(const wxString &htmlfile);
137b5242 1059 void PrintText(const wxString &htmltext, const wxString& basepath = wxPyEmptyString);
7aada1e0 1060// void PrinterSetup();
dc2f8a65
RD
1061 void PageSetup();
1062 void SetHeader(const wxString& header, int pg = wxPAGE_ALL);
1063 void SetFooter(const wxString& footer, int pg = wxPAGE_ALL);
1064
d14a1e28 1065 %extend {
9cbf6f6e
RD
1066 void SetFonts(wxString normal_face, wxString fixed_face, PyObject* sizes=NULL) {
1067 int* temp = NULL;
1068 if (sizes) temp = int_LIST_helper(sizes);
1069 self->SetFonts(normal_face, fixed_face, temp);
1070 if (temp)
1071 delete [] temp;
1072 }
1073 }
1074
385721a8
RD
1075 // Sets font sizes to be relative to the given size or the system
1076 // default size; use either specified or default font
1077 void SetStandardFonts(int size = -1,
1078 const wxString& normal_face = wxPyEmptyString,
1079 const wxString& fixed_face = wxPyEmptyString);
7acd3625 1080
dc2f8a65
RD
1081 wxPrintData *GetPrintData() {return m_PrintData;}
1082 wxPageSetupDialogData *GetPageSetupData() {return m_PageSetupData;}
1083
1084};
1085
1086
0f66a9f3
RD
1087//---------------------------------------------------------------------------
1088//---------------------------------------------------------------------------
d14a1e28 1089%newgroup
5ca24bf4 1090
4b123bb9 1091
d14a1e28
RD
1092class wxHtmlBookRecord {
1093public:
1094 wxHtmlBookRecord(const wxString& bookfile, const wxString& basepath,
1095 const wxString& title, const wxString& start);
4b123bb9 1096
d14a1e28
RD
1097 wxString GetBookFile();
1098 wxString GetTitle();
1099 wxString GetStart();
1100 wxString GetBasePath();
1101
1102 void SetContentsRange(int start, int end);
1103 int GetContentsStart();
1104 int GetContentsEnd();
4b123bb9 1105
d14a1e28
RD
1106 void SetTitle(const wxString& title);
1107 void SetBasePath(const wxString& path);
1108 void SetStart(const wxString& start);
1109
1110 wxString GetFullPath(const wxString &page) const;
1111};
1112
1113//---------------------------------------------------------------------------
0f66a9f3 1114
d14a1e28
RD
1115struct wxHtmlContentsItem
1116{
1117 %extend {
1118 int GetLevel() { return self->m_Level; }
1119 int GetID() { return self->m_ID; }
1120 wxString GetName() { return self->m_Name; }
1121 wxString GetPage() { return self->m_Page; }
1122 wxHtmlBookRecord* GetBook() { return self->m_Book; }
1123 }
1124};
1125
1126//---------------------------------------------------------------------------
1127
1128class wxHtmlSearchStatus
1129{
1130public:
1131 //wxHtmlSearchStatus(wxHtmlHelpData* base, const wxString& keyword,
1132 // const wxString& book = wxPyEmptyString);
1133 bool Search();
1134 bool IsActive();
1135 int GetCurIndex();
1136 int GetMaxIndex();
1137 const wxString& GetName();
1138 wxHtmlContentsItem* GetContentsItem();
1139};
1140
1141//---------------------------------------------------------------------------
1142
1143class wxHtmlHelpData {
1144public:
1145 wxHtmlHelpData();
1146 ~wxHtmlHelpData();
1147
1148 void SetTempDir(const wxString& path);
1149 bool AddBook(const wxString& book);
1150// bool AddBookParam(const wxString& title, const wxString& contfile,
1151// const wxString& indexfile=wxPyEmptyString,
1152// const wxString& deftopic=wxPyEmptyString,
1153// const wxString& path=wxPyEmptyString);
1154
1155 wxString FindPageByName(const wxString& page);
1156 wxString FindPageById(int id);
1157
1158 // TODO: this one needs fixed...
1159 const wxHtmlBookRecArray& GetBookRecArray();
1160
1161 wxHtmlContentsItem* GetContents();
1162 int GetContentsCnt();
1163 wxHtmlContentsItem* GetIndex();
1164 int GetIndexCnt();
1165};
1166
1167//---------------------------------------------------------------------------
1168
ab1f7d2a
RD
1169MustHaveApp(wxHtmlHelpFrame);
1170
d14a1e28
RD
1171class wxHtmlHelpFrame : public wxFrame {
1172public:
2b9048c5 1173 %pythonAppend wxHtmlHelpFrame "self._setOORInfo(self)"
d14a1e28
RD
1174
1175 wxHtmlHelpFrame(wxWindow* parent, int wxWindowID,
1176 const wxString& title = wxPyEmptyString,
1177 int style = wxHF_DEFAULTSTYLE, wxHtmlHelpData* data = NULL);
1178
1179 wxHtmlHelpData* GetData();
1180 void SetTitleFormat(const wxString& format);
1181 void Display(const wxString& x);
1b8c7ba6 1182 %Rename(DisplayID, void, Display(int id));
d14a1e28
RD
1183 void DisplayContents();
1184 void DisplayIndex();
1185 bool KeywordSearch(const wxString& keyword);
1186 void UseConfig(wxConfigBase *config, const wxString& rootpath = wxPyEmptyString);
1187 void ReadCustomization(wxConfigBase *cfg, wxString path = wxPyEmptyString);
1188 void WriteCustomization(wxConfigBase *cfg, wxString path = wxPyEmptyString);
1189};
1190
1191
1192//---------------------------------------------------------------------------
1193
1194
1195enum {
1196 wxHF_TOOLBAR,
1197 wxHF_FLATTOOLBAR,
1198 wxHF_CONTENTS,
1199 wxHF_INDEX,
1200 wxHF_SEARCH,
1201 wxHF_BOOKMARKS,
1202 wxHF_OPENFILES,
1203 wxHF_PRINT,
1204 wxHF_DEFAULTSTYLE,
1205};
1206
1207
ab1f7d2a
RD
1208MustHaveApp(wxHtmlHelpController);
1209
3b03eb99
RD
1210class wxHtmlHelpController : public wxObject // wxHelpControllerBase
1211{
d14a1e28 1212public:
3b03eb99 1213// %pythonAppend wxHtmlHelpController "self._setOORInfo(self)"
d14a1e28
RD
1214
1215 wxHtmlHelpController(int style = wxHF_DEFAULTSTYLE);
1216 ~wxHtmlHelpController();
1217
1218 void SetTitleFormat(const wxString& format);
1219 void SetTempDir(const wxString& path);
a72f4631 1220 bool AddBook(const wxString& book, int show_wait_msg = false);
d14a1e28 1221 void Display(const wxString& x);
1b8c7ba6 1222 %Rename(DisplayID, void, Display(int id));
d14a1e28
RD
1223 void DisplayContents();
1224 void DisplayIndex();
1225 bool KeywordSearch(const wxString& keyword);
1226 void UseConfig(wxConfigBase *config, const wxString& rootpath = wxPyEmptyString);
1227 void ReadCustomization(wxConfigBase *cfg, wxString path = wxPyEmptyString);
1228 void WriteCustomization(wxConfigBase *cfg, wxString path = wxPyEmptyString);
1229 wxHtmlHelpFrame* GetFrame();
1230};
1231
1232
1233
1234
1235//---------------------------------------------------------------------------
1236%init %{
1237 wxPyPtrTypeMap_Add("wxHtmlTagHandler", "wxPyHtmlTagHandler");
9416aa89 1238 wxPyPtrTypeMap_Add("wxHtmlWinTagHandler", "wxPyHtmlWinTagHandler");
d14a1e28
RD
1239 wxPyPtrTypeMap_Add("wxHtmlWindow", "wxPyHtmlWindow");
1240 wxPyPtrTypeMap_Add("wxHtmlFilter", "wxPyHtmlFilter");
4b123bb9 1241%}
d14a1e28
RD
1242//---------------------------------------------------------------------------
1243//---------------------------------------------------------------------------
4b123bb9 1244
e166644c 1245
e166644c 1246