]> git.saurik.com Git - wxWidgets.git/blob - interface/cshelp.h
removed trailing whitespace in Doxygen files
[wxWidgets.git] / interface / cshelp.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: cshelp.h
3 // Purpose: interface of wxHelpProvider
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
8
9 /**
10 @class wxHelpProvider
11 @wxheader{cshelp.h}
12
13 wxHelpProvider is an abstract class used by a program implementing
14 context-sensitive help to
15 show the help text for the given window.
16
17 The current help provider must be explicitly set by the application using
18 wxHelpProvider::Set().
19
20 @library{wxcore}
21 @category{help}
22
23 @see wxContextHelp, wxContextHelpButton, wxSimpleHelpProvider,
24 wxHelpControllerHelpProvider, wxWindow::SetHelpText, wxWindow::GetHelpTextAtPoint
25 */
26 class wxHelpProvider
27 {
28 public:
29 /**
30 Virtual destructor for any base class.
31 */
32 ~wxHelpProvider();
33
34 /**
35 Associates the text with the given window or id. Although all help
36 providers have these functions to allow making wxWindow::SetHelpText
37 work, not all of them implement the functions.
38 */
39 void AddHelp(wxWindowBase* window, const wxString& text);
40
41 /**
42 Unlike some other classes, the help provider is not created on demand.
43 This must be explicitly done by the application.
44 */
45 wxHelpProvider* Get();
46
47 //@{
48 /**
49 This version associates the given text with all windows with this id.
50 May be used to set the same help string for all Cancel buttons in
51 the application, for example.
52 */
53 wxString GetHelp(const wxWindowBase* window);
54 void AddHelp(wxWindowID id, const wxString& text);
55 //@}
56
57 /**
58 Removes the association between the window pointer and the help text. This is
59 called by the wxWindow destructor. Without this, the table of help strings will
60 fill up
61 and when window pointers are reused, the wrong help string will be found.
62 */
63 void RemoveHelp(wxWindowBase* window);
64
65 /**
66 Get/set the current, application-wide help provider. Returns
67 the previous one.
68 */
69 wxHelpProvider* Set(wxHelpProvider* helpProvider);
70
71 /**
72 Shows help for the given window. Override this function if the help doesn't
73 depend on the exact position inside the window, otherwise you need to override
74 ShowHelpAtPoint().
75 Returns @true if help was shown, or @false if no help was available for this
76 window.
77 */
78 bool ShowHelp(wxWindowBase* window);
79
80 /**
81 This function may be overridden to show help for the window when it should
82 depend on the position inside the window, By default this method forwards to
83 ShowHelp(), so it is enough to only implement
84 the latter if the help doesn't depend on the position.
85 Returns @true if help was shown, or @false if no help was available for this
86 window.
87
88 @param window
89 Window to show help text for.
90 @param point
91 Coordinates of the mouse at the moment of help event emission.
92 @param origin
93 Help event origin, see wxHelpEvent::GetOrigin.
94 */
95 bool ShowHelpAtPoint(wxWindowBase* window, const wxPoint point,
96 wxHelpEvent::Origin origin);
97 };
98
99
100
101 /**
102 @class wxHelpControllerHelpProvider
103 @wxheader{cshelp.h}
104
105 wxHelpControllerHelpProvider is an implementation of wxHelpProvider which
106 supports
107 both context identifiers and plain text help strings. If the help text is an
108 integer,
109 it is passed to wxHelpController::DisplayContextPopup. Otherwise, it shows the
110 string
111 in a tooltip as per wxSimpleHelpProvider. If you use this with a
112 wxCHMHelpController instance
113 on windows, it will use the native style of tip window instead of wxTipWindow.
114
115 You can use the convenience function @b wxContextId to convert an integer
116 context
117 id to a string for passing to wxWindow::SetHelpText.
118
119 @library{wxcore}
120 @category{help}
121
122 @see wxHelpProvider, wxSimpleHelpProvider, wxContextHelp,
123 wxWindow::SetHelpText, wxWindow::GetHelpTextAtPoint
124 */
125 class wxHelpControllerHelpProvider : public wxSimpleHelpProvider
126 {
127 public:
128 /**
129 Note that the instance doesn't own the help controller. The help controller
130 should be deleted separately.
131 */
132 wxHelpControllerHelpProvider(wxHelpControllerBase* hc = NULL);
133
134 /**
135 Returns the help controller associated with this help provider.
136 */
137 wxHelpControllerBase* GetHelpController() const;
138
139 /**
140 Sets the help controller associated with this help provider.
141 */
142 void SetHelpController(wxHelpControllerBase* hc);
143 };
144
145
146
147 /**
148 @class wxContextHelp
149 @wxheader{cshelp.h}
150
151 This class changes the cursor to a query and puts the application into a
152 'context-sensitive help mode'.
153 When the user left-clicks on a window within the specified window, a wxEVT_HELP
154 event is
155 sent to that control, and the application may respond to it by popping up some
156 help.
157
158 For example:
159
160 @code
161 wxContextHelp contextHelp(myWindow);
162 @endcode
163
164 There are a couple of ways to invoke this behaviour implicitly:
165
166 Use the wxDIALOG_EX_CONTEXTHELP style for a dialog (Windows only). This will
167 put a question mark
168 in the titlebar, and Windows will put the application into context-sensitive
169 help mode automatically,
170 with further programming.
171 Create a wxContextHelpButton, whose predefined behaviour is to create a
172 context help object.
173 Normally you will write your application so that this button is only added to a
174 dialog for non-Windows platforms
175 (use wxDIALOG_EX_CONTEXTHELP on Windows).
176
177 Note that on Mac OS X, the cursor does not change when in context-sensitive
178 help mode.
179
180 @library{wxcore}
181 @category{help}
182
183 @see wxHelpEvent, wxHelpController, wxContextHelpButton
184 */
185 class wxContextHelp : public wxObject
186 {
187 public:
188 /**
189 Constructs a context help object, calling BeginContextHelp() if
190 @a doNow is @true (the default).
191 If @a window is @NULL, the top window is used.
192 */
193 wxContextHelp(wxWindow* window = NULL, bool doNow = true);
194
195 /**
196 Destroys the context help object.
197 */
198 ~wxContextHelp();
199
200 /**
201 Puts the application into context-sensitive help mode. @a window is the window
202 which will be used to catch events; if @NULL, the top window will be used.
203 Returns @true if the application was successfully put into context-sensitive
204 help mode.
205 This function only returns when the event loop has finished.
206 */
207 bool BeginContextHelp(wxWindow* window = NULL);
208
209 /**
210 Ends context-sensitive help mode. Not normally called by the application.
211 */
212 bool EndContextHelp();
213 };
214
215
216
217 /**
218 @class wxContextHelpButton
219 @wxheader{cshelp.h}
220
221 Instances of this class may be used to add a question mark button that when
222 pressed, puts the
223 application into context-help mode. It does this by creating a wxContextHelp
224 object which itself
225 generates a wxEVT_HELP event when the user clicks on a window.
226
227 On Windows, you may add a question-mark icon to a dialog by use of the
228 wxDIALOG_EX_CONTEXTHELP extra style, but
229 on other platforms you will have to add a button explicitly, usually next to
230 OK, Cancel or similar buttons.
231
232 @library{wxcore}
233 @category{help}
234
235 @see wxBitmapButton, wxContextHelp
236 */
237 class wxContextHelpButton : public wxBitmapButton
238 {
239 public:
240 //@{
241 /**
242 Constructor, creating and showing a context help button.
243
244 @param parent
245 Parent window. Must not be @NULL.
246 @param id
247 Button identifier. Defaults to wxID_CONTEXT_HELP.
248 @param pos
249 Button position.
250 @param size
251 Button size. If wxDefaultSize is specified then the button is
252 sized
253 appropriately for the question mark bitmap.
254 @param style
255 Window style.
256 */
257 wxContextHelpButton();
258 wxContextHelpButton(wxWindow* parent,
259 wxWindowID id = wxID_CONTEXT_HELP,
260 const wxPoint& pos = wxDefaultPosition,
261 const wxSize& size = wxDefaultSize,
262 long style = wxBU_AUTODRAW);
263 //@}
264 };
265
266
267
268 /**
269 @class wxSimpleHelpProvider
270 @wxheader{cshelp.h}
271
272 wxSimpleHelpProvider is an implementation of wxHelpProvider which supports
273 only plain text help strings, and shows the string associated with the
274 control (if any) in a tooltip.
275
276 @library{wxcore}
277 @category{help}
278
279 @see wxHelpProvider, wxHelpControllerHelpProvider, wxContextHelp,
280 wxWindow::SetHelpText, wxWindow::GetHelpTextAtPoint
281 */
282 class wxSimpleHelpProvider : public wxHelpProvider
283 {
284 public:
285
286 };
287