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