]>
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". | |
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 FM |
60 | Under X, the permitted cursor types are: |
61 | ||
62 | ||
63 | ||
64 | ||
65 | ||
66 | ||
67 | ||
68 | wxBITMAP_TYPE_XBM | |
69 | ||
70 | ||
71 | ||
72 | ||
73 | Load an X bitmap file. | |
74 | ||
75 | ||
76 | ||
77 | ||
78 | ||
79 | Under Windows, the permitted types are: | |
80 | ||
81 | ||
82 | ||
83 | ||
23324ae1 | 84 | |
23324ae1 FM |
85 | |
86 | ||
4cc4bfaf | 87 | wxBITMAP_TYPE_CUR |
23324ae1 FM |
88 | |
89 | ||
23324ae1 | 90 | |
23324ae1 | 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). | |
23324ae1 | 94 | |
23324ae1 FM |
95 | |
96 | ||
23324ae1 | 97 | |
23324ae1 | 98 | |
4cc4bfaf | 99 | wxBITMAP_TYPE_CUR_RESOURCE |
23324ae1 | 100 | |
23324ae1 | 101 | |
23324ae1 FM |
102 | |
103 | ||
4cc4bfaf | 104 | Load a Windows resource (as specified in the .rc file). |
23324ae1 | 105 | |
4cc4bfaf FM |
106 | |
107 | ||
108 | ||
109 | ||
110 | wxBITMAP_TYPE_ICO | |
111 | ||
112 | ||
113 | ||
114 | ||
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 FM |
118 | A stock cursor identifier. May be one of: |
119 | ||
120 | ||
121 | ||
122 | ||
123 | ||
124 | ||
125 | ||
126 | wxCURSOR_ARROW | |
127 | ||
128 | ||
129 | ||
130 | ||
131 | A standard arrow cursor. | |
132 | ||
133 | ||
134 | ||
135 | ||
136 | ||
137 | wxCURSOR_RIGHT_ARROW | |
138 | ||
139 | ||
140 | ||
141 | ||
142 | A standard arrow cursor | |
143 | pointing to the right. | |
144 | ||
145 | ||
146 | ||
147 | ||
148 | ||
149 | wxCURSOR_BLANK | |
150 | ||
151 | ||
152 | ||
153 | ||
154 | Transparent cursor. | |
155 | ||
156 | ||
157 | ||
158 | ||
159 | ||
160 | wxCURSOR_BULLSEYE | |
161 | ||
162 | ||
163 | ||
164 | ||
165 | Bullseye cursor. | |
166 | ||
167 | ||
168 | ||
169 | ||
170 | ||
171 | wxCURSOR_CHAR | |
172 | ||
173 | ||
174 | ||
175 | ||
176 | Rectangular character cursor. | |
177 | ||
178 | ||
179 | ||
180 | ||
181 | ||
182 | wxCURSOR_CROSS | |
183 | ||
184 | ||
185 | ||
186 | ||
187 | A cross cursor. | |
188 | ||
189 | ||
190 | ||
191 | ||
192 | ||
193 | wxCURSOR_HAND | |
194 | ||
195 | ||
196 | ||
197 | ||
198 | A hand cursor. | |
199 | ||
200 | ||
23324ae1 FM |
201 | |
202 | ||
23324ae1 | 203 | |
4cc4bfaf | 204 | wxCURSOR_IBEAM |
23324ae1 | 205 | |
23324ae1 | 206 | |
23324ae1 FM |
207 | |
208 | ||
4cc4bfaf | 209 | An I-beam cursor (vertical line). |
23324ae1 | 210 | |
23324ae1 FM |
211 | |
212 | ||
23324ae1 | 213 | |
23324ae1 | 214 | |
4cc4bfaf | 215 | wxCURSOR_LEFT_BUTTON |
23324ae1 | 216 | |
23324ae1 | 217 | |
23324ae1 FM |
218 | |
219 | ||
4cc4bfaf | 220 | Represents a mouse with the left button depressed. |
23324ae1 | 221 | |
23324ae1 FM |
222 | |
223 | ||
23324ae1 | 224 | |
23324ae1 | 225 | |
4cc4bfaf | 226 | wxCURSOR_MAGNIFIER |
23324ae1 | 227 | |
23324ae1 | 228 | |
23324ae1 FM |
229 | |
230 | ||
4cc4bfaf | 231 | A magnifier icon. |
23324ae1 | 232 | |
23324ae1 FM |
233 | |
234 | ||
23324ae1 | 235 | |
23324ae1 | 236 | |
4cc4bfaf | 237 | wxCURSOR_MIDDLE_BUTTON |
23324ae1 | 238 | |
23324ae1 | 239 | |
23324ae1 FM |
240 | |
241 | ||
4cc4bfaf | 242 | Represents a mouse with the middle button depressed. |
23324ae1 | 243 | |
23324ae1 FM |
244 | |
245 | ||
23324ae1 | 246 | |
23324ae1 | 247 | |
4cc4bfaf | 248 | wxCURSOR_NO_ENTRY |
23324ae1 | 249 | |
23324ae1 | 250 | |
23324ae1 FM |
251 | |
252 | ||
4cc4bfaf | 253 | A no-entry sign cursor. |
23324ae1 | 254 | |
23324ae1 FM |
255 | |
256 | ||
23324ae1 | 257 | |
23324ae1 | 258 | |
4cc4bfaf | 259 | wxCURSOR_PAINT_BRUSH |
23324ae1 | 260 | |
23324ae1 | 261 | |
23324ae1 FM |
262 | |
263 | ||
4cc4bfaf | 264 | A paintbrush cursor. |
23324ae1 | 265 | |
23324ae1 FM |
266 | |
267 | ||
23324ae1 | 268 | |
23324ae1 | 269 | |
4cc4bfaf | 270 | wxCURSOR_PENCIL |
23324ae1 | 271 | |
23324ae1 | 272 | |
23324ae1 FM |
273 | |
274 | ||
4cc4bfaf | 275 | A pencil cursor. |
23324ae1 | 276 | |
23324ae1 FM |
277 | |
278 | ||
23324ae1 | 279 | |
23324ae1 | 280 | |
4cc4bfaf | 281 | wxCURSOR_POINT_LEFT |
23324ae1 | 282 | |
23324ae1 | 283 | |
23324ae1 FM |
284 | |
285 | ||
4cc4bfaf | 286 | A cursor that points left. |
23324ae1 | 287 | |
23324ae1 FM |
288 | |
289 | ||
23324ae1 | 290 | |
23324ae1 | 291 | |
4cc4bfaf | 292 | wxCURSOR_POINT_RIGHT |
23324ae1 | 293 | |
23324ae1 | 294 | |
23324ae1 FM |
295 | |
296 | ||
4cc4bfaf | 297 | A cursor that points right. |
23324ae1 | 298 | |
23324ae1 FM |
299 | |
300 | ||
23324ae1 | 301 | |
23324ae1 | 302 | |
4cc4bfaf FM |
303 | wxCURSOR_QUESTION_ARROW |
304 | ||
305 | ||
306 | ||
307 | ||
308 | An arrow and question mark. | |
309 | ||
310 | ||
311 | ||
312 | ||
313 | ||
314 | wxCURSOR_RIGHT_BUTTON | |
315 | ||
316 | ||
317 | ||
318 | ||
319 | Represents a mouse with the right button depressed. | |
320 | ||
321 | ||
322 | ||
323 | ||
324 | ||
325 | wxCURSOR_SIZENESW | |
326 | ||
327 | ||
328 | ||
329 | ||
330 | A sizing cursor pointing NE-SW. | |
331 | ||
332 | ||
333 | ||
334 | ||
335 | ||
336 | wxCURSOR_SIZENS | |
337 | ||
338 | ||
339 | ||
340 | ||
341 | A sizing cursor pointing N-S. | |
342 | ||
343 | ||
344 | ||
345 | ||
346 | ||
347 | wxCURSOR_SIZENWSE | |
348 | ||
349 | ||
350 | ||
351 | ||
352 | A sizing cursor pointing NW-SE. | |
353 | ||
354 | ||
355 | ||
356 | ||
357 | ||
358 | wxCURSOR_SIZEWE | |
359 | ||
360 | ||
361 | ||
362 | ||
363 | A sizing cursor pointing W-E. | |
364 | ||
365 | ||
366 | ||
367 | ||
368 | ||
369 | wxCURSOR_SIZING | |
370 | ||
371 | ||
372 | ||
373 | ||
374 | A general sizing cursor. | |
375 | ||
376 | ||
377 | ||
378 | ||
379 | ||
380 | wxCURSOR_SPRAYCAN | |
381 | ||
382 | ||
383 | ||
384 | ||
385 | A spraycan cursor. | |
386 | ||
387 | ||
388 | ||
389 | ||
390 | ||
391 | wxCURSOR_WAIT | |
392 | ||
393 | ||
394 | ||
395 | ||
396 | A wait cursor. | |
397 | ||
398 | ||
399 | ||
400 | ||
401 | ||
402 | wxCURSOR_WATCH | |
403 | ||
404 | ||
405 | ||
406 | ||
407 | A watch cursor. | |
408 | ||
409 | ||
410 | ||
411 | ||
412 | ||
413 | wxCURSOR_ARROWWAIT | |
414 | ||
415 | ||
416 | ||
417 | ||
418 | A cursor with both an arrow and | |
419 | an hourglass, (windows.) | |
420 | ||
421 | ||
422 | ||
423 | ||
424 | ||
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 |