]>
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 | 8 | // Copyright: (c) Harm van der Heijden and Vaclav Slavik |
65571936 | 9 | // Licence: wxWindows licence |
8ec2b484 HH |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_HELPCTRL_H_ | |
13 | #define _WX_HELPCTRL_H_ | |
14 | ||
15 | #include "wx/defs.h" | |
16 | ||
12028905 | 17 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
97494971 | 18 | #pragma interface "helpctrl.h" |
8ec2b484 HH |
19 | #endif |
20 | ||
3abf2c72 | 21 | #if wxUSE_WXHTML_HELP |
8ec2b484 | 22 | |
b4414c1f | 23 | #include "wx/helpbase.h" |
69b5cec2 | 24 | #include "wx/html/helpfrm.h" |
8ec2b484 | 25 | |
576507e2 VS |
26 | #define wxID_HTML_HELPFRAME (wxID_HIGHEST + 1) |
27 | ||
6acba9a7 | 28 | class WXDLLIMPEXP_HTML wxHtmlHelpController : public wxHelpControllerBase // wxEvtHandler |
8ec2b484 | 29 | { |
97494971 VS |
30 | DECLARE_DYNAMIC_CLASS(wxHtmlHelpController) |
31 | ||
32 | public: | |
576507e2 | 33 | wxHtmlHelpController(int style = wxHF_DEFAULT_STYLE); |
97494971 VS |
34 | virtual ~wxHtmlHelpController(); |
35 | ||
36 | void SetTitleFormat(const wxString& format); | |
37 | void SetTempDir(const wxString& path) { m_helpData.SetTempDir(path); } | |
6953da00 WS |
38 | bool AddBook(const wxString& book_url, bool show_wait_msg = false); |
39 | bool AddBook(const wxFileName& book_file, bool show_wait_msg = false); | |
5152b0e5 JS |
40 | |
41 | bool Display(const wxString& x); | |
42 | bool Display(int id); | |
43 | bool DisplayContents(); | |
44 | bool DisplayIndex(); | |
69b5cec2 VS |
45 | bool KeywordSearch(const wxString& keyword, |
46 | wxHelpSearchMode mode = wxHELP_SEARCH_ALL); | |
5152b0e5 | 47 | |
97494971 VS |
48 | wxHtmlHelpFrame* GetFrame() { return m_helpFrame; } |
49 | void UseConfig(wxConfigBase *config, const wxString& rootpath = wxEmptyString); | |
50 | ||
51 | // Assigns config object to the Ctrl. This config is then | |
52 | // used in subsequent calls to Read/WriteCustomization of both help | |
53 | // Ctrl and it's wxHtmlWindow | |
54 | virtual void ReadCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString); | |
55 | virtual void WriteCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString); | |
56 | ||
57 | //// Backward compatibility with wxHelpController API | |
58 | ||
59 | virtual bool Initialize(const wxString& file, int WXUNUSED(server) ) { return Initialize(file); } | |
60 | virtual bool Initialize(const wxString& file); | |
61 | virtual void SetViewer(const wxString& WXUNUSED(viewer), long WXUNUSED(flags) = 0) {} | |
2b5f62a0 | 62 | virtual bool LoadFile(const wxString& file = wxT("")); |
97494971 VS |
63 | virtual bool DisplaySection(int sectionNo); |
64 | virtual bool DisplaySection(const wxString& section) { return Display(section); } | |
65 | virtual bool DisplayBlock(long blockNo) { return DisplaySection(blockNo); } | |
66 | virtual bool DisplayTextPopup(const wxString& text, const wxPoint& pos); | |
67 | ||
68 | virtual void SetFrameParameters(const wxString& title, | |
69 | const wxSize& size, | |
70 | const wxPoint& pos = wxDefaultPosition, | |
6953da00 | 71 | bool newFrameEachTime = false); |
97494971 VS |
72 | /// Obtains the latest settings used by the help frame and the help |
73 | /// frame. | |
74 | virtual wxFrame *GetFrameParameters(wxSize *size = NULL, | |
75 | wxPoint *pos = NULL, | |
76 | bool *newFrameEachTime = NULL); | |
77 | ||
219a5f10 VS |
78 | // Get direct access to help data: |
79 | wxHtmlHelpData *GetHelpData() { return &m_helpData; } | |
97494971 VS |
80 | |
81 | virtual bool Quit() ; | |
6fb99eb3 | 82 | virtual void OnQuit() {} |
97494971 VS |
83 | |
84 | void OnCloseFrame(wxCloseEvent& evt); | |
85 | ||
5152b0e5 JS |
86 | // Make the help controller's frame 'modal' if |
87 | // needed | |
88 | void AddGrabIfNeeded(); | |
89 | ||
97494971 VS |
90 | protected: |
91 | virtual wxHtmlHelpFrame* CreateHelpFrame(wxHtmlHelpData *data); | |
92 | ||
93 | virtual void CreateHelpWindow(); | |
94 | virtual void DestroyHelpWindow(); | |
95 | ||
96 | wxHtmlHelpData m_helpData; | |
97 | wxHtmlHelpFrame* m_helpFrame; | |
98 | wxConfigBase * m_Config; | |
99 | wxString m_ConfigRoot; | |
100 | wxString m_titleFormat; | |
101 | int m_FrameStyle; | |
102 | // DECLARE_EVENT_TABLE() | |
22f3361e VZ |
103 | |
104 | DECLARE_NO_COPY_CLASS(wxHtmlHelpController) | |
8ec2b484 HH |
105 | }; |
106 | ||
3abf2c72 | 107 | #endif // wxUSE_WXHTML_HELP |
8ec2b484 HH |
108 | |
109 | #endif // _WX_HELPCTRL_H_ |