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
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>TQCursor Class</title>
<style type="text/css"><!--
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
<a href="index.html">
<font color="#004faf">Home</font></a>
| <a href="classes.html">
<font color="#004faf">All Classes</font></a>
| <a href="mainclasses.html">
<font color="#004faf">Main Classes</font></a>
| <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
| <a href="groups.html">
<font color="#004faf">Grouped Classes</font></a>
| <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>TQCursor Class Reference</h1>
<p>The TQCursor class provides a mouse cursor with an arbitrary
shape.
<a href="#details">More...</a>
<p><tt>#include <<a href="tqcursor-h.html">tqcursor.h</a>></tt>
<p>Inherits <a href="tqt.html">TQt</a>.
<p><a href="tqcursor-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#TQCursor"><b>TQCursor</b></a> ()</li>
<li class=fn><a href="#TQCursor-2"><b>TQCursor</b></a> ( int shape )</li>
<li class=fn><a href="#TQCursor-3"><b>TQCursor</b></a> ( const TQBitmap & bitmap, const TQBitmap & mask, int hotX = -1, int hotY = -1 )</li>
<li class=fn><a href="#TQCursor-4"><b>TQCursor</b></a> ( const TQPixmap & pixmap, int hotX = -1, int hotY = -1 )</li>
<li class=fn><a href="#TQCursor-5"><b>TQCursor</b></a> ( const TQCursor & c )</li>
<li class=fn><a href="#~TQCursor"><b>~TQCursor</b></a> ()</li>
<li class=fn>TQCursor & <a href="#operator-eq"><b>operator=</b></a> ( const TQCursor & c )</li>
<li class=fn>int <a href="#shape"><b>shape</b></a> () const</li>
<li class=fn>void <a href="#setShape"><b>setShape</b></a> ( int shape )</li>
<li class=fn>const TQBitmap * <a href="#bitmap"><b>bitmap</b></a> () const</li>
<li class=fn>const TQBitmap * <a href="#mask"><b>mask</b></a> () const</li>
<li class=fn>TQPoint <a href="#hotSpot"><b>hotSpot</b></a> () const</li>
<li class=fn>HCURSOR <b>handle</b> () const</li>
<li class=fn><a href="#TQCursor-6"><b>TQCursor</b></a> ( HCURSOR handle )</li>
<li class=fn>HANDLE <a href="#handle"><b>handle</b></a> () const</li>
</ul>
<h2>Static Public Members</h2>
<ul>
<li class=fn>TQPoint <a href="#pos"><b>pos</b></a> ()</li>
<li class=fn>void <a href="#setPos"><b>setPos</b></a> ( int x, int y )</li>
<li class=fn>void <a href="#setPos-2"><b>setPos</b></a> ( const TQPoint & )</li>
<li class=fn>void <a href="#initialize"><b>initialize</b></a> ()</li>
<li class=fn>void <a href="#cleanup"><b>cleanup</b></a> ()</li>
</ul>
<h2>Related Functions</h2>
<ul>
<li class=fn>TQDataStream & <a href="#operator-lt-lt"><b>operator<<</b></a> ( TQDataStream & s, const TQCursor & c )</li>
<li class=fn>TQDataStream & <a href="#operator-gt-gt"><b>operator>></b></a> ( TQDataStream & s, TQCursor & c )</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
<p> The TQCursor class provides a mouse cursor with an arbitrary
shape.
<p>
<p> This class is mainly used to create mouse cursors that are
associated with particular widgets and to get and set the position
of the mouse cursor.
<p> TQt has a number of standard cursor shapes, but you can also make
custom cursor shapes based on a <a href="tqbitmap.html">TQBitmap</a>, a mask and a hotspot.
<p> To associate a cursor with a widget, use <a href="tqwidget.html#setCursor">TQWidget::setCursor</a>(). To
associate a cursor with all widgets (normally for a short period
of time), use <a href="ntqapplication.html#setOverrideCursor">TQApplication::setOverrideCursor</a>().
<p> To set a cursor shape use <a href="#setShape">TQCursor::setShape</a>() or use the TQCursor
constructor which takes the shape as argument, or you can use one
of the predefined cursors defined in the <a href="tqt.html#CursorShape-enum">CursorShape</a> enum.
<p> If you want to create a cursor with your own bitmap, either use
the TQCursor constructor which takes a bitmap and a mask or the
constructor which takes a pixmap as arguments.
<p> To set or get the position of the mouse cursor use the static
methods <a href="#pos">TQCursor::pos</a>() and <a href="#setPos">TQCursor::setPos</a>().
<p> <center><img src="cursors.png" alt="Cursor Shapes"></center>
<p> <p>See also <a href="tqwidget.html">TQWidget</a>, <a href="guibooks.html#fowler">GUI Design Handbook:
Cursors</a>, <a href="appearance.html">Widget Appearance and Style</a>, and <a href="shared.html">Implicitly and Explicitly Shared Classes</a>.
<p> On X11, TQt supports the <a href="http://www.xfree86.org/4.3.0/Xcursor.3.html">Xcursor</a>
library, which allows for full color icon themes. The table below
shows the cursor name used for each TQt::CursorShape value. If a
cursor cannot be found using the name shown below, a standard X11
cursor will be used instead. Note: X11 does not provide
appropriate cursors for all possible TQt::CursorShape values. It
is possible that some cursors will be taken from the Xcursor
theme, while others will use an internal bitmap cursor.
<p> <center><table cellpadding="4" cellspacing="2" border="0">
<tr bgcolor="#a2c511"> <th valign="top">TQt::CursorShape Values <th valign="top">Cursor Names
<tr bgcolor="#f0f0f0"> <td valign="top">TQt::ArrowCursor <td valign="top">left_ptr
<tr bgcolor="#d0d0d0"> <td valign="top">TQt::UpArrowCursor <td valign="top">up_arrow
<tr bgcolor="#f0f0f0"> <td valign="top">TQt::CrossCursor <td valign="top">cross
<tr bgcolor="#d0d0d0"> <td valign="top">TQt::WaitCursor <td valign="top">wait
<tr bgcolor="#f0f0f0"> <td valign="top">TQt::BusyCursor <td valign="top">left_ptr_watch
<tr bgcolor="#d0d0d0"> <td valign="top">TQt::IbeamCursor <td valign="top">ibeam
<tr bgcolor="#f0f0f0"> <td valign="top">TQt::SizeVerCursor <td valign="top">size_ver
<tr bgcolor="#d0d0d0"> <td valign="top">TQt::SizeHorCursor <td valign="top">size_hor
<tr bgcolor="#f0f0f0"> <td valign="top">TQt::SizeBDiagCursor <td valign="top">size_bdiag
<tr bgcolor="#d0d0d0"> <td valign="top">TQt::SizeFDiagCursor <td valign="top">size_fdiag
<tr bgcolor="#f0f0f0"> <td valign="top">TQt::SizeAllCursor <td valign="top">size_all
<tr bgcolor="#d0d0d0"> <td valign="top">TQt::SplitVCursor <td valign="top">split_v
<tr bgcolor="#f0f0f0"> <td valign="top">TQt::SplitHCursor <td valign="top">split_h
<tr bgcolor="#d0d0d0"> <td valign="top">TQt::PointingHandCursor <td valign="top">pointing_hand
<tr bgcolor="#f0f0f0"> <td valign="top">TQt::ForbiddenCursor <td valign="top">forbidden
<tr bgcolor="#d0d0d0"> <td valign="top">TQt::WhatsThisCursor <td valign="top">whats_this
</table></center>
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="TQCursor"></a>TQCursor::TQCursor ()
</h3>
Constructs a cursor with the default arrow shape.
<h3 class=fn><a name="TQCursor-2"></a>TQCursor::TQCursor ( int shape )
</h3>
Constructs a cursor with the specified <em>shape</em>.
<p> See <a href="tqt.html#CursorShape-enum">CursorShape</a> for a list of shapes.
<p> <p>See also <a href="#setShape">setShape</a>().
<h3 class=fn><a name="TQCursor-3"></a>TQCursor::TQCursor ( const <a href="tqbitmap.html">TQBitmap</a> & bitmap, const <a href="tqbitmap.html">TQBitmap</a> & mask, int hotX = -1, int hotY = -1 )
</h3>
Constructs a custom bitmap cursor.
<p> <em>bitmap</em> and
<em>mask</em> make up the bitmap.
<em>hotX</em> and
<em>hotY</em> define the cursor's hot spot.
<p> If <em>hotX</em> is negative, it is set to the <tt>bitmap().width()/2</tt>.
If <em>hotY</em> is negative, it is set to the <tt>bitmap().height()/2</tt>.
<p> The cursor <em>bitmap</em> (B) and <em>mask</em> (M) bits are combined like this:
<ul>
<li> B=1 and M=1 gives black.
<li> B=0 and M=1 gives white.
<li> B=0 and M=0 gives transparent.
<li> B=1 and M=0 gives an undefined result.
</ul>
<p> Use the global TQt color <tt>color0</tt> to draw 0-pixels and <tt>color1</tt> to
draw 1-pixels in the bitmaps.
<p> Valid cursor sizes depend on the display hardware (or the
underlying window system). We recommend using 32x32 cursors,
because this size is supported on all platforms. Some platforms
also support 16x16, 48x48 and 64x64 cursors.
<p> <p>See also <a href="tqbitmap.html#TQBitmap">TQBitmap::TQBitmap</a>() and <a href="tqpixmap.html#setMask">TQBitmap::setMask</a>().
<h3 class=fn><a name="TQCursor-4"></a>TQCursor::TQCursor ( const <a href="tqpixmap.html">TQPixmap</a> & pixmap, int hotX = -1, int hotY = -1 )
</h3>
Constructs a custom pixmap cursor.
<p> <em>pixmap</em> is the image. It is usual to give it a mask (set using
<a href="tqpixmap.html#setMask">TQPixmap::setMask</a>()). <em>hotX</em> and <em>hotY</em> define the cursor's hot
spot.
<p> If <em>hotX</em> is negative, it is set to the <tt>pixmap().width()/2</tt>.
If <em>hotY</em> is negative, it is set to the <tt>pixmap().height()/2</tt>.
<p> Valid cursor sizes depend on the display hardware (or the
underlying window system). We recommend using 32x32 cursors,
because this size is supported on all platforms. Some platforms
also support 16x16, 48x48 and 64x64 cursors.
<p> Currently, only black-and-white pixmaps can be used.
<p> <p>See also <a href="tqpixmap.html#TQPixmap">TQPixmap::TQPixmap</a>() and <a href="tqpixmap.html#setMask">TQPixmap::setMask</a>().
<h3 class=fn><a name="TQCursor-5"></a>TQCursor::TQCursor ( const <a href="tqcursor.html">TQCursor</a> & c )
</h3>
Constructs a copy of the cursor <em>c</em>.
<h3 class=fn><a name="TQCursor-6"></a>TQCursor::TQCursor ( HCURSOR handle )
</h3>
<p> Creates a cursor with the specified window system handle <em>handle</em>.
<p> <b>Warning:</b>
Portable in principle, but if you use it you are probably about to
do something non-portable. Be careful.
<h3 class=fn><a name="~TQCursor"></a>TQCursor::~TQCursor ()
</h3>
Destroys the cursor.
<h3 class=fn>const <a href="tqbitmap.html">TQBitmap</a> * <a name="bitmap"></a>TQCursor::bitmap () const
</h3>
Returns the cursor bitmap, or 0 if it is one of the standard
cursors.
<h3 class=fn>void <a name="cleanup"></a>TQCursor::cleanup ()<tt> [static]</tt>
</h3>
Internal function that deinitializes the predefined cursors.
This function is called from the <a href="ntqapplication.html">TQApplication</a> destructor.
<p> <p>See also <a href="#initialize">initialize</a>().
<h3 class=fn>HANDLE <a name="handle"></a>TQCursor::handle () const
</h3>
Returns the window system cursor handle.
<p> <b>Warning:</b>
Portable in principle, but if you use it you are probably about to
do something non-portable. Be careful.
<h3 class=fn><a href="tqpoint.html">TQPoint</a> <a name="hotSpot"></a>TQCursor::hotSpot () const
</h3>
Returns the cursor hot spot, or (0, 0) if it is one of the
standard cursors.
<h3 class=fn>void <a name="initialize"></a>TQCursor::initialize ()<tt> [static]</tt>
</h3>
Internal function that initializes the predefined cursors.
This function is called from the <a href="ntqapplication.html">TQApplication</a> constructor.
<p> <p>See also <a href="#cleanup">cleanup</a>().
<h3 class=fn>const <a href="tqbitmap.html">TQBitmap</a> * <a name="mask"></a>TQCursor::mask () const
</h3>
Returns the cursor bitmap mask, or 0 if it is one of the standard
cursors.
<h3 class=fn><a href="tqcursor.html">TQCursor</a> & <a name="operator-eq"></a>TQCursor::operator= ( const <a href="tqcursor.html">TQCursor</a> & c )
</h3>
Assigns <em>c</em> to this cursor and returns a reference to this
cursor.
<h3 class=fn><a href="tqpoint.html">TQPoint</a> <a name="pos"></a>TQCursor::pos ()<tt> [static]</tt>
</h3>
Returns the position of the cursor (hot spot) in global screen
coordinates.
<p> You can call <a href="tqwidget.html#mapFromGlobal">TQWidget::mapFromGlobal</a>() to translate it to widget
coordinates.
<p> <p>See also <a href="#setPos">setPos</a>(), <a href="tqwidget.html#mapFromGlobal">TQWidget::mapFromGlobal</a>(), and <a href="tqwidget.html#mapToGlobal">TQWidget::mapToGlobal</a>().
<p>Examples: <a href="tutorial2-06.html#x2579">chart/canvasview.cpp</a>, <a href="fileiconview-example.html#x809">fileiconview/tqfileiconview.cpp</a>, and <a href="menu-example.html#x1859">menu/menu.cpp</a>.
<h3 class=fn>void <a name="setPos"></a>TQCursor::setPos ( int x, int y )<tt> [static]</tt>
</h3>
Moves the cursor (hot spot) to the global screen position (<em>x</em>,
<em>y</em>).
<p> You can call <a href="tqwidget.html#mapToGlobal">TQWidget::mapToGlobal</a>() to translate widget
coordinates to global screen coordinates.
<p> <p>See also <a href="#pos">pos</a>(), <a href="tqwidget.html#mapFromGlobal">TQWidget::mapFromGlobal</a>(), and <a href="tqwidget.html#mapToGlobal">TQWidget::mapToGlobal</a>().
<h3 class=fn>void <a name="setPos-2"></a>TQCursor::setPos ( const <a href="tqpoint.html">TQPoint</a> & )<tt> [static]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p>
<h3 class=fn>void <a name="setShape"></a>TQCursor::setShape ( int shape )
</h3>
Sets the cursor to the shape identified by <em>shape</em>.
<p> See <a href="tqt.html#CursorShape-enum">CursorShape</a> for the list of cursor shapes.
<p> <p>See also <a href="#shape">shape</a>().
<h3 class=fn>int <a name="shape"></a>TQCursor::shape () const
</h3>
Returns the cursor shape identifier. The return value is one of
the <a href="tqt.html#CursorShape-enum">CursorShape</a> enum values (cast to an int).
<p> <p>See also <a href="#setShape">setShape</a>().
<hr><h2>Related Functions</h2>
<h3 class=fn><a href="tqdatastream.html">TQDataStream</a> & <a name="operator-lt-lt"></a>operator<< ( <a href="tqdatastream.html">TQDataStream</a> & s, const <a href="tqcursor.html">TQCursor</a> & c )
</h3>
Writes the cursor <em>c</em> to the stream <em>s</em>.
<p> <p>See also <a href="datastreamformat.html">Format of the TQDataStream operators</a>.
<h3 class=fn><a href="tqdatastream.html">TQDataStream</a> & <a name="operator-gt-gt"></a>operator>> ( <a href="tqdatastream.html">TQDataStream</a> & s, <a href="tqcursor.html">TQCursor</a> & c )
</h3>
Reads a cursor from the stream <em>s</em> and sets <em>c</em> to the read data.
<p> <p>See also <a href="datastreamformat.html">Format of the TQDataStream operators</a>.
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">TQt toolkit</a>.
Copyright © 1995-2007
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright © 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>TQt 3.3.8</div>
</table></div></address></body>
</html>
|