]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/cursor.tex
image to bitmap rewrite,
[wxWidgets.git] / docs / latex / wx / cursor.tex
1 \section{\class{wxCursor}}\label{wxcursor}
2
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
10 an example).
11
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.
16
17 \wxheading{Derived from}
18
19 \helpref{wxBitmap}{wxbitmap}\\
20 \helpref{wxGDIObject}{wxgdiobject}\\
21 \helpref{wxObject}{wxobject}
22
23 \wxheading{Include files}
24
25 <wx/cursor.h>
26
27 \wxheading{Predefined objects}
28
29 Objects:
30
31 {\bf wxNullCursor}
32
33 Pointers:
34
35 {\bf wxSTANDARD\_CURSOR\\
36 wxHOURGLASS\_CURSOR\\
37 wxCROSS\_CURSOR}
38
39 \wxheading{See also}
40
41 \helpref{wxBitmap}{wxbitmap}, \helpref{wxIcon}{wxicon}, \helpref{wxWindow::SetCursor}{wxwindowsetcursor},\rtfsp
42 \helpref{::wxSetCursor}{wxsetcursor}
43
44 \latexignore{\rtfignore{\wxheading{Members}}}
45
46 \membersection{wxCursor::wxCursor}\label{wxcursorconstr}
47
48 \func{}{wxCursor}{\void}
49
50 Default constructor.
51
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}}
54
55 Constructs a cursor by passing an array of bits (Motif and Xt only). {\it maskBits} is used only under Motif.
56
57 If either {\it hotSpotX} or {\it hotSpotY} is -1, the hotspot will be the centre of the cursor image (Motif only).
58
59 \func{}{wxCursor}{\param{const wxString\& }{cursorName}, \param{long }{type}, \param{int }{hotSpotX=0}, \param{int }{hotSpotY=0}}
60
61 Constructs a cursor by passing a string resource name or filename.
62
63 {\it hotSpotX} and {\it hotSpotY} are currently only used under Windows when loading from an
64 icon file, to specify the cursor hotspot relative to the top left of the image.
65
66 \func{}{wxCursor}{\param{int}{ cursorId}}
67
68 Constructs a cursor using a cursor identifier.
69
70 \func{}{wxCursor}{\param{const wxCursor\&}{ cursor}}
71
72 Copy constructor. This uses reference counting so is a cheap operation.
73
74 \wxheading{Parameters}
75
76 \docparam{bits}{An array of bits.}
77
78 \docparam{maskBits}{Bits for a mask bitmap.}
79
80 \docparam{width}{Cursor width.}
81
82 \docparam{height}{Cursor height.}
83
84 \docparam{hotSpotX}{Hotspot x coordinate.}
85
86 \docparam{hotSpotY}{Hotspot y coordinate.}
87
88 \docparam{type}{Icon type to load. Under Motif, {\it type} defaults to {\bf wxBITMAP\_TYPE\_XBM}. Under Windows,
89 it defaults to {\bf wxBITMAP\_TYPE\_CUR\_RESOURCE}.
90
91 Under X, the permitted cursor types are:
92
93 \twocolwidtha{6cm}
94 \begin{twocollist}\itemsep=0pt
95 \twocolitem{\windowstyle{wxBITMAP\_TYPE\_XBM}}{Load an X bitmap file.}
96 \end{twocollist}
97
98 Under Windows, the permitted types are:
99
100 \twocolwidtha{6cm}
101 \begin{twocollist}\itemsep=0pt
102 \twocolitem{\windowstyle{wxBITMAP\_TYPE\_CUR}}{Load a cursor from a .cur cursor file (only if USE\_RESOURCE\_LOADING\_IN\_MSW
103 is enabled in setup.h).}
104 \twocolitem{\windowstyle{wxBITMAP\_TYPE\_CUR\_RESOURCE}}{Load a Windows resource (as specified in the .rc file).}
105 \twocolitem{\windowstyle{wxBITMAP\_TYPE\_ICO}}{Load a cursor from a .ico icon file (only if USE\_RESOURCE\_LOADING\_IN\_MSW
106 is enabled in setup.h). Specify {\it hotSpotX} and {\it hotSpotY}.}
107 \end{twocollist}}
108
109 \docparam{cursorId}{A stock cursor identifier. May be one of:
110
111 \twocolwidtha{6cm}
112 \begin{twocollist}\itemsep=0pt
113 \twocolitem{{\bf wxCURSOR\_ARROW}}{A standard arrow cursor.}
114 \twocolitem{{\bf wxCURSOR\_BULLSEYE}}{Bullseye cursor.}
115 \twocolitem{{\bf wxCURSOR\_CHAR}}{Rectangular character cursor.}
116 \twocolitem{{\bf wxCURSOR\_CROSS}}{A cross cursor.}
117 \twocolitem{{\bf wxCURSOR\_HAND}}{A hand cursor.}
118 \twocolitem{{\bf wxCURSOR\_IBEAM}}{An I-beam cursor (vertical line).}
119 \twocolitem{{\bf wxCURSOR\_LEFT\_BUTTON}}{Represents a mouse with the left button depressed.}
120 \twocolitem{{\bf wxCURSOR\_MAGNIFIER}}{A magnifier icon.}
121 \twocolitem{{\bf wxCURSOR\_MIDDLE\_BUTTON}}{Represents a mouse with the middle button depressed.}
122 \twocolitem{{\bf wxCURSOR\_NO\_ENTRY}}{A no-entry sign cursor.}
123 \twocolitem{{\bf wxCURSOR\_PAINT\_BRUSH}}{A paintbrush cursor.}
124 \twocolitem{{\bf wxCURSOR\_PENCIL}}{A pencil cursor.}
125 \twocolitem{{\bf wxCURSOR\_POINT\_LEFT}}{A cursor that points left.}
126 \twocolitem{{\bf wxCURSOR\_POINT\_RIGHT}}{A cursor that points right.}
127 \twocolitem{{\bf wxCURSOR\_QUESTION\_ARROW}}{An arrow and question mark.}
128 \twocolitem{{\bf wxCURSOR\_RIGHT\_BUTTON}}{Represents a mouse with the right button depressed.}
129 \twocolitem{{\bf wxCURSOR\_SIZENESW}}{A sizing cursor pointing NE-SW.}
130 \twocolitem{{\bf wxCURSOR\_SIZENS}}{A sizing cursor pointing N-S.}
131 \twocolitem{{\bf wxCURSOR\_SIZENWSE}}{A sizing cursor pointing NW-SE.}
132 \twocolitem{{\bf wxCURSOR\_SIZEWE}}{A sizing cursor pointing W-E.}
133 \twocolitem{{\bf wxCURSOR\_SIZING}}{A general sizing cursor.}
134 \twocolitem{{\bf wxCURSOR\_SPRAYCAN}}{A spraycan cursor.}
135 \twocolitem{{\bf wxCURSOR\_WAIT}}{A wait cursor.}
136 \twocolitem{{\bf wxCURSOR\_WATCH}}{A watch cursor.}
137 \end{twocollist}\twocolwidtha{5cm}
138
139 Note that not all cursors are available on all platforms.}
140
141 \docparam{cursor}{Pointer or reference to a cursor to copy.}
142
143 \pythonnote{Constructors supported by wxPython are:\par
144 \indented{2cm}{\begin{twocollist}
145 \twocolitem{{\bf wxCursor(name, flags, hotSpotX=0,
146 hotSpotY=0)}}{Constructs a cursor from a filename}
147 \twocolitem{{\bf wxStockCursor(id)}}{Constructs a stock cursor }
148 \end{twocollist}}
149 }
150
151 \membersection{wxCursor::\destruct{wxCursor}}
152
153 \func{}{\destruct{wxCursor}}{\void}
154
155 Destroys the cursor. A cursor can be reused for more
156 than one window, and does not get destroyed when the window is
157 destroyed. wxWindows destroys all cursors on application exit, although
158 it's best to clean them up explicitly.
159
160 \membersection{wxCursor::Ok}\label{wxcursorok}
161
162 \constfunc{bool}{Ok}{\void}
163
164 Returns TRUE if cursor data is present.
165
166 \membersection{wxCursor::operator $=$}\label{wxcursorassignment}
167
168 \func{wxCursor\&}{operator $=$}{\param{const wxCursor\& }{cursor}}
169
170 Assignment operator, using reference counting. Returns a reference
171 to `this'.
172
173 \membersection{wxCursor::operator $==$}\label{wxcursorequals}
174
175 \func{bool}{operator $==$}{\param{const wxCursor\& }{cursor}}
176
177 Equality operator. Two cursors are equal if they contain pointers
178 to the same underlying cursor data. It does not compare each attribute,
179 so two independently-created cursors using the same parameters will
180 fail the test.
181
182 \membersection{wxCursor::operator $!=$}\label{wxcursornotequals}
183
184 \func{bool}{operator $!=$}{\param{const wxCursor\& }{cursor}}
185
186 Inequality operator. Two cursors are not equal if they contain pointers
187 to different underlying cursor data. It does not compare each attribute.
188
189