]>
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 | ||
16a12a3d | 23 | #include "wx/html/helpfrm.h" |
b4414c1f | 24 | #include "wx/helpbase.h" |
8ec2b484 | 25 | |
b4414c1f | 26 | class WXDLLEXPORT wxHtmlHelpController : public wxHelpControllerBase // wxEvtHandler |
8ec2b484 | 27 | { |
d5bb85a0 | 28 | DECLARE_DYNAMIC_CLASS(wxHtmlHelpController) |
f42b1601 | 29 | |
d5bb85a0 VS |
30 | public: |
31 | wxHtmlHelpController(int style = wxHF_DEFAULTSTYLE); | |
32 | virtual ~wxHtmlHelpController(); | |
8ec2b484 | 33 | |
d5bb85a0 VS |
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 | { | |
39 | CreateHelpWindow(); return m_helpFrame->Display(x); | |
40 | } | |
41 | bool Display(int id) | |
42 | { | |
43 | CreateHelpWindow(); return m_helpFrame->Display(id); | |
44 | } | |
45 | bool DisplayContents() | |
46 | { | |
47 | CreateHelpWindow(); return m_helpFrame->DisplayContents(); | |
48 | } | |
49 | bool DisplayIndex() | |
50 | { | |
51 | CreateHelpWindow(); return m_helpFrame->DisplayIndex(); | |
52 | } | |
53 | bool KeywordSearch(const wxString& keyword) | |
54 | { | |
64d84708 | 55 | CreateHelpWindow(); return m_helpFrame->KeywordSearch(keyword); |
d5bb85a0 VS |
56 | } |
57 | wxHtmlHelpFrame* GetFrame() { return m_helpFrame; } | |
721ab905 VS |
58 | void UseConfig(wxConfigBase *config, const wxString& rootpath = wxEmptyString); |
59 | ||
d5bb85a0 VS |
60 | // Assigns config object to the Ctrl. This config is then |
61 | // used in subsequent calls to Read/WriteCustomization of both help | |
62 | // Ctrl and it's wxHtmlWindow | |
63 | virtual void ReadCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString); | |
64 | virtual void WriteCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString); | |
052e12db | 65 | |
b4414c1f JS |
66 | //// Backward compatibility with wxHelpController API |
67 | ||
68 | virtual bool Initialize(const wxString& file, int WXUNUSED(server) ) { return Initialize(file); } | |
69 | virtual bool Initialize(const wxString& file); | |
70 | virtual void SetViewer(const wxString& WXUNUSED(viewer), long WXUNUSED(flags) = 0) {} | |
71 | virtual bool LoadFile(const wxString& file = ""); | |
72 | virtual bool DisplaySection(int sectionNo); | |
73 | virtual bool DisplayBlock(long blockNo) { return DisplaySection(blockNo); } | |
74 | virtual void SetFrameParameters(const wxString& title, | |
75 | const wxSize& size, | |
76 | const wxPoint& pos = wxDefaultPosition, | |
77 | bool newFrameEachTime = FALSE); | |
78 | /// Obtains the latest settings used by the help frame and the help | |
79 | /// frame. | |
80 | virtual wxFrame *GetFrameParameters(wxSize *size = NULL, | |
81 | wxPoint *pos = NULL, | |
82 | bool *newFrameEachTime = NULL); | |
83 | virtual bool Quit() ; | |
84 | virtual void OnQuit() {}; | |
85 | ||
86 | void OnCloseFrame(wxCloseEvent& evt); | |
052e12db | 87 | protected: |
b854b7b8 VS |
88 | virtual wxHtmlHelpFrame* CreateHelpFrame(wxHtmlHelpData *data); |
89 | ||
052e12db | 90 | virtual void CreateHelpWindow(); |
b854b7b8 | 91 | virtual void DestroyHelpWindow(); |
d5bb85a0 | 92 | |
b4414c1f JS |
93 | wxHtmlHelpData m_helpData; |
94 | wxHtmlHelpFrame* m_helpFrame; | |
95 | wxConfigBase * m_Config; | |
96 | wxString m_ConfigRoot; | |
97 | wxString m_titleFormat; | |
98 | int m_FrameStyle; | |
99 | // DECLARE_EVENT_TABLE() | |
8ec2b484 HH |
100 | }; |
101 | ||
f42b1601 | 102 | #endif |
8ec2b484 HH |
103 | |
104 | #endif // _WX_HELPCTRL_H_ |