New HTML help system. The old controller class has been split in
[wxWidgets.git] / include / wx / html / helpctrl.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: helpctrl.h
3 // Purpose: wxHtmlHelpController
4 // Notes: Based on htmlhelp.cpp, implementing a monolithic
5 // HTML Help controller class, by Vaclav Slavik
6 // Author: Harm van der Heijden and Vaclav Slavik
7 // Created:
8 // RCS-ID:
9 // Copyright: (c) Harm van der Heijden and Vaclav Slavik
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////////
12
13 #ifndef _WX_HELPCTRL_H_
14 #define _WX_HELPCTRL_H_
15
16 #include "wx/defs.h"
17
18 #ifdef __GNUG__
19 #pragma interface "helpctrl.h"
20 #endif
21
22 #if wxUSE_HTML
23
24 #include "helpfrm.h"
25
26 class WXDLLEXPORT wxHtmlHelpController : public wxEvtHandler
27 {
28 public:
29 wxHtmlHelpController();
30 virtual ~wxHtmlHelpController();
31
32 void SetTitleFormat(const wxString& format);
33 void SetTempDir(const wxString& path) { m_helpData.SetTempDir(path); }
34 bool AddBook(const wxString& book, bool show_wait_msg = FALSE);
35 bool Display(const wxString& x) {
36 CreateHelpWindow(); return m_helpFrame->Display(x);
37 }
38 bool Display(int id) {
39 CreateHelpWindow(); return m_helpFrame->Display(id);
40 }
41 bool DisplayContents() {
42 CreateHelpWindow(); return m_helpFrame->DisplayContents();
43 }
44 bool DisplayIndex() {
45 CreateHelpWindow(); return m_helpFrame->DisplayIndex();
46 }
47 bool KeywordSearch(const wxString& keyword) {
48 CreateHelpWindow(); return KeywordSearch(keyword);
49 }
50 wxHtmlHelpFrame* GetFrame() { return m_helpFrame; }
51 void UseConfig(wxConfigBase *config, const wxString& rootpath = wxEmptyString) {
52 m_Config = config; m_ConfigRoot = rootpath;
53 ReadCustomization(config, rootpath);
54 }
55 // Assigns config object to the Ctrl. This config is then
56 // used in subsequent calls to Read/WriteCustomization of both help
57 // Ctrl and it's wxHtmlWindow
58 virtual void ReadCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString);
59 virtual void WriteCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString);
60 virtual void CreateHelpWindow(bool show_progress = FALSE);
61 virtual void DestroyHelpWindow() {
62 //if (m_Config) WriteCustomization(m_Config, m_ConfigRoot);
63 if (m_helpFrame) m_helpFrame->Destroy();
64 }
65 protected:
66 void OnCloseFrame(wxCloseEvent& evt) { m_helpFrame = NULL; evt.Skip(); }
67 wxHtmlHelpData m_helpData;
68 wxHtmlHelpFrame* m_helpFrame;
69 wxConfigBase *m_Config;
70 wxString m_ConfigRoot;
71 wxString m_titleFormat;
72 DECLARE_EVENT_TABLE()
73 };
74
75 #endif
76
77 #endif // _WX_HELPCTRL_H_