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