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