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