]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: cursor.h | |
3 | // Purpose: interface of wxCursor | |
4 | // Author: wxWidgets team | |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /** | |
10 | @class wxCursor | |
11 | @wxheader{cursor.h} | |
12 | ||
13 | A cursor is a small bitmap usually used for denoting where the mouse | |
14 | pointer is, with a picture that might indicate the interpretation of a | |
15 | mouse click. As with icons, cursors in X and MS Windows are created | |
16 | in a different manner. Therefore, separate cursors will be created for the | |
17 | different environments. Platform-specific methods for creating a @b wxCursor | |
18 | object are catered for, and this is an occasion where | |
19 | conditional compilation will probably be required (see wxIcon for | |
20 | an example). | |
21 | ||
22 | A single cursor object may be used in many windows (any subwindow type). | |
23 | The wxWidgets convention is to set the cursor for a window, as in X, | |
24 | rather than to set it globally as in MS Windows, although a | |
25 | global ::wxSetCursor is also available for MS Windows use. | |
26 | ||
27 | @library{wxcore} | |
28 | @category{gdi} | |
29 | ||
30 | @stdobjects | |
31 | ::wxNullCursor, ::wxSTANDARD_CURSOR, ::wxHOURGLASS_CURSOR, ::wxCROSS_CURSOR | |
32 | ||
33 | @see wxBitmap, wxIcon, wxWindow::SetCursor, ::wxSetCursor | |
34 | */ | |
35 | class wxCursor : public wxBitmap | |
36 | { | |
37 | public: | |
38 | //@{ | |
39 | /** | |
40 | Copy constructor, uses @ref overview_trefcount "reference counting". | |
41 | ||
42 | @param bits | |
43 | An array of bits. | |
44 | @param maskBits | |
45 | Bits for a mask bitmap. | |
46 | @param width | |
47 | Cursor width. | |
48 | @param height | |
49 | Cursor height. | |
50 | @param hotSpotX | |
51 | Hotspot x coordinate. | |
52 | @param hotSpotY | |
53 | Hotspot y coordinate. | |
54 | @param type | |
55 | Icon type to load. Under Motif, type defaults to wxBITMAP_TYPE_XBM. Under | |
56 | Windows, | |
57 | it defaults to wxBITMAP_TYPE_CUR_RESOURCE. Under MacOS, it defaults to | |
58 | wxBITMAP_TYPE_MACCURSOR_RESOURCE. | |
59 | Under X, the permitted cursor types are: | |
60 | ||
61 | ||
62 | ||
63 | ||
64 | ||
65 | ||
66 | ||
67 | wxBITMAP_TYPE_XBM | |
68 | ||
69 | ||
70 | ||
71 | ||
72 | Load an X bitmap file. | |
73 | ||
74 | ||
75 | ||
76 | ||
77 | ||
78 | Under Windows, the permitted types are: | |
79 | ||
80 | ||
81 | ||
82 | ||
83 | ||
84 | ||
85 | ||
86 | wxBITMAP_TYPE_CUR | |
87 | ||
88 | ||
89 | ||
90 | ||
91 | Load a cursor from a .cur cursor file (only if USE_RESOURCE_LOADING_IN_MSW | |
92 | is enabled in setup.h). | |
93 | ||
94 | ||
95 | ||
96 | ||
97 | ||
98 | wxBITMAP_TYPE_CUR_RESOURCE | |
99 | ||
100 | ||
101 | ||
102 | ||
103 | Load a Windows resource (as specified in the .rc file). | |
104 | ||
105 | ||
106 | ||
107 | ||
108 | ||
109 | wxBITMAP_TYPE_ICO | |
110 | ||
111 | ||
112 | ||
113 | ||
114 | Load a cursor from a .ico icon file (only if USE_RESOURCE_LOADING_IN_MSW | |
115 | is enabled in setup.h). Specify hotSpotX and hotSpotY. | |
116 | @param cursorId | |
117 | A stock cursor identifier. May be one of: | |
118 | ||
119 | ||
120 | ||
121 | ||
122 | ||
123 | ||
124 | ||
125 | wxCURSOR_ARROW | |
126 | ||
127 | ||
128 | ||
129 | ||
130 | A standard arrow cursor. | |
131 | ||
132 | ||
133 | ||
134 | ||
135 | ||
136 | wxCURSOR_RIGHT_ARROW | |
137 | ||
138 | ||
139 | ||
140 | ||
141 | A standard arrow cursor | |
142 | pointing to the right. | |
143 | ||
144 | ||
145 | ||
146 | ||
147 | ||
148 | wxCURSOR_BLANK | |
149 | ||
150 | ||
151 | ||
152 | ||
153 | Transparent cursor. | |
154 | ||
155 | ||
156 | ||
157 | ||
158 | ||
159 | wxCURSOR_BULLSEYE | |
160 | ||
161 | ||
162 | ||
163 | ||
164 | Bullseye cursor. | |
165 | ||
166 | ||
167 | ||
168 | ||
169 | ||
170 | wxCURSOR_CHAR | |
171 | ||
172 | ||
173 | ||
174 | ||
175 | Rectangular character cursor. | |
176 | ||
177 | ||
178 | ||
179 | ||
180 | ||
181 | wxCURSOR_CROSS | |
182 | ||
183 | ||
184 | ||
185 | ||
186 | A cross cursor. | |
187 | ||
188 | ||
189 | ||
190 | ||
191 | ||
192 | wxCURSOR_HAND | |
193 | ||
194 | ||
195 | ||
196 | ||
197 | A hand cursor. | |
198 | ||
199 | ||
200 | ||
201 | ||
202 | ||
203 | wxCURSOR_IBEAM | |
204 | ||
205 | ||
206 | ||
207 | ||
208 | An I-beam cursor (vertical line). | |
209 | ||
210 | ||
211 | ||
212 | ||
213 | ||
214 | wxCURSOR_LEFT_BUTTON | |
215 | ||
216 | ||
217 | ||
218 | ||
219 | Represents a mouse with the left button depressed. | |
220 | ||
221 | ||
222 | ||
223 | ||
224 | ||
225 | wxCURSOR_MAGNIFIER | |
226 | ||
227 | ||
228 | ||
229 | ||
230 | A magnifier icon. | |
231 | ||
232 | ||
233 | ||
234 | ||
235 | ||
236 | wxCURSOR_MIDDLE_BUTTON | |
237 | ||
238 | ||
239 | ||
240 | ||
241 | Represents a mouse with the middle button depressed. | |
242 | ||
243 | ||
244 | ||
245 | ||
246 | ||
247 | wxCURSOR_NO_ENTRY | |
248 | ||
249 | ||
250 | ||
251 | ||
252 | A no-entry sign cursor. | |
253 | ||
254 | ||
255 | ||
256 | ||
257 | ||
258 | wxCURSOR_PAINT_BRUSH | |
259 | ||
260 | ||
261 | ||
262 | ||
263 | A paintbrush cursor. | |
264 | ||
265 | ||
266 | ||
267 | ||
268 | ||
269 | wxCURSOR_PENCIL | |
270 | ||
271 | ||
272 | ||
273 | ||
274 | A pencil cursor. | |
275 | ||
276 | ||
277 | ||
278 | ||
279 | ||
280 | wxCURSOR_POINT_LEFT | |
281 | ||
282 | ||
283 | ||
284 | ||
285 | A cursor that points left. | |
286 | ||
287 | ||
288 | ||
289 | ||
290 | ||
291 | wxCURSOR_POINT_RIGHT | |
292 | ||
293 | ||
294 | ||
295 | ||
296 | A cursor that points right. | |
297 | ||
298 | ||
299 | ||
300 | ||
301 | ||
302 | wxCURSOR_QUESTION_ARROW | |
303 | ||
304 | ||
305 | ||
306 | ||
307 | An arrow and question mark. | |
308 | ||
309 | ||
310 | ||
311 | ||
312 | ||
313 | wxCURSOR_RIGHT_BUTTON | |
314 | ||
315 | ||
316 | ||
317 | ||
318 | Represents a mouse with the right button depressed. | |
319 | ||
320 | ||
321 | ||
322 | ||
323 | ||
324 | wxCURSOR_SIZENESW | |
325 | ||
326 | ||
327 | ||
328 | ||
329 | A sizing cursor pointing NE-SW. | |
330 | ||
331 | ||
332 | ||
333 | ||
334 | ||
335 | wxCURSOR_SIZENS | |
336 | ||
337 | ||
338 | ||
339 | ||
340 | A sizing cursor pointing N-S. | |
341 | ||
342 | ||
343 | ||
344 | ||
345 | ||
346 | wxCURSOR_SIZENWSE | |
347 | ||
348 | ||
349 | ||
350 | ||
351 | A sizing cursor pointing NW-SE. | |
352 | ||
353 | ||
354 | ||
355 | ||
356 | ||
357 | wxCURSOR_SIZEWE | |
358 | ||
359 | ||
360 | ||
361 | ||
362 | A sizing cursor pointing W-E. | |
363 | ||
364 | ||
365 | ||
366 | ||
367 | ||
368 | wxCURSOR_SIZING | |
369 | ||
370 | ||
371 | ||
372 | ||
373 | A general sizing cursor. | |
374 | ||
375 | ||
376 | ||
377 | ||
378 | ||
379 | wxCURSOR_SPRAYCAN | |
380 | ||
381 | ||
382 | ||
383 | ||
384 | A spraycan cursor. | |
385 | ||
386 | ||
387 | ||
388 | ||
389 | ||
390 | wxCURSOR_WAIT | |
391 | ||
392 | ||
393 | ||
394 | ||
395 | A wait cursor. | |
396 | ||
397 | ||
398 | ||
399 | ||
400 | ||
401 | wxCURSOR_WATCH | |
402 | ||
403 | ||
404 | ||
405 | ||
406 | A watch cursor. | |
407 | ||
408 | ||
409 | ||
410 | ||
411 | ||
412 | wxCURSOR_ARROWWAIT | |
413 | ||
414 | ||
415 | ||
416 | ||
417 | A cursor with both an arrow and | |
418 | an hourglass, (windows.) | |
419 | ||
420 | ||
421 | ||
422 | ||
423 | ||
424 | Note that not all cursors are available on all platforms. | |
425 | @param cursor | |
426 | Pointer or reference to a cursor to copy. | |
427 | */ | |
428 | wxCursor(); | |
429 | wxCursor(const char bits[], int width, int height, | |
430 | int hotSpotX = -1, int hotSpotY = -1, | |
431 | const char maskBits[] = NULL, | |
432 | wxColour* fg = NULL, | |
433 | wxColour* bg = NULL); | |
434 | wxCursor(const wxString& cursorName, long type, | |
435 | int hotSpotX = 0, int hotSpotY = 0); | |
436 | wxCursor(int cursorId); | |
437 | wxCursor(const wxImage& image); | |
438 | wxCursor(const wxCursor& cursor); | |
439 | //@} | |
440 | ||
441 | /** | |
442 | Destroys the cursor. | |
443 | See @ref overview_refcountdestruct "reference-counted object destruction" for | |
444 | more info. | |
445 | A cursor can be reused for more | |
446 | than one window, and does not get destroyed when the window is | |
447 | destroyed. wxWidgets destroys all cursors on application exit, although | |
448 | it is best to clean them up explicitly. | |
449 | */ | |
450 | ~wxCursor(); | |
451 | ||
452 | /** | |
453 | Returns @true if cursor data is present. | |
454 | */ | |
455 | bool IsOk() const; | |
456 | ||
457 | /** | |
458 | Assignment operator, using @ref overview_trefcount "reference counting". | |
459 | */ | |
460 | wxCursor operator =(const wxCursor& cursor); | |
461 | }; | |
462 | ||
463 | /** | |
464 | An empty wxCursor. | |
465 | */ | |
466 | wxCursor wxNullCursor; | |
467 | ||
468 | /** | |
469 | FIXME | |
470 | */ | |
471 | wxCursor wxSTANDARD_CURSOR; | |
472 | ||
473 | /** | |
474 | FIXME | |
475 | */ | |
476 | wxCursor wxHOURGLASS_CURSOR; | |
477 | ||
478 | /** | |
479 | FIXME | |
480 | */ | |
481 | wxCursor wxCROSS_CURSOR; | |
482 | ||
483 |