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