]>
Commit | Line | Data |
---|---|---|
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$ | |
8 | // Copyright: (c) Julian Smart | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_HELPBASEH__ | |
13 | #define _WX_HELPBASEH__ | |
14 | ||
15 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) | |
16 | #pragma interface "helpbase.h" | |
17 | #endif | |
18 | ||
19 | #include "wx/defs.h" | |
20 | ||
21 | #if wxUSE_HELP | |
22 | ||
23 | #include "wx/object.h" | |
24 | #include "wx/string.h" | |
25 | #include "wx/gdicmn.h" | |
26 | #include "wx/frame.h" | |
27 | ||
28 | // Flags for SetViewer | |
29 | #define wxHELP_NETSCAPE 1 | |
30 | ||
31 | // Search modes: | |
32 | enum wxHelpSearchMode | |
33 | { | |
34 | wxHELP_SEARCH_INDEX, | |
35 | wxHELP_SEARCH_ALL | |
36 | }; | |
37 | ||
38 | // Defines the API for help controllers | |
39 | class WXDLLEXPORT wxHelpControllerBase: public wxObject | |
40 | { | |
41 | public: | |
42 | inline wxHelpControllerBase() {} | |
43 | inline ~wxHelpControllerBase() {} | |
44 | ||
45 | // Must call this to set the filename and server name. | |
46 | // server is only required when implementing TCP/IP-based | |
47 | // help controllers. | |
48 | virtual bool Initialize(const wxString& WXUNUSED(file), int WXUNUSED(server) ) { return false; } | |
49 | virtual bool Initialize(const wxString& WXUNUSED(file)) { return false; } | |
50 | ||
51 | // Set viewer: only relevant to some kinds of controller | |
52 | virtual void SetViewer(const wxString& WXUNUSED(viewer), long WXUNUSED(flags) = 0) {} | |
53 | ||
54 | // If file is "", reloads file given in Initialize | |
55 | virtual bool LoadFile(const wxString& file = wxEmptyString) = 0; | |
56 | ||
57 | // Displays the contents | |
58 | virtual bool DisplayContents(void) = 0; | |
59 | ||
60 | // Display the given section | |
61 | virtual bool DisplaySection(int sectionNo) = 0; | |
62 | ||
63 | // Display the section using a context id | |
64 | virtual bool DisplayContextPopup(int WXUNUSED(contextId)) { return false; }; | |
65 | ||
66 | // Display the text in a popup, if possible | |
67 | virtual bool DisplayTextPopup(const wxString& WXUNUSED(text), const wxPoint& WXUNUSED(pos)) { return false; } | |
68 | ||
69 | // By default, uses KeywordSection to display a topic. Implementations | |
70 | // may override this for more specific behaviour. | |
71 | virtual bool DisplaySection(const wxString& section) { return KeywordSearch(section); } | |
72 | virtual bool DisplayBlock(long blockNo) = 0; | |
73 | virtual bool KeywordSearch(const wxString& k, | |
74 | wxHelpSearchMode mode = wxHELP_SEARCH_ALL) = 0; | |
75 | /// Allows one to override the default settings for the help frame. | |
76 | virtual void SetFrameParameters(const wxString& WXUNUSED(title), | |
77 | const wxSize& WXUNUSED(size), | |
78 | const wxPoint& WXUNUSED(pos) = wxDefaultPosition, | |
79 | bool WXUNUSED(newFrameEachTime) = false) | |
80 | { | |
81 | // does nothing by default | |
82 | } | |
83 | /// Obtains the latest settings used by the help frame and the help | |
84 | /// frame. | |
85 | virtual wxFrame *GetFrameParameters(wxSize *WXUNUSED(size) = NULL, | |
86 | wxPoint *WXUNUSED(pos) = NULL, | |
87 | bool *WXUNUSED(newFrameEachTime) = NULL) | |
88 | { | |
89 | return (wxFrame*) NULL; // does nothing by default | |
90 | } | |
91 | ||
92 | virtual bool Quit() = 0; | |
93 | virtual void OnQuit() {} | |
94 | ||
95 | private: | |
96 | DECLARE_CLASS(wxHelpControllerBase) | |
97 | }; | |
98 | ||
99 | #endif // wxUSE_HELP | |
100 | ||
101 | #endif | |
102 | // _WX_HELPBASEH__ |