1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: SWIG definitions of html classes
7 // Created: 25-nov-1998
9 // Copyright: (c) 1998 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
18 #include <wx/html/htmlwin.h>
19 #include <wx/html/helpctrl.h>
21 #include <wx/fs_zip.h>
22 #include <wx/fs_inet.h>
23 #include <wx/wfstream.h>
26 //---------------------------------------------------------------------------
29 %include my_typemaps.i
43 //---------------------------------------------------------------------------
56 wxID_HTML_SEARCHBUTTON
59 //---------------------------------------------------------------------------
61 class wxHtmlHelpFrameCfg
74 //---------------------------------------------------------------------------
76 class wxHtmlBookRecord {
78 wxHtmlBookRecord(const wxString& basepath, const wxString& title,
79 const wxString& start);
83 wxString GetBasePath();
85 void SetContentsRange(int start, int end);
86 int GetContentsStart();
90 //---------------------------------------------------------------------------
98 wxHtmlBookRecord *m_Book;
101 //---------------------------------------------------------------------------
103 class wxHtmlSearchStatus
106 //wxHtmlSearchStatus(wxHtmlHelpData* base, const wxString& keyword,
107 // const wxString& book = wxEmptyString);
112 const wxString& GetName();
113 wxHtmlContentsItem* GetContentsItem();
116 //---------------------------------------------------------------------------
118 class wxHtmlHelpData {
123 void SetTempDir(const wxString& path);
124 bool AddBook(const wxString& book);
125 bool AddBookParam(const wxString& title, const wxString& contfile,
126 const wxString& indexfile=wxEmptyString,
127 const wxString& deftopic=wxEmptyString,
128 const wxString& path=wxEmptyString);
130 wxString FindPageByName(const wxString& page);
131 wxString FindPageById(int id);
133 // **** this one needs fixed...
134 const wxHtmlBookRecArray& GetBookRecArray();
136 wxHtmlContentsItem* GetContents();
137 int GetContentsCnt();
138 wxHtmlContentsItem* GetIndex();
142 //---------------------------------------------------------------------------
144 class wxHtmlHelpFrame : public wxFrame {
146 wxHtmlHelpFrame(wxWindow* parent, int wxWindowID,
147 const wxString& title = wxEmptyString,
148 int style = wxHF_DEFAULTSTYLE, wxHtmlHelpData* data = NULL);
150 wxHtmlHelpData* GetData();
151 void SetTitleFormat(const wxString& format);
152 void Display(const wxString& x);
153 %name(DisplayID) void Display(int id);
154 void DisplayContents();
156 bool KeywordSearch(const wxString& keyword);
157 void RefreshLists(int show_progress = FALSE);
158 void CreateContents(int show_progress = FALSE);
159 void CreateIndex(int show_progress = FALSE);
161 void UseConfig(wxConfigBase *config, const wxString& rootpath = wxEmptyString);
162 void ReadCustomization(wxConfigBase *cfg, wxString path = wxEmptyString);
163 void WriteCustomization(wxConfigBase *cfg, wxString path = wxEmptyString);
167 //---------------------------------------------------------------------------
169 class wxHtmlHelpController : public wxEvtHandler {
171 wxHtmlHelpController();
172 ~wxHtmlHelpController();
174 void SetTitleFormat(const wxString& format);
175 void SetTempDir(const wxString& path);
176 bool AddBook(const wxString& book, int show_wait_msg = FALSE);
177 void Display(const wxString& x);
178 %name(DisplayID) void Display(int id);
179 void DisplayContents();
181 bool KeywordSearch(const wxString& keyword);
182 void UseConfig(wxConfigBase *config, const wxString& rootpath = wxEmptyString);
183 void ReadCustomization(wxConfigBase *cfg, wxString path = wxEmptyString);
184 void WriteCustomization(wxConfigBase *cfg, wxString path = wxEmptyString);
185 wxHtmlHelpFrame* GetFrame();
186 void CreateHelpWindow(int show_progress = FALSE);
189 //---------------------------------------------------------------------------
205 #ifdef DO_WE_NEED_TO_KEEP_THIS
206 class wxHtmlHelpSystem : public wxHtmlHelpController {
208 wxHtmlHelpSystem() {};
209 ~wxHtmlHelpSystem() {};
211 bool AddBookParam(const wxString& title, const wxString& contfile,
212 const wxString& indexfile=wxEmptyString, const wxString& deftopic=wxEmptyString,
213 const wxString& path=wxEmptyString, bool show_wait_msg=FALSE);
214 // Alternative to AddBook(wxString& hhpfile)
215 wxToolBar* CreateToolBar(wxFrame* frame);
216 // creates a dockable toolbar for the frame, containing hide/show, back and forward buttons
217 wxTreeCtrl* CreateContentsTree(wxWindow* parent);
218 // creates a treecontrol with imagelist for books, folders etc and id wxID_HTML_TREECTRL
219 wxListBox* CreateIndexList(wxWindow* parent);
220 // creates a listbox with the right id
221 virtual void CreateHelpWindow();
222 // Slightly different version than in wxHtmlHelpController; uses helpers above
223 // Do nothing if the window already exists
224 void SetControls(wxFrame* frame, wxHtmlWindow* htmlwin,
225 wxTreeCtrl* contents=NULL, wxListBox* index=NULL,
226 wxListBox* searchlist=NULL);
227 // alternative for CreateHelpWindow(), sets frame, htmlwindow, contents tree, index
228 // listbox and searchlist listbox. If null, their functionality won't be used
230 // Some extra accessor functions
231 wxFrame* GetFrame() { return m_Frame; }
232 wxHtmlWindow* GetHtmlWindow() { return m_HtmlWin; }
233 wxTreeCtrl* GetContentsTree() { return m_ContentsBox; }
234 wxListBox* GetIndexList() { return m_IndexBox; }
235 wxListBox* GetSearchList() { return m_SearchList; }
236 wxImageList* GetContentsImageList() { return m_ContentsImageList; }
237 // public interface for wxHtmlHelpControllers handlers, so wxPython can call them
238 void OnToolbar(wxCommandEvent& event);
239 void OnContentsSel(wxTreeEvent& event) {wxHtmlHelpController::OnContentsSel(event);}
240 void OnIndexSel(wxCommandEvent& event) {wxHtmlHelpController::OnIndexSel(event);}
241 void OnSearchSel(wxCommandEvent& event) {wxHtmlHelpController::OnSearchSel(event);}
242 void OnSearch(wxCommandEvent& event) {wxHtmlHelpController::OnSearch(event);}
243 void OnCloseWindow(wxCloseEvent& event);
245 // some more protected functions that should be accessible from wxPython
247 void CreateContents() { if (!m_IndexBox) return; wxHtmlHelpController::CreateContents(); }
248 // Adds items to m_Contents tree control
249 void CreateIndex() { if (! m_ContentsBox) return; wxHtmlHelpController::CreateIndex(); }
250 // Adds items to m_IndexList
253 // just for fun, an Altavista-like search engine (the gems that Vaclav has hidden in wxHtml...)
254 // but not for wxMSW because it's not DLL exported
256 #ifdef THIS_IS_NOT_DEFINED_OKAY
260 wxSearchEngine() : wxObject() {m_Keyword = NULL;}
261 ~wxSearchEngine() {if (m_Keyword) free(m_Keyword);}
263 void LookFor(const wxString& keyword);
264 // Sets the keyword we will be searching for
266 bool Scan(wxInputStream *stream);
267 // Scans the stream for the keyword.
268 // Returns TRUE if the stream contains keyword, fALSE otherwise
270 bool ScanFile(const wxString& filename) {
271 if (filename.IsEmpty())
273 wxFileInputStream istr(filename);
274 return self->Scan(&istr);
280 //---------------------------------------------------------------------------