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