]> git.saurik.com Git - wxWidgets.git/blob - include/wx/helpbase.h
Made wxContextHelp implementation generic and added wxFindWindowAtPointer,
[wxWidgets.git] / include / wx / helpbase.h
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 and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_HELPBASEH__
13 #define _WX_HELPBASEH__
14
15 #ifdef __GNUG__
16 #pragma interface "helpbase.h"
17 #endif
18
19 #include "wx/defs.h"
20 #include "wx/object.h"
21 #include "wx/string.h"
22 #include "wx/gdicmn.h"
23 #include "wx/frame.h"
24
25 #if wxUSE_HELP
26
27 // Flags for SetViewer
28 #define wxHELP_NETSCAPE 1
29
30 // Defines the API for help controllers
31 class WXDLLEXPORT wxHelpControllerBase: public wxObject
32 {
33 DECLARE_CLASS(wxHelpControllerBase)
34
35 public:
36 inline wxHelpControllerBase() {}
37 inline ~wxHelpControllerBase() {};
38
39 // Must call this to set the filename and server name.
40 // server is only required when implementing TCP/IP-based
41 // help controllers.
42 virtual bool Initialize(const wxString& WXUNUSED(file), int WXUNUSED(server) ) { return FALSE; }
43 virtual bool Initialize(const wxString& WXUNUSED(file)) { return FALSE; }
44
45 // Set viewer: only relevant to some kinds of controller
46 virtual void SetViewer(const wxString& WXUNUSED(viewer), long WXUNUSED(flags) = 0) {}
47
48 // If file is "", reloads file given in Initialize
49 virtual bool LoadFile(const wxString& file = "") = 0;
50 virtual bool DisplayContents(void) = 0;
51 virtual bool DisplaySection(int sectionNo) = 0;
52
53 // By default, uses KeywordSection to display a topic. Implementations
54 // may override this for more specific behaviour.
55 virtual bool DisplaySection(const wxString& section) { return KeywordSearch(section); };
56 virtual bool DisplayBlock(long blockNo) = 0;
57 virtual bool KeywordSearch(const wxString& k) = 0;
58 /// Allows one to override the default settings for the help frame.
59 virtual void SetFrameParameters(const wxString& WXUNUSED(title),
60 const wxSize& WXUNUSED(size),
61 const wxPoint& WXUNUSED(pos) = wxDefaultPosition,
62 bool WXUNUSED(newFrameEachTime) = FALSE)
63 {
64 // does nothing by default
65 }
66 /// Obtains the latest settings used by the help frame and the help
67 /// frame.
68 virtual wxFrame *GetFrameParameters(wxSize *WXUNUSED(size) = NULL,
69 wxPoint *WXUNUSED(pos) = NULL,
70 bool *WXUNUSED(newFrameEachTime) = NULL)
71 {
72 return (wxFrame*) NULL;// does nothing by default
73 }
74
75 virtual bool Quit(void) = 0;
76 virtual void OnQuit(void) {};
77 };
78
79 /*
80 * wxContextHelp
81 * Invokes context-sensitive help. When the user
82 * clicks on a window, a wxEVT_HELP event will be sent to that
83 * window for the application to display help for.
84 */
85
86 class WXDLLEXPORT wxContextHelp: public wxObject
87 {
88 DECLARE_DYNAMIC_CLASS(wxContextHelp)
89 public:
90 wxContextHelp(wxWindow* win = NULL, bool beginHelp = TRUE);
91 ~wxContextHelp();
92
93 bool BeginContextHelp(wxWindow* win);
94 bool EndContextHelp();
95
96 bool EventLoop();
97 bool DispatchEvent(wxWindow* win, const wxPoint& pt);
98
99 void SetStatus(bool status) { m_status = status; }
100
101 protected:
102
103 bool m_inHelp;
104 bool m_status; // TRUE if the user left-clicked
105 };
106
107 #endif // wxUSE_HELP
108 #endif
109 // _WX_HELPBASEH__