]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: htmlhelp.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 htmlhelp | |
15 | ||
16 | %{ | |
17 | #include "wxPython.h" | |
18 | #include <wx/html/htmlwin.h> | |
19 | #include <wx/html/helpctrl.h> | |
20 | #include <wx/image.h> | |
21 | #include <wx/fs_zip.h> | |
22 | #include <wx/fs_inet.h> | |
23 | #include <wx/wfstream.h> | |
24 | %} | |
25 | ||
26 | //--------------------------------------------------------------------------- | |
27 | %{ | |
28 | // Put some wx default wxChar* values into wxStrings. | |
29 | static const wxString wxPyEmptyString(wxT("")); | |
30 | %} | |
31 | //--------------------------------------------------------------------------- | |
32 | ||
33 | %include typemaps.i | |
34 | %include my_typemaps.i | |
35 | ||
36 | %extern wx.i | |
37 | %extern windows.i | |
38 | %extern frames.i | |
39 | %extern _defs.i | |
40 | %extern events.i | |
41 | %extern controls.i | |
42 | %extern controls2.i | |
43 | ||
44 | %extern utils.i | |
45 | %extern html.i | |
46 | ||
47 | ||
48 | //--------------------------------------------------------------------------- | |
49 | ||
50 | class wxHtmlBookRecord { | |
51 | public: | |
52 | wxHtmlBookRecord(const wxString& bookfile, const wxString& basepath, | |
53 | const wxString& title, const wxString& start); | |
54 | ||
55 | wxString GetBookFile(); | |
56 | wxString GetTitle(); | |
57 | wxString GetStart(); | |
58 | wxString GetBasePath(); | |
59 | ||
60 | void SetContentsRange(int start, int end); | |
61 | int GetContentsStart(); | |
62 | int GetContentsEnd(); | |
63 | ||
64 | void SetTitle(const wxString& title); | |
65 | void SetBasePath(const wxString& path); | |
66 | void SetStart(const wxString& start); | |
67 | ||
68 | wxString GetFullPath(const wxString &page) const; | |
69 | }; | |
70 | ||
71 | //--------------------------------------------------------------------------- | |
72 | ||
73 | struct wxHtmlContentsItem | |
74 | { | |
75 | %addmethods { | |
76 | int GetLevel() { return self->m_Level; } | |
77 | int GetID() { return self->m_ID; } | |
78 | wxString GetName() { return self->m_Name; } | |
79 | wxString GetPage() { return self->m_Page; } | |
80 | wxHtmlBookRecord* GetBook() { return self->m_Book; } | |
81 | } | |
82 | }; | |
83 | ||
84 | //--------------------------------------------------------------------------- | |
85 | ||
86 | class wxHtmlSearchStatus | |
87 | { | |
88 | public: | |
89 | //wxHtmlSearchStatus(wxHtmlHelpData* base, const wxString& keyword, | |
90 | // const wxString& book = wxPyEmptyString); | |
91 | bool Search(); | |
92 | bool IsActive(); | |
93 | int GetCurIndex(); | |
94 | int GetMaxIndex(); | |
95 | const wxString& GetName(); | |
96 | wxHtmlContentsItem* GetContentsItem(); | |
97 | }; | |
98 | ||
99 | //--------------------------------------------------------------------------- | |
100 | ||
101 | class wxHtmlHelpData { | |
102 | public: | |
103 | wxHtmlHelpData(); | |
104 | ~wxHtmlHelpData(); | |
105 | ||
106 | void SetTempDir(const wxString& path); | |
107 | bool AddBook(const wxString& book); | |
108 | // bool AddBookParam(const wxString& title, const wxString& contfile, | |
109 | // const wxString& indexfile=wxPyEmptyString, | |
110 | // const wxString& deftopic=wxPyEmptyString, | |
111 | // const wxString& path=wxPyEmptyString); | |
112 | ||
113 | wxString FindPageByName(const wxString& page); | |
114 | wxString FindPageById(int id); | |
115 | ||
116 | // TODO: this one needs fixed... | |
117 | const wxHtmlBookRecArray& GetBookRecArray(); | |
118 | ||
119 | wxHtmlContentsItem* GetContents(); | |
120 | int GetContentsCnt(); | |
121 | wxHtmlContentsItem* GetIndex(); | |
122 | int GetIndexCnt(); | |
123 | }; | |
124 | ||
125 | //--------------------------------------------------------------------------- | |
126 | ||
127 | class wxHtmlHelpFrame : public wxFrame { | |
128 | public: | |
129 | wxHtmlHelpFrame(wxWindow* parent, int wxWindowID, | |
130 | const wxString& title = wxPyEmptyString, | |
131 | int style = wxHF_DEFAULTSTYLE, wxHtmlHelpData* data = NULL); | |
132 | ||
133 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
134 | ||
135 | wxHtmlHelpData* GetData(); | |
136 | void SetTitleFormat(const wxString& format); | |
137 | void Display(const wxString& x); | |
138 | %name(DisplayID) void Display(int id); | |
139 | void DisplayContents(); | |
140 | void DisplayIndex(); | |
141 | bool KeywordSearch(const wxString& keyword); | |
142 | void UseConfig(wxConfigBase *config, const wxString& rootpath = wxPyEmptyString); | |
143 | void ReadCustomization(wxConfigBase *cfg, wxString path = wxPyEmptyString); | |
144 | void WriteCustomization(wxConfigBase *cfg, wxString path = wxPyEmptyString); | |
145 | }; | |
146 | ||
147 | ||
148 | //--------------------------------------------------------------------------- | |
149 | ||
150 | ||
151 | enum { | |
152 | wxHF_TOOLBAR, | |
153 | wxHF_FLATTOOLBAR, | |
154 | wxHF_CONTENTS, | |
155 | wxHF_INDEX, | |
156 | wxHF_SEARCH, | |
157 | wxHF_BOOKMARKS, | |
158 | wxHF_OPENFILES, | |
159 | wxHF_PRINT, | |
160 | wxHF_DEFAULTSTYLE, | |
161 | }; | |
162 | ||
163 | ||
164 | class wxHtmlHelpController : public wxEvtHandler { | |
165 | public: | |
166 | wxHtmlHelpController(int style = wxHF_DEFAULTSTYLE); | |
167 | ~wxHtmlHelpController(); | |
168 | ||
169 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
170 | ||
171 | void SetTitleFormat(const wxString& format); | |
172 | void SetTempDir(const wxString& path); | |
173 | bool AddBook(const wxString& book, int show_wait_msg = FALSE); | |
174 | void Display(const wxString& x); | |
175 | %name(DisplayID) void Display(int id); | |
176 | void DisplayContents(); | |
177 | void DisplayIndex(); | |
178 | bool KeywordSearch(const wxString& keyword); | |
179 | void UseConfig(wxConfigBase *config, const wxString& rootpath = wxPyEmptyString); | |
180 | void ReadCustomization(wxConfigBase *cfg, wxString path = wxPyEmptyString); | |
181 | void WriteCustomization(wxConfigBase *cfg, wxString path = wxPyEmptyString); | |
182 | wxHtmlHelpFrame* GetFrame(); | |
183 | }; | |
184 | ||
185 | //--------------------------------------------------------------------------- | |
186 | //--------------------------------------------------------------------------- |