]> git.saurik.com Git - wxWidgets.git/blob - include/wx/html/helpctrl.h
added wxHTML
[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 DECLARE_DYNAMIC_CLASS(wxHtmlHelpController)
29
30 public:
31 wxHtmlHelpController();
32 virtual ~wxHtmlHelpController();
33
34 void SetTitleFormat(const wxString& format);
35 void SetTempDir(const wxString& path) { m_helpData.SetTempDir(path); }
36 bool AddBook(const wxString& book, bool show_wait_msg = FALSE);
37 bool Display(const wxString& x) {
38 CreateHelpWindow(); return m_helpFrame->Display(x);
39 }
40 bool Display(int id) {
41 CreateHelpWindow(); return m_helpFrame->Display(id);
42 }
43 bool DisplayContents() {
44 CreateHelpWindow(); return m_helpFrame->DisplayContents();
45 }
46 bool DisplayIndex() {
47 CreateHelpWindow(); return m_helpFrame->DisplayIndex();
48 }
49 bool KeywordSearch(const wxString& keyword) {
50 CreateHelpWindow(); return KeywordSearch(keyword);
51 }
52 wxHtmlHelpFrame* GetFrame() { return m_helpFrame; }
53 void UseConfig(wxConfigBase *config, const wxString& rootpath = wxEmptyString) {
54 m_Config = config; m_ConfigRoot = rootpath;
55 ReadCustomization(config, rootpath);
56 }
57 // Assigns config object to the Ctrl. This config is then
58 // used in subsequent calls to Read/WriteCustomization of both help
59 // Ctrl and it's wxHtmlWindow
60 virtual void ReadCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString);
61 virtual void WriteCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString);
62 virtual void CreateHelpWindow(bool show_progress = FALSE);
63 virtual void DestroyHelpWindow() {
64 //if (m_Config) WriteCustomization(m_Config, m_ConfigRoot);
65 if (m_helpFrame) m_helpFrame->Destroy();
66 }
67 protected:
68 void OnCloseFrame(wxCloseEvent& evt) { m_helpFrame = NULL; evt.Skip(); }
69 wxHtmlHelpData m_helpData;
70 wxHtmlHelpFrame* m_helpFrame;
71 wxConfigBase *m_Config;
72 wxString m_ConfigRoot;
73 wxString m_titleFormat;
74 DECLARE_EVENT_TABLE()
75 };
76
77 #endif
78
79 #endif // _WX_HELPCTRL_H_