1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452
|
<HTML>
<head><title>wxCursor</title></head>
<BODY BGCOLOR=#FFFFFF>
<A NAME="wxcursor"></A><CENTER>
<A HREF="wx.htm"><img align=center src="contents.gif" BORDER=0 ALT="Contents"></A> <A HREF="wx22.htm#classref"><img align=center src="up.gif" BORDER=0 ALT="Up"></A> <A HREF="wx58.htm#wxcriticalsectionlocker"><img align=center src="back.gif" BORDER=0 ALT="Previous"></A> <A HREF="wx60.htm#wxdatabase"><img align=center src="forward.gif" BORDER=0 ALT="Next"></A> </CENTER><HR>
<H2>wxCursor</H2>
<P>
A cursor is a small bitmap usually used for denoting where the mouse
pointer is, with a picture that might indicate the interpretation of a
mouse click. As with icons, cursors in X and MS Windows are created
in a different manner. Therefore, separate cursors will be created for the
different environments. Platform-specific methods for creating a <B>
wxCursor</B> object are catered for, and this is an occasion where
conditional compilation will probably be required (see <A HREF="wx114.htm#wxicon">wxIcon</A> for
an example).<P>
A single cursor object may be used in many windows (any subwindow type).
The wxWindows convention is to set the cursor for a window, as in X,
rather than to set it globally as in MS Windows, although a
global <A HREF="wx268.htm#wxsetcursor">::wxSetCursor</A> is also available for MS Windows use.<P>
<B><FONT COLOR="#FF0000">Derived from</FONT></B><P>
<A HREF="wx32.htm#wxbitmap">wxBitmap</A><BR>
<A HREF="wx107.htm#wxgdiobject">wxGDIObject</A><BR>
<A HREF="wx158.htm#wxobject">wxObject</A><P>
<B><FONT COLOR="#FF0000">Include files</FONT></B><P>
<wx/cursor.h><P>
<B><FONT COLOR="#FF0000">Predefined objects</FONT></B><P>
Objects:<P>
<B>wxNullCursor</B><P>
Pointers:<P>
<B>wxSTANDARD_CURSOR<BR>
wxHOURGLASS_CURSOR<BR>
wxCROSS_CURSOR</B><P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx32.htm#wxbitmap">wxBitmap</A>, <A HREF="wx114.htm#wxicon">wxIcon</A>, <A HREF="wx260.htm#wxwindowsetcursor">wxWindow::SetCursor</A>,
<A HREF="wx268.htm#wxsetcursor">::wxSetCursor</A><P>
<B><FONT COLOR="#FF0000">Members</FONT></B><P>
<A HREF="#wxcursorconstr">wxCursor::wxCursor</A><BR>
<A HREF="#topic140">wxCursor::~wxCursor</A><BR>
<A HREF="#wxcursorok">wxCursor::Ok</A><BR>
<A HREF="#wxcursorassignment">wxCursor::operator =</A><BR>
<A HREF="#wxcursorequals">wxCursor::operator ==</A><BR>
<A HREF="#wxcursornotequals">wxCursor::operator !=</A><BR>
<P>
<HR>
<A NAME="wxcursorconstr"></A>
<H3>wxCursor::wxCursor</H3>
<P>
<B></B> <B>wxCursor</B>()<P>
Default constructor.<P>
<B></B> <B>wxCursor</B>(<B>const char</B><I> bits[]</I>, <B>int </B><I>width</I>,
<B>int </B><I> height</I>, <B>int </B><I>hotSpotX=-1</I>, <B>int </B><I>hotSpotY=-1</I>, <B>const char </B><I>maskBits[]=NULL</I>)<P>
Constructs a cursor by passing an array of bits (Motif and Xt only). <I>maskBits</I> is used only under Motif.<P>
If either <I>hotSpotX</I> or <I>hotSpotY</I> is -1, the hotspot will be the centre of the cursor image (Motif only).<P>
<B></B> <B>wxCursor</B>(<B>const wxString& </B><I>cursorName</I>, <B>long </B><I>type</I>, <B>int </B><I>hotSpotX=0</I>, <B>int </B><I>hotSpotY=0</I>)<P>
Constructs a cursor by passing a string resource name or filename.<P>
<I>hotSpotX</I> and <I>hotSpotY</I> are currently only used under Windows when loading from an
icon file, to specify the cursor hotspot relative to the top left of the image.<P>
<B></B> <B>wxCursor</B>(<B>int</B><I> cursorId</I>)<P>
Constructs a cursor using a cursor identifier.<P>
<B></B> <B>wxCursor</B>(<B>const wxCursor&</B><I> cursor</I>)<P>
Copy constructor. This uses reference counting so is a cheap operation.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>bits</I><UL><UL>
An array of bits.</UL></UL>
<P>
<I>maskBits</I><UL><UL>
Bits for a mask bitmap.</UL></UL>
<P>
<I>width</I><UL><UL>
Cursor width.</UL></UL>
<P>
<I>height</I><UL><UL>
Cursor height.</UL></UL>
<P>
<I>hotSpotX</I><UL><UL>
Hotspot x coordinate.</UL></UL>
<P>
<I>hotSpotY</I><UL><UL>
Hotspot y coordinate.</UL></UL>
<P>
<I>type</I><UL><UL>
Icon type to load. Under Motif, <I>type</I> defaults to <B>wxBITMAP_TYPE_XBM</B>. Under Windows,
it defaults to <B>wxBITMAP_TYPE_CUR_RESOURCE</B>.<P>
Under X, the permitted cursor types are:<P>
<TABLE>
<TR><TD VALIGN=TOP>
<B>wxBITMAP_TYPE_XBM</B>
</TD>
<TD VALIGN=TOP>
Load an X bitmap file.
</TD></TR>
</TABLE>
<P>
Under Windows, the permitted types are:<P>
<TABLE>
<TR><TD VALIGN=TOP>
<B>wxBITMAP_TYPE_CUR</B>
</TD>
<TD VALIGN=TOP>
Load a cursor from a .cur cursor file (only if USE_RESOURCE_LOADING_IN_MSW
is enabled in setup.h).
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxBITMAP_TYPE_CUR_RESOURCE</B>
</TD>
<TD VALIGN=TOP>
Load a Windows resource (as specified in the .rc file).
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxBITMAP_TYPE_ICO</B>
</TD>
<TD VALIGN=TOP>
Load a cursor from a .ico icon file (only if USE_RESOURCE_LOADING_IN_MSW
is enabled in setup.h). Specify <I>hotSpotX</I> and <I>hotSpotY</I>.
</TD></TR>
</TABLE>
</UL></UL>
<P>
<I>cursorId</I><UL><UL>
A stock cursor identifier. May be one of:<P>
<TABLE>
<TR><TD VALIGN=TOP>
<B>wxCURSOR_ARROW</B>
</TD>
<TD VALIGN=TOP>
A standard arrow cursor.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxCURSOR_BULLSEYE</B>
</TD>
<TD VALIGN=TOP>
Bullseye cursor.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxCURSOR_CHAR</B>
</TD>
<TD VALIGN=TOP>
Rectangular character cursor.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxCURSOR_CROSS</B>
</TD>
<TD VALIGN=TOP>
A cross cursor.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxCURSOR_HAND</B>
</TD>
<TD VALIGN=TOP>
A hand cursor.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxCURSOR_IBEAM</B>
</TD>
<TD VALIGN=TOP>
An I-beam cursor (vertical line).
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxCURSOR_LEFT_BUTTON</B>
</TD>
<TD VALIGN=TOP>
Represents a mouse with the left button depressed.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxCURSOR_MAGNIFIER</B>
</TD>
<TD VALIGN=TOP>
A magnifier icon.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxCURSOR_MIDDLE_BUTTON</B>
</TD>
<TD VALIGN=TOP>
Represents a mouse with the middle button depressed.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxCURSOR_NO_ENTRY</B>
</TD>
<TD VALIGN=TOP>
A no-entry sign cursor.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxCURSOR_PAINT_BRUSH</B>
</TD>
<TD VALIGN=TOP>
A paintbrush cursor.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxCURSOR_PENCIL</B>
</TD>
<TD VALIGN=TOP>
A pencil cursor.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxCURSOR_POINT_LEFT</B>
</TD>
<TD VALIGN=TOP>
A cursor that points left.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxCURSOR_POINT_RIGHT</B>
</TD>
<TD VALIGN=TOP>
A cursor that points right.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxCURSOR_QUESTION_ARROW</B>
</TD>
<TD VALIGN=TOP>
An arrow and question mark.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxCURSOR_RIGHT_BUTTON</B>
</TD>
<TD VALIGN=TOP>
Represents a mouse with the right button depressed.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxCURSOR_SIZENESW</B>
</TD>
<TD VALIGN=TOP>
A sizing cursor pointing NE-SW.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxCURSOR_SIZENS</B>
</TD>
<TD VALIGN=TOP>
A sizing cursor pointing N-S.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxCURSOR_SIZENWSE</B>
</TD>
<TD VALIGN=TOP>
A sizing cursor pointing NW-SE.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxCURSOR_SIZEWE</B>
</TD>
<TD VALIGN=TOP>
A sizing cursor pointing W-E.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxCURSOR_SIZING</B>
</TD>
<TD VALIGN=TOP>
A general sizing cursor.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxCURSOR_SPRAYCAN</B>
</TD>
<TD VALIGN=TOP>
A spraycan cursor.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxCURSOR_WAIT</B>
</TD>
<TD VALIGN=TOP>
A wait cursor.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxCURSOR_WATCH</B>
</TD>
<TD VALIGN=TOP>
A watch cursor.
</TD></TR>
</TABLE>
<P>
Note that not all cursors are available on all platforms.</UL></UL>
<P>
<I>cursor</I><UL><UL>
Pointer or reference to a cursor to copy.</UL></UL>
<P>
<B><FONT COLOR="#0000C8">wxPython note:</FONT></B><BR>
Constructors supported by wxPython are:<P>
<UL><UL>
<TABLE>
<TR><TD VALIGN=TOP>
<B>wxCursor(name, flags, hotSpotX=0,
hotSpotY=0)</B>
</TD>
<TD VALIGN=TOP>
Constructs a cursor from a filename
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxStockCursor(id)</B>
</TD>
<TD VALIGN=TOP>
Constructs a stock cursor
</TD></TR>
</TABLE>
</UL></UL>
<P>
<HR>
<A NAME="topic140"></A>
<H3>wxCursor::~wxCursor</H3>
<P>
<B></B> <B>~wxCursor</B>()<P>
Destroys the cursor. A cursor can be reused for more
than one window, and does not get destroyed when the window is
destroyed. wxWindows destroys all cursors on application exit, although
it's best to clean them up explicitly.<P>
<HR>
<A NAME="wxcursorok"></A>
<H3>wxCursor::Ok</H3>
<P>
<B>bool</B> <B>Ok</B>() <B>const</B><P>
Returns TRUE if cursor data is present.<P>
<HR>
<A NAME="wxcursorassignment"></A>
<H3>wxCursor::operator =</H3>
<P>
<B>wxCursor&</B> <B>operator =</B>(<B>const wxCursor& </B><I>cursor</I>)<P>
Assignment operator, using reference counting. Returns a reference
to 'this'.<P>
<HR>
<A NAME="wxcursorequals"></A>
<H3>wxCursor::operator ==</H3>
<P>
<B>bool</B> <B>operator ==</B>(<B>const wxCursor& </B><I>cursor</I>)<P>
Equality operator. Two cursors are equal if they contain pointers
to the same underlying cursor data. It does not compare each attribute,
so two independently-created cursors using the same parameters will
fail the test.<P>
<HR>
<A NAME="wxcursornotequals"></A>
<H3>wxCursor::operator !=</H3>
<P>
<B>bool</B> <B>operator !=</B>(<B>const wxCursor& </B><I>cursor</I>)<P>
Inequality operator. Two cursors are not equal if they contain pointers
to different underlying cursor data. It does not compare each attribute.<P>
</BODY></HTML>
|