]>
Commit | Line | Data |
---|---|---|
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 | // RCS-ID: $Id$ | |
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__ | |
18 | #pragma interface | |
19 | #endif | |
20 | ||
21 | #if wxUSE_HTML | |
22 | ||
23 | #include "wx/html/helpfrm.h" | |
24 | ||
25 | class WXDLLEXPORT wxHtmlHelpController : public wxEvtHandler | |
26 | { | |
27 | DECLARE_DYNAMIC_CLASS(wxHtmlHelpController) | |
28 | ||
29 | public: | |
30 | wxHtmlHelpController(int style = wxHF_DEFAULTSTYLE); | |
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); | |
36 | bool Display(const wxString& x) | |
37 | { | |
38 | CreateHelpWindow(); return m_helpFrame->Display(x); | |
39 | } | |
40 | bool Display(int id) | |
41 | { | |
42 | CreateHelpWindow(); return m_helpFrame->Display(id); | |
43 | } | |
44 | bool DisplayContents() | |
45 | { | |
46 | CreateHelpWindow(); return m_helpFrame->DisplayContents(); | |
47 | } | |
48 | bool DisplayIndex() | |
49 | { | |
50 | CreateHelpWindow(); return m_helpFrame->DisplayIndex(); | |
51 | } | |
52 | bool KeywordSearch(const wxString& keyword) | |
53 | { | |
54 | CreateHelpWindow(); return m_helpFrame->KeywordSearch(keyword); | |
55 | } | |
56 | wxHtmlHelpFrame* GetFrame() { return m_helpFrame; } | |
57 | void UseConfig(wxConfigBase *config, const wxString& rootpath = wxEmptyString) | |
58 | { | |
59 | m_Config = config; | |
60 | m_ConfigRoot = rootpath; | |
61 | if (m_helpFrame) m_helpFrame -> UseConfig(config, rootpath); | |
62 | ReadCustomization(config, rootpath); | |
63 | } | |
64 | // Assigns config object to the Ctrl. This config is then | |
65 | // used in subsequent calls to Read/WriteCustomization of both help | |
66 | // Ctrl and it's wxHtmlWindow | |
67 | virtual void ReadCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString); | |
68 | virtual void WriteCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString); | |
69 | ||
70 | protected: | |
71 | virtual void CreateHelpWindow(); | |
72 | virtual void DestroyHelpWindow() | |
73 | { | |
74 | //if (m_Config) WriteCustomization(m_Config, m_ConfigRoot); | |
75 | if (m_helpFrame) m_helpFrame->Destroy(); | |
76 | } | |
77 | ||
78 | void OnCloseFrame(wxCloseEvent& evt) { m_helpFrame = NULL; evt.Skip(); } | |
79 | wxHtmlHelpData m_helpData; | |
80 | wxHtmlHelpFrame* m_helpFrame; | |
81 | wxConfigBase *m_Config; | |
82 | wxString m_ConfigRoot; | |
83 | wxString m_titleFormat; | |
84 | int m_FrameStyle; | |
85 | DECLARE_EVENT_TABLE() | |
86 | }; | |
87 | ||
88 | #endif | |
89 | ||
90 | #endif // _WX_HELPCTRL_H_ |