]>
Commit | Line | Data |
---|---|---|
c801d85f KB |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: helpbase.h | |
3 | // Purpose: Help system base classes | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 04/01/98 | |
7 | // RCS-ID: $Id$ | |
371a5b4e | 8 | // Copyright: (c) Julian Smart |
5d3e7b52 | 9 | // Licence: wxWindows licence |
c801d85f KB |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
34138703 JS |
12 | #ifndef _WX_HELPBASEH__ |
13 | #define _WX_HELPBASEH__ | |
c801d85f | 14 | |
e179bd65 | 15 | #include "wx/defs.h" |
3379ed37 VZ |
16 | |
17 | #if wxUSE_HELP | |
18 | ||
e179bd65 RR |
19 | #include "wx/object.h" |
20 | #include "wx/string.h" | |
21 | #include "wx/gdicmn.h" | |
5f1ea0ee | 22 | #include "wx/frame.h" |
c801d85f | 23 | |
33b64e6f JS |
24 | // Flags for SetViewer |
25 | #define wxHELP_NETSCAPE 1 | |
26 | ||
69b5cec2 VS |
27 | // Search modes: |
28 | enum wxHelpSearchMode | |
29 | { | |
30 | wxHELP_SEARCH_INDEX, | |
31 | wxHELP_SEARCH_ALL | |
32 | }; | |
33 | ||
c801d85f KB |
34 | // Defines the API for help controllers |
35 | class WXDLLEXPORT wxHelpControllerBase: public wxObject | |
36 | { | |
f6bcfd97 | 37 | public: |
3db52265 | 38 | inline wxHelpControllerBase(wxWindow* parentWindow = NULL) { m_parentWindow = parentWindow; } |
2b5f62a0 | 39 | inline ~wxHelpControllerBase() {} |
3379ed37 | 40 | |
f6bcfd97 BP |
41 | // Must call this to set the filename and server name. |
42 | // server is only required when implementing TCP/IP-based | |
43 | // help controllers. | |
5d3e7b52 WS |
44 | virtual bool Initialize(const wxString& WXUNUSED(file), int WXUNUSED(server) ) { return false; } |
45 | virtual bool Initialize(const wxString& WXUNUSED(file)) { return false; } | |
3379ed37 | 46 | |
f6bcfd97 BP |
47 | // Set viewer: only relevant to some kinds of controller |
48 | virtual void SetViewer(const wxString& WXUNUSED(viewer), long WXUNUSED(flags) = 0) {} | |
3379ed37 | 49 | |
f6bcfd97 | 50 | // If file is "", reloads file given in Initialize |
fda7962d | 51 | virtual bool LoadFile(const wxString& file = wxEmptyString) = 0; |
5100cabf JS |
52 | |
53 | // Displays the contents | |
f6bcfd97 | 54 | virtual bool DisplayContents(void) = 0; |
5100cabf JS |
55 | |
56 | // Display the given section | |
f6bcfd97 | 57 | virtual bool DisplaySection(int sectionNo) = 0; |
c801d85f | 58 | |
5100cabf | 59 | // Display the section using a context id |
47b378bd | 60 | virtual bool DisplayContextPopup(int WXUNUSED(contextId)) { return false; } |
5100cabf JS |
61 | |
62 | // Display the text in a popup, if possible | |
5d3e7b52 | 63 | virtual bool DisplayTextPopup(const wxString& WXUNUSED(text), const wxPoint& WXUNUSED(pos)) { return false; } |
5100cabf | 64 | |
f6bcfd97 BP |
65 | // By default, uses KeywordSection to display a topic. Implementations |
66 | // may override this for more specific behaviour. | |
2b5f62a0 | 67 | virtual bool DisplaySection(const wxString& section) { return KeywordSearch(section); } |
f6bcfd97 | 68 | virtual bool DisplayBlock(long blockNo) = 0; |
69b5cec2 VS |
69 | virtual bool KeywordSearch(const wxString& k, |
70 | wxHelpSearchMode mode = wxHELP_SEARCH_ALL) = 0; | |
f6bcfd97 BP |
71 | /// Allows one to override the default settings for the help frame. |
72 | virtual void SetFrameParameters(const wxString& WXUNUSED(title), | |
73 | const wxSize& WXUNUSED(size), | |
74 | const wxPoint& WXUNUSED(pos) = wxDefaultPosition, | |
5d3e7b52 | 75 | bool WXUNUSED(newFrameEachTime) = false) |
f6bcfd97 BP |
76 | { |
77 | // does nothing by default | |
78 | } | |
3379ed37 | 79 | /// Obtains the latest settings used by the help frame and the help |
f6bcfd97 BP |
80 | /// frame. |
81 | virtual wxFrame *GetFrameParameters(wxSize *WXUNUSED(size) = NULL, | |
82 | wxPoint *WXUNUSED(pos) = NULL, | |
83 | bool *WXUNUSED(newFrameEachTime) = NULL) | |
84 | { | |
2b5f62a0 | 85 | return (wxFrame*) NULL; // does nothing by default |
f6bcfd97 | 86 | } |
3379ed37 | 87 | |
2b5f62a0 VZ |
88 | virtual bool Quit() = 0; |
89 | virtual void OnQuit() {} | |
5d3e7b52 | 90 | |
3db52265 JS |
91 | /// Set the window that can optionally be used for the help window's parent. |
92 | virtual void SetParentWindow(wxWindow* win) { m_parentWindow = win; } | |
93 | ||
94 | /// Get the window that can optionally be used for the help window's parent. | |
95 | virtual wxWindow* GetParentWindow() const { return m_parentWindow; } | |
96 | ||
97 | protected: | |
98 | wxWindow* m_parentWindow; | |
2b5f62a0 VZ |
99 | private: |
100 | DECLARE_CLASS(wxHelpControllerBase) | |
c801d85f KB |
101 | }; |
102 | ||
47d67540 | 103 | #endif // wxUSE_HELP |
3379ed37 | 104 | |
c801d85f | 105 | #endif |
f6bcfd97 | 106 | // _WX_HELPBASEH__ |