1 \section{\class{wxCursor
}}\label{wxcursor
}
3 A cursor is a small bitmap usually used for denoting where the mouse
4 pointer is, with a picture that might indicate the interpretation of a
5 mouse click. As with icons, cursors in X and MS Windows are created
6 in a different manner. Therefore, separate cursors will be created for the
7 different environments. Platform-specific methods for creating a
{\bf
8 wxCursor
} object are catered for, and this is an occasion where
9 conditional compilation will probably be required (see
\helpref{wxIcon
}{wxicon
} for
12 A single cursor object may be used in many windows (any subwindow type).
13 The wxWindows convention is to set the cursor for a window, as in X,
14 rather than to set it globally as in MS Windows, although a
15 global
\helpref{::wxSetCursor
}{wxsetcursor
} is also available for MS Windows use.
17 \wxheading{Derived from
}
19 \helpref{wxBitmap
}{wxbitmap
}\\
20 \helpref{wxGDIObject
}{wxgdiobject
}\\
21 \helpref{wxObject
}{wxobject
}
23 \wxheading{Include files
}
27 \wxheading{Predefined objects
}
35 {\bf wxSTANDARD
\_CURSOR\\
41 \helpref{wxBitmap
}{wxbitmap
},
\helpref{wxIcon
}{wxicon
},
\helpref{wxWindow::SetCursor
}{wxwindowsetcursor
},
\rtfsp
42 \helpref{::wxSetCursor
}{wxsetcursor
}
44 \latexignore{\rtfignore{\wxheading{Members
}}}
46 \membersection{wxCursor::wxCursor
}\label{wxcursorconstr
}
48 \func{}{wxCursor
}{\void}
52 \func{}{wxCursor
}{\param{const char
}{ bits
[]},
\param{int
}{width
},
53 \param{int
}{ height
},
\param{int
}{hotSpotX=-
1},
\param{int
}{hotSpotY=-
1},
\param{const char
}{maskBits
[]=NULL
}}
55 Constructs a cursor by passing an array of bits (Motif and Xt only).
{\it maskBits
} is used only under Motif.
57 If either
{\it hotSpotX
} or
{\it hotSpotY
} is -
1, the hotspot will be the centre of the cursor image (Motif only).
59 \func{}{wxCursor
}{\param{const wxString\&
}{cursorName
},
\param{long
}{type
},
\param{int
}{hotSpotX=
0},
\param{int
}{hotSpotY=
0}}
61 Constructs a cursor by passing a string resource name or filename.
63 On MacOS when specifying a string resource name, first the
color cursors 'crsr' and then the black/white cursors 'CURS' in the resource chain are scanned through.
65 {\it hotSpotX
} and
{\it hotSpotY
} are currently only used under Windows when loading from an
66 icon file, to specify the cursor hotspot relative to the top left of the image.
68 \func{}{wxCursor
}{\param{int
}{ cursorId
}}
70 Constructs a cursor using a cursor identifier.
72 \func{}{wxCursor
}{\param{const wxImage\&
}{ image
}}
74 Constructs a cursor from a wxImage. The cursor is monochrome, colors with the RGB elements all greater
75 than
127 will be foreground, colors less than this background. The mask (if any) will be used as transparent.
77 In MSW the foreground will be white and the background black. The cursor is resized to
32x32
78 In GTK, the two most frequent colors will be used for foreground and background. The cursor will be displayed
79 at the size of the image.
80 On MacOS the cursor is resized to
16x16 and currently only shown as black/white (mask respected).
82 \func{}{wxCursor
}{\param{const wxCursor\&
}{ cursor
}}
84 Copy constructor. This uses reference counting so is a cheap operation.
86 \wxheading{Parameters
}
88 \docparam{bits
}{An array of bits.
}
90 \docparam{maskBits
}{Bits for a mask bitmap.
}
92 \docparam{width
}{Cursor width.
}
94 \docparam{height
}{Cursor height.
}
96 \docparam{hotSpotX
}{Hotspot x coordinate.
}
98 \docparam{hotSpotY
}{Hotspot y coordinate.
}
100 \docparam{type
}{Icon type to load. Under Motif,
{\it type
} defaults to
{\bf wxBITMAP
\_TYPE\_XBM}. Under Windows,
101 it defaults to
{\bf wxBITMAP
\_TYPE\_CUR\_RESOURCE}. Under MacOS, it defaults to
{\bf wxBITMAP
\_TYPE\_MACCURSOR\_RESOURCE}.
103 Under X, the permitted cursor types are:
106 \begin{twocollist
}\itemsep=
0pt
107 \twocolitem{\windowstyle{wxBITMAP
\_TYPE\_XBM}}{Load an X bitmap file.
}
110 Under Windows, the permitted types are:
113 \begin{twocollist
}\itemsep=
0pt
114 \twocolitem{\windowstyle{wxBITMAP
\_TYPE\_CUR}}{Load a cursor from a .cur cursor file (only if USE
\_RESOURCE\_LOADING\_IN\_MSW
115 is enabled in setup.h).
}
116 \twocolitem{\windowstyle{wxBITMAP
\_TYPE\_CUR\_RESOURCE}}{Load a Windows resource (as specified in the .rc file).
}
117 \twocolitem{\windowstyle{wxBITMAP
\_TYPE\_ICO}}{Load a cursor from a .ico icon file (only if USE
\_RESOURCE\_LOADING\_IN\_MSW
118 is enabled in setup.h). Specify
{\it hotSpotX
} and
{\it hotSpotY
}.
}
121 \docparam{cursorId
}{A stock cursor identifier. May be one of:
124 \begin{twocollist
}\itemsep=
0pt
125 \twocolitem{{\bf wxCURSOR
\_ARROW}}{A standard arrow cursor.
}
126 \twocolitem{{\bf wxCURSOR
\_RIGHT\_ARROW}}{A standard arrow cursor
127 pointing to the right.
}
128 \twocolitem{{\bf wxCURSOR
\_BLANK}}{Transparent cursor.
}
129 \twocolitem{{\bf wxCURSOR
\_BULLSEYE}}{Bullseye cursor.
}
130 \twocolitem{{\bf wxCURSOR
\_CHAR}}{Rectangular character cursor.
}
131 \twocolitem{{\bf wxCURSOR
\_CROSS}}{A cross cursor.
}
132 \twocolitem{{\bf wxCURSOR
\_HAND}}{A hand cursor.
}
133 \twocolitem{{\bf wxCURSOR
\_IBEAM}}{An I-beam cursor (vertical line).
}
134 \twocolitem{{\bf wxCURSOR
\_LEFT\_BUTTON}}{Represents a mouse with the left button depressed.
}
135 \twocolitem{{\bf wxCURSOR
\_MAGNIFIER}}{A magnifier icon.
}
136 \twocolitem{{\bf wxCURSOR
\_MIDDLE\_BUTTON}}{Represents a mouse with the middle button depressed.
}
137 \twocolitem{{\bf wxCURSOR
\_NO\_ENTRY}}{A no-entry sign cursor.
}
138 \twocolitem{{\bf wxCURSOR
\_PAINT\_BRUSH}}{A paintbrush cursor.
}
139 \twocolitem{{\bf wxCURSOR
\_PENCIL}}{A pencil cursor.
}
140 \twocolitem{{\bf wxCURSOR
\_POINT\_LEFT}}{A cursor that points left.
}
141 \twocolitem{{\bf wxCURSOR
\_POINT\_RIGHT}}{A cursor that points right.
}
142 \twocolitem{{\bf wxCURSOR
\_QUESTION\_ARROW}}{An arrow and question mark.
}
143 \twocolitem{{\bf wxCURSOR
\_RIGHT\_BUTTON}}{Represents a mouse with the right button depressed.
}
144 \twocolitem{{\bf wxCURSOR
\_SIZENESW}}{A sizing cursor pointing NE-SW.
}
145 \twocolitem{{\bf wxCURSOR
\_SIZENS}}{A sizing cursor pointing N-S.
}
146 \twocolitem{{\bf wxCURSOR
\_SIZENWSE}}{A sizing cursor pointing NW-SE.
}
147 \twocolitem{{\bf wxCURSOR
\_SIZEWE}}{A sizing cursor pointing W-E.
}
148 \twocolitem{{\bf wxCURSOR
\_SIZING}}{A general sizing cursor.
}
149 \twocolitem{{\bf wxCURSOR
\_SPRAYCAN}}{A spraycan cursor.
}
150 \twocolitem{{\bf wxCURSOR
\_WAIT}}{A wait cursor.
}
151 \twocolitem{{\bf wxCURSOR
\_WATCH}}{A watch cursor.
}
152 \twocolitem{{\bf wxCURSOR
\_ARROWWAIT}}{A cursor with both an arrow and
153 an hourglass, (windows.)
}
154 \end{twocollist
}\twocolwidtha{5cm
}
156 Note that not all cursors are available on all platforms.
}
158 \docparam{cursor
}{Pointer or reference to a cursor to copy.
}
160 \pythonnote{Constructors supported by wxPython are:
\par
161 \indented{2cm
}{\begin{twocollist
}
162 \twocolitem{{\bf wxCursor(name, flags, hotSpotX=
0,
163 hotSpotY=
0)
}}{Constructs a cursor from a filename
}
164 \twocolitem{{\bf wxStockCursor(id)
}}{Constructs a stock cursor
}
168 \perlnote{Constructors supported by wxPerl are:
\par
170 \item{Wx::Cursor->new( name, type, hotSpotX =
0, hotSpotY =
0 )
}
171 \item{Wx::Cursor->new( id )
}
172 \item{Wx::Cursor->new( image )
}
173 \item{Wx::Cursor->newData( bits, width, height, hotSpotX = -
1, hotSpotY = -
1, maskBits =
0 )
}
177 \membersection{wxCursor::
\destruct{wxCursor
}}
179 \func{}{\destruct{wxCursor
}}{\void}
181 Destroys the cursor. A cursor can be reused for more
182 than one window, and does not get destroyed when the window is
183 destroyed. wxWindows destroys all cursors on application exit, although
184 it is best to clean them up explicitly.
186 \membersection{wxCursor::Ok
}\label{wxcursorok
}
188 \constfunc{bool
}{Ok
}{\void}
190 Returns true if cursor data is present.
192 \membersection{wxCursor::operator $=$
}\label{wxcursorassignment
}
194 \func{wxCursor\&
}{operator $=$
}{\param{const wxCursor\&
}{cursor
}}
196 Assignment operator, using reference counting. Returns a reference
199 \membersection{wxCursor::operator $==$
}\label{wxcursorequals
}
201 \func{bool
}{operator $==$
}{\param{const wxCursor\&
}{cursor
}}
203 Equality operator. Two cursors are equal if they contain pointers
204 to the same underlying cursor data. It does not compare each attribute,
205 so two independently-created cursors using the same parameters will
208 \membersection{wxCursor::operator $!=$
}\label{wxcursornotequals
}
210 \func{bool
}{operator $!=$
}{\param{const wxCursor\&
}{cursor
}}
212 Inequality operator. Two cursors are not equal if they contain pointers
213 to different underlying cursor data. It does not compare each attribute.