1 | /****************************************************************************
|
---|
2 | ** $Id: qcursor_pm.cpp 8 2005-11-16 19:36:46Z dmik $
|
---|
3 | **
|
---|
4 | ** Implementation of QCursor class for OS/2
|
---|
5 | **
|
---|
6 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
|
---|
7 | ** Copyright (C) 2004 Norman ASA. Initial OS/2 Port.
|
---|
8 | ** Copyright (C) 2005 netlabs.org. Further OS/2 Development.
|
---|
9 | **
|
---|
10 | ** This file is part of the kernel module of the Qt GUI Toolkit.
|
---|
11 | **
|
---|
12 | ** This file may be distributed under the terms of the Q Public License
|
---|
13 | ** as defined by Trolltech AS of Norway and appearing in the file
|
---|
14 | ** LICENSE.QPL included in the packaging of this file.
|
---|
15 | **
|
---|
16 | ** This file may be distributed and/or modified under the terms of the
|
---|
17 | ** GNU General Public License version 2 as published by the Free Software
|
---|
18 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
19 | ** packaging of this file.
|
---|
20 | **
|
---|
21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
|
---|
22 | ** licenses may use this file in accordance with the Qt Commercial License
|
---|
23 | ** Agreement provided with the Software.
|
---|
24 | **
|
---|
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
---|
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
---|
27 | **
|
---|
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
|
---|
29 | ** information about Qt Commercial License Agreements.
|
---|
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information.
|
---|
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information.
|
---|
32 | **
|
---|
33 | ** Contact info@trolltech.com if any conditions of this licensing are
|
---|
34 | ** not clear to you.
|
---|
35 | **
|
---|
36 | **********************************************************************/
|
---|
37 |
|
---|
38 | #include "qcursor.h"
|
---|
39 | #include "qbitmap.h"
|
---|
40 | #include "qapplication.h"
|
---|
41 | #include "qapplication_p.h"
|
---|
42 | #include "qimage.h"
|
---|
43 | #include "qdatastream.h"
|
---|
44 | #include "qt_os2.h"
|
---|
45 |
|
---|
46 | static QCursor cursorTable[Qt::LastCursor+1];
|
---|
47 |
|
---|
48 | QT_STATIC_CONST_IMPL QCursor & Qt::arrowCursor = cursorTable[0];
|
---|
49 | QT_STATIC_CONST_IMPL QCursor & Qt::upArrowCursor = cursorTable[1];
|
---|
50 | QT_STATIC_CONST_IMPL QCursor & Qt::crossCursor = cursorTable[2];
|
---|
51 | QT_STATIC_CONST_IMPL QCursor & Qt::waitCursor = cursorTable[3];
|
---|
52 | QT_STATIC_CONST_IMPL QCursor & Qt::ibeamCursor = cursorTable[4];
|
---|
53 | QT_STATIC_CONST_IMPL QCursor & Qt::sizeVerCursor = cursorTable[5];
|
---|
54 | QT_STATIC_CONST_IMPL QCursor & Qt::sizeHorCursor = cursorTable[6];
|
---|
55 | QT_STATIC_CONST_IMPL QCursor & Qt::sizeBDiagCursor = cursorTable[7];
|
---|
56 | QT_STATIC_CONST_IMPL QCursor & Qt::sizeFDiagCursor = cursorTable[8];
|
---|
57 | QT_STATIC_CONST_IMPL QCursor & Qt::sizeAllCursor = cursorTable[9];
|
---|
58 | QT_STATIC_CONST_IMPL QCursor & Qt::blankCursor = cursorTable[10];
|
---|
59 | QT_STATIC_CONST_IMPL QCursor & Qt::splitVCursor = cursorTable[11];
|
---|
60 | QT_STATIC_CONST_IMPL QCursor & Qt::splitHCursor = cursorTable[12];
|
---|
61 | QT_STATIC_CONST_IMPL QCursor & Qt::pointingHandCursor = cursorTable[13];
|
---|
62 | QT_STATIC_CONST_IMPL QCursor & Qt::forbiddenCursor = cursorTable[14];
|
---|
63 | QT_STATIC_CONST_IMPL QCursor & Qt::whatsThisCursor = cursorTable[15];
|
---|
64 | QT_STATIC_CONST_IMPL QCursor & Qt::busyCursor = cursorTable[16];
|
---|
65 |
|
---|
66 |
|
---|
67 | /*****************************************************************************
|
---|
68 | Internal QCursorData class
|
---|
69 | *****************************************************************************/
|
---|
70 |
|
---|
71 | struct QCursorData : public QShared {
|
---|
72 | QCursorData( int s = 0 );
|
---|
73 | ~QCursorData();
|
---|
74 | int cshape;
|
---|
75 | QBitmap *bm, *bmm;
|
---|
76 | short hx, hy;
|
---|
77 | HPOINTER hptr;
|
---|
78 | bool is_sysptr;
|
---|
79 | };
|
---|
80 |
|
---|
81 | QCursorData::QCursorData( int s )
|
---|
82 | {
|
---|
83 | cshape = s;
|
---|
84 | hptr = 0;
|
---|
85 | is_sysptr = false;
|
---|
86 | bm = bmm = 0;
|
---|
87 | hx = hy = 0;
|
---|
88 | }
|
---|
89 |
|
---|
90 | QCursorData::~QCursorData()
|
---|
91 | {
|
---|
92 | if ( bm ) delete bm;
|
---|
93 | if ( bmm ) delete bmm;
|
---|
94 | if ( hptr && !is_sysptr )
|
---|
95 | WinDestroyPointer( hptr );
|
---|
96 | }
|
---|
97 |
|
---|
98 |
|
---|
99 | /*****************************************************************************
|
---|
100 | QCursor member functions
|
---|
101 | *****************************************************************************/
|
---|
102 |
|
---|
103 | QCursor *QCursor::find_cur( int shape ) // find predefined cursor
|
---|
104 | {
|
---|
105 | return (uint)shape <= LastCursor ? &cursorTable[shape] : 0;
|
---|
106 | }
|
---|
107 |
|
---|
108 |
|
---|
109 | static bool initialized = FALSE;
|
---|
110 |
|
---|
111 | void QCursor::initialize()
|
---|
112 | {
|
---|
113 | int shape;
|
---|
114 | for( shape = 0; shape <= LastCursor; shape++ )
|
---|
115 | cursorTable[shape].data = new QCursorData( shape );
|
---|
116 | initialized = TRUE;
|
---|
117 | qAddPostRoutine( cleanup );
|
---|
118 | }
|
---|
119 |
|
---|
120 | void QCursor::cleanup()
|
---|
121 | {
|
---|
122 | int shape;
|
---|
123 | for( shape = 0; shape <= LastCursor; shape++ ) {
|
---|
124 | if ( cursorTable[shape].data && cursorTable[shape].data->deref() )
|
---|
125 | delete cursorTable[shape].data;
|
---|
126 | cursorTable[shape].data = 0;
|
---|
127 | }
|
---|
128 | initialized = FALSE;
|
---|
129 | }
|
---|
130 |
|
---|
131 | QCursor::QCursor()
|
---|
132 | {
|
---|
133 | if ( !initialized ) {
|
---|
134 | if ( qApp->startingUp() ) {
|
---|
135 | data = 0;
|
---|
136 | return;
|
---|
137 | }
|
---|
138 | initialize();
|
---|
139 | }
|
---|
140 | QCursor* c = (QCursor *)&arrowCursor;
|
---|
141 | c->data->ref();
|
---|
142 | data = c->data;
|
---|
143 | }
|
---|
144 |
|
---|
145 | QCursor::QCursor( int shape )
|
---|
146 | {
|
---|
147 | if ( !initialized )
|
---|
148 | initialize();
|
---|
149 | QCursor *c = find_cur( shape );
|
---|
150 | if ( !c ) // not found
|
---|
151 | c = (QCursor *)&arrowCursor; // then use arrowCursor
|
---|
152 | c->data->ref();
|
---|
153 | data = c->data;
|
---|
154 | }
|
---|
155 |
|
---|
156 |
|
---|
157 | void QCursor::setBitmap( const QBitmap &bitmap, const QBitmap &mask,
|
---|
158 | int hotX, int hotY )
|
---|
159 | {
|
---|
160 | if ( !initialized )
|
---|
161 | initialize();
|
---|
162 | if ( bitmap.depth() != 1 || mask.depth() != 1 ||
|
---|
163 | bitmap.size() != mask.size() ) {
|
---|
164 | #if defined(QT_CHECK_NULL)
|
---|
165 | qWarning( "QCursor: Cannot create bitmap cursor; invalid bitmap(s)" );
|
---|
166 | #endif
|
---|
167 | QCursor *c = (QCursor *)&arrowCursor;
|
---|
168 | c->data->ref();
|
---|
169 | data = c->data;
|
---|
170 | return;
|
---|
171 | }
|
---|
172 | data = new QCursorData;
|
---|
173 | Q_CHECK_PTR( data );
|
---|
174 | data->bm = new QBitmap( bitmap );
|
---|
175 | data->bmm = new QBitmap( mask );
|
---|
176 | data->hptr = 0;
|
---|
177 | data->cshape = BitmapCursor;
|
---|
178 | data->hx = hotX >= 0 ? hotX : bitmap.width()/2;
|
---|
179 | data->hy = hotY >= 0 ? hotY : bitmap.height()/2;
|
---|
180 | }
|
---|
181 |
|
---|
182 | QCursor::QCursor( const QCursor &c )
|
---|
183 | {
|
---|
184 | if ( !initialized )
|
---|
185 | initialize();
|
---|
186 | data = c.data;
|
---|
187 | data->ref();
|
---|
188 | }
|
---|
189 |
|
---|
190 | QCursor::~QCursor()
|
---|
191 | {
|
---|
192 | if ( data && data->deref() )
|
---|
193 | delete data;
|
---|
194 | }
|
---|
195 |
|
---|
196 |
|
---|
197 | QCursor &QCursor::operator=( const QCursor &c )
|
---|
198 | {
|
---|
199 | if ( !initialized )
|
---|
200 | initialize();
|
---|
201 | if ( !initialized )
|
---|
202 | initialize();
|
---|
203 | c.data->ref(); // avoid c = c
|
---|
204 | if ( data && data->deref() )
|
---|
205 | delete data;
|
---|
206 | data = c.data;
|
---|
207 | return *this;
|
---|
208 | }
|
---|
209 |
|
---|
210 |
|
---|
211 | int QCursor::shape() const
|
---|
212 | {
|
---|
213 | if ( !initialized )
|
---|
214 | initialize();
|
---|
215 | return data->cshape;
|
---|
216 | }
|
---|
217 |
|
---|
218 | void QCursor::setShape( int shape )
|
---|
219 | {
|
---|
220 | if ( !initialized )
|
---|
221 | initialize();
|
---|
222 | QCursor *c = find_cur( shape ); // find one of the global ones
|
---|
223 | if ( !c ) // not found
|
---|
224 | c = (QCursor *)&arrowCursor; // then use arrowCursor
|
---|
225 | c->data->ref();
|
---|
226 | if ( data->deref() ) // make shallow copy
|
---|
227 | delete data;
|
---|
228 | data = c->data;
|
---|
229 | }
|
---|
230 |
|
---|
231 |
|
---|
232 | const QBitmap *QCursor::bitmap() const
|
---|
233 | {
|
---|
234 | if ( !initialized )
|
---|
235 | initialize();
|
---|
236 | return data->bm;
|
---|
237 | }
|
---|
238 |
|
---|
239 | const QBitmap *QCursor::mask() const
|
---|
240 | {
|
---|
241 | if ( !initialized )
|
---|
242 | initialize();
|
---|
243 | return data->bmm;
|
---|
244 | }
|
---|
245 |
|
---|
246 | QPoint QCursor::hotSpot() const
|
---|
247 | {
|
---|
248 | if ( !initialized )
|
---|
249 | initialize();
|
---|
250 | return QPoint( data->hx, data->hy );
|
---|
251 | }
|
---|
252 |
|
---|
253 |
|
---|
254 | HPOINTER QCursor::handle() const
|
---|
255 | {
|
---|
256 | if ( !initialized )
|
---|
257 | initialize();
|
---|
258 | if ( !data->hptr && data->cshape != BlankCursor )
|
---|
259 | update();
|
---|
260 | return data->hptr;
|
---|
261 | }
|
---|
262 |
|
---|
263 | QCursor::QCursor( HPOINTER handle )
|
---|
264 | {
|
---|
265 | data = new QCursorData;
|
---|
266 | data->hptr = handle;
|
---|
267 | }
|
---|
268 |
|
---|
269 | QPoint QCursor::pos()
|
---|
270 | {
|
---|
271 | POINTL p;
|
---|
272 | WinQueryPointerPos( HWND_DESKTOP, &p);
|
---|
273 | // flip y coordinate
|
---|
274 | p.y = QApplication::desktop()->height() - (p.y + 1);
|
---|
275 | return QPoint( p.x, p.y );
|
---|
276 | }
|
---|
277 |
|
---|
278 | void QCursor::setPos( int x, int y )
|
---|
279 | {
|
---|
280 | WinSetPointerPos( HWND_DESKTOP, x, y);
|
---|
281 | }
|
---|
282 |
|
---|
283 |
|
---|
284 | void QCursor::update() const
|
---|
285 | {
|
---|
286 | if ( !initialized )
|
---|
287 | initialize();
|
---|
288 | if ( data->hptr ) // already loaded
|
---|
289 | return;
|
---|
290 | if ( data->cshape == BlankCursor ) // blank pointer = null handle
|
---|
291 | return;
|
---|
292 |
|
---|
293 | // Non-standard OS/2 cursors are created from bitmaps
|
---|
294 |
|
---|
295 | static const uchar vsplit_bits[] = {
|
---|
296 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
---|
297 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
---|
298 | 0x00, 0x80, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00,
|
---|
299 | 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
|
---|
300 | 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x00,
|
---|
301 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x00,
|
---|
302 | 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
|
---|
303 | 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00,
|
---|
304 | 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
---|
305 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
---|
306 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
---|
307 | static const uchar vsplitm_bits[] = {
|
---|
308 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
---|
309 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
|
---|
310 | 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xf0, 0x07, 0x00,
|
---|
311 | 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00,
|
---|
312 | 0x00, 0xc0, 0x01, 0x00, 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00,
|
---|
313 | 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00,
|
---|
314 | 0x80, 0xff, 0xff, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00,
|
---|
315 | 0x00, 0xc0, 0x01, 0x00, 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xf0, 0x07, 0x00,
|
---|
316 | 0x00, 0xe0, 0x03, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00,
|
---|
317 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
---|
318 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
---|
319 | static const uchar hsplit_bits[] = {
|
---|
320 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
---|
321 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
---|
322 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00,
|
---|
323 | 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00,
|
---|
324 | 0x00, 0x41, 0x82, 0x00, 0x80, 0x41, 0x82, 0x01, 0xc0, 0x7f, 0xfe, 0x03,
|
---|
325 | 0x80, 0x41, 0x82, 0x01, 0x00, 0x41, 0x82, 0x00, 0x00, 0x40, 0x02, 0x00,
|
---|
326 | 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00,
|
---|
327 | 0x00, 0x40, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
---|
328 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
---|
329 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
---|
330 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
---|
331 | static const uchar hsplitm_bits[] = {
|
---|
332 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
---|
333 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
---|
334 | 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00,
|
---|
335 | 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe2, 0x47, 0x00, 0x00, 0xe3, 0xc7, 0x00,
|
---|
336 | 0x80, 0xe3, 0xc7, 0x01, 0xc0, 0xff, 0xff, 0x03, 0xe0, 0xff, 0xff, 0x07,
|
---|
337 | 0xc0, 0xff, 0xff, 0x03, 0x80, 0xe3, 0xc7, 0x01, 0x00, 0xe3, 0xc7, 0x00,
|
---|
338 | 0x00, 0xe2, 0x47, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00,
|
---|
339 | 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
|
---|
340 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
---|
341 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
---|
342 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
---|
343 | static const uchar phand_bits[] = {
|
---|
344 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00,
|
---|
345 | 0x80, 0x04, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00,
|
---|
346 | 0x80, 0x1c, 0x00, 0x00, 0x80, 0xe4, 0x00, 0x00, 0x80, 0x24, 0x03, 0x00,
|
---|
347 | 0x80, 0x24, 0x05, 0x00, 0xb8, 0x24, 0x09, 0x00, 0xc8, 0x00, 0x09, 0x00,
|
---|
348 | 0x88, 0x00, 0x08, 0x00, 0x90, 0x00, 0x08, 0x00, 0xa0, 0x00, 0x08, 0x00,
|
---|
349 | 0x20, 0x00, 0x08, 0x00, 0x40, 0x00, 0x08, 0x00, 0x40, 0x00, 0x04, 0x00,
|
---|
350 | 0x80, 0x00, 0x04, 0x00, 0x80, 0x00, 0x04, 0x00, 0x00, 0x01, 0x02, 0x00,
|
---|
351 | 0x00, 0x01, 0x02, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
|
---|
352 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
---|
353 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
---|
354 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
---|
355 | static const uchar phandm_bits[] = {
|
---|
356 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00,
|
---|
357 | 0x80, 0x07, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00,
|
---|
358 | 0x80, 0x1f, 0x00, 0x00, 0x80, 0xff, 0x00, 0x00, 0x80, 0xff, 0x03, 0x00,
|
---|
359 | 0x80, 0xff, 0x07, 0x00, 0xb8, 0xff, 0x0f, 0x00, 0xf8, 0xff, 0x0f, 0x00,
|
---|
360 | 0xf8, 0xff, 0x0f, 0x00, 0xf0, 0xff, 0x0f, 0x00, 0xe0, 0xff, 0x0f, 0x00,
|
---|
361 | 0xe0, 0xff, 0x0f, 0x00, 0xc0, 0xff, 0x0f, 0x00, 0xc0, 0xff, 0x07, 0x00,
|
---|
362 | 0x80, 0xff, 0x07, 0x00, 0x80, 0xff, 0x07, 0x00, 0x00, 0xff, 0x03, 0x00,
|
---|
363 | 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
|
---|
364 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
---|
365 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
---|
366 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
---|
367 | static const uchar whatsthis_bits[] = {
|
---|
368 | 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0xf0, 0x07, 0x00,
|
---|
369 | 0x09, 0x18, 0x0e, 0x00, 0x11, 0x1c, 0x0e, 0x00, 0x21, 0x1c, 0x0e, 0x00,
|
---|
370 | 0x41, 0x1c, 0x0e, 0x00, 0x81, 0x1c, 0x0e, 0x00, 0x01, 0x01, 0x07, 0x00,
|
---|
371 | 0x01, 0x82, 0x03, 0x00, 0xc1, 0xc7, 0x01, 0x00, 0x49, 0xc0, 0x01, 0x00,
|
---|
372 | 0x95, 0xc0, 0x01, 0x00, 0x93, 0xc0, 0x01, 0x00, 0x21, 0x01, 0x00, 0x00,
|
---|
373 | 0x20, 0xc1, 0x01, 0x00, 0x40, 0xc2, 0x01, 0x00, 0x40, 0x02, 0x00, 0x00,
|
---|
374 | 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
---|
375 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
---|
376 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
---|
377 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
---|
378 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
---|
379 | static const uchar whatsthism_bits[] = {
|
---|
380 | 0x01, 0x00, 0x00, 0x00, 0x03, 0xf0, 0x07, 0x00, 0x07, 0xf8, 0x0f, 0x00,
|
---|
381 | 0x0f, 0xfc, 0x1f, 0x00, 0x1f, 0x3e, 0x1f, 0x00, 0x3f, 0x3e, 0x1f, 0x00,
|
---|
382 | 0x7f, 0x3e, 0x1f, 0x00, 0xff, 0x3e, 0x1f, 0x00, 0xff, 0x9d, 0x0f, 0x00,
|
---|
383 | 0xff, 0xc3, 0x07, 0x00, 0xff, 0xe7, 0x03, 0x00, 0x7f, 0xe0, 0x03, 0x00,
|
---|
384 | 0xf7, 0xe0, 0x03, 0x00, 0xf3, 0xe0, 0x03, 0x00, 0xe1, 0xe1, 0x03, 0x00,
|
---|
385 | 0xe0, 0xe1, 0x03, 0x00, 0xc0, 0xe3, 0x03, 0x00, 0xc0, 0xe3, 0x03, 0x00,
|
---|
386 | 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
---|
387 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
---|
388 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
---|
389 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
---|
390 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
---|
391 | // static const uchar busy_bits[] = {
|
---|
392 | // 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
|
---|
393 | // 0x09, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00,
|
---|
394 | // 0x41, 0xe0, 0xff, 0x00, 0x81, 0x20, 0x80, 0x00, 0x01, 0xe1, 0xff, 0x00,
|
---|
395 | // 0x01, 0x42, 0x40, 0x00, 0xc1, 0x47, 0x40, 0x00, 0x49, 0x40, 0x55, 0x00,
|
---|
396 | // 0x95, 0x80, 0x2a, 0x00, 0x93, 0x00, 0x15, 0x00, 0x21, 0x01, 0x0a, 0x00,
|
---|
397 | // 0x20, 0x01, 0x11, 0x00, 0x40, 0x82, 0x20, 0x00, 0x40, 0x42, 0x44, 0x00,
|
---|
398 | // 0x80, 0x41, 0x4a, 0x00, 0x00, 0x40, 0x55, 0x00, 0x00, 0xe0, 0xff, 0x00,
|
---|
399 | // 0x00, 0x20, 0x80, 0x00, 0x00, 0xe0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
|
---|
400 | // 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
---|
401 | // 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
---|
402 | // 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
---|
403 | // static const uchar busym_bits[] = {
|
---|
404 | // 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
|
---|
405 | // 0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00,
|
---|
406 | // 0x7f, 0xe0, 0xff, 0x00, 0xff, 0xe0, 0xff, 0x00, 0xff, 0xe1, 0xff, 0x00,
|
---|
407 | // 0xff, 0xc3, 0x7f, 0x00, 0xff, 0xc7, 0x7f, 0x00, 0x7f, 0xc0, 0x7f, 0x00,
|
---|
408 | // 0xf7, 0x80, 0x3f, 0x00, 0xf3, 0x00, 0x1f, 0x00, 0xe1, 0x01, 0x0e, 0x00,
|
---|
409 | // 0xe0, 0x01, 0x1f, 0x00, 0xc0, 0x83, 0x3f, 0x00, 0xc0, 0xc3, 0x7f, 0x00,
|
---|
410 | // 0x80, 0xc1, 0x7f, 0x00, 0x00, 0xc0, 0x7f, 0x00, 0x00, 0xe0, 0xff, 0x00,
|
---|
411 | // 0x00, 0xe0, 0xff, 0x00, 0x00, 0xe0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
|
---|
412 | // 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
---|
413 | // 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
---|
414 | // 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
---|
415 | static const uchar uparrow_bits[] = {
|
---|
416 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
---|
417 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
---|
418 | 0xFF, 0xFF, 0xFF, 0x7F, 0xFF, 0xFF, 0xFF, 0xBF, 0xFE, 0xFF, 0xFF,
|
---|
419 | 0xDF, 0xFD, 0xFF, 0xFF, 0xEF, 0xFB, 0xFF, 0xFF, 0xF7, 0xF7, 0xFF,
|
---|
420 | 0xFF, 0x87, 0xF0, 0xFF, 0xFF, 0xBF, 0xFE, 0xFF, 0xFF, 0xBF, 0xFE,
|
---|
421 | 0xFF, 0xFF, 0xBF, 0xFE, 0xFF, 0xFF, 0xBF, 0xFE, 0xFF, 0xFF, 0xBF,
|
---|
422 | 0xFE, 0xFF, 0xFF, 0xBF, 0xFE, 0xFF, 0xFF, 0xBF, 0xFE, 0xFF, 0xFF,
|
---|
423 | 0xBF, 0xFE, 0xFF, 0xFF, 0xBF, 0xFE, 0xFF, 0xFF, 0xBF, 0xFE, 0xFF,
|
---|
424 | 0xFF, 0xBF, 0xFE, 0xFF, 0xFF, 0xBF, 0xFE, 0xFF, 0xFF, 0x3F, 0xFE,
|
---|
425 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
---|
426 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
---|
427 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
|
---|
428 | static const uchar uparrowm_bits[] = {
|
---|
429 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
---|
430 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
---|
431 | 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00,
|
---|
432 | 0xE0, 0x03, 0x00, 0x00, 0xF0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00,
|
---|
433 | 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0xC0, 0x01,
|
---|
434 | 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0xC0,
|
---|
435 | 0x01, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00,
|
---|
436 | 0xC0, 0x01, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0xC0, 0x01, 0x00,
|
---|
437 | 0x00, 0xC0, 0x01, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0xC0, 0x01,
|
---|
438 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
---|
439 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
---|
440 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
---|
441 |
|
---|
442 | static const uchar cross_bits_os2[] = {
|
---|
443 | // AND mask (XBitmap, flipped top to bottom)
|
---|
444 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
---|
445 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
---|
446 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
---|
447 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
---|
448 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
---|
449 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
---|
450 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
---|
451 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
---|
452 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
---|
453 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
---|
454 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
---|
455 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
---|
456 | // XOR mask (XBitmap, flipped top to bottom)
|
---|
457 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
---|
458 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
---|
459 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
|
---|
460 | 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00,
|
---|
461 | 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
|
---|
462 | 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x80, 0xFF,
|
---|
463 | 0xFF, 0x03, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
|
---|
464 | 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00,
|
---|
465 | 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
|
---|
466 | 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
---|
467 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
---|
468 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
---|
469 |
|
---|
470 | LONG id = 0;
|
---|
471 | const uchar *bits = 0;
|
---|
472 | const uchar *mask = 0;
|
---|
473 | BOOL isbitmap = FALSE;
|
---|
474 |
|
---|
475 | switch ( data->cshape ) { // map to OS/2 cursor
|
---|
476 | case ArrowCursor:
|
---|
477 | id = SPTR_ARROW;
|
---|
478 | break;
|
---|
479 | case WaitCursor:
|
---|
480 | id = SPTR_WAIT;
|
---|
481 | break;
|
---|
482 | case IbeamCursor:
|
---|
483 | id = SPTR_TEXT;
|
---|
484 | break;
|
---|
485 | case SizeVerCursor:
|
---|
486 | id = SPTR_SIZENS;
|
---|
487 | break;
|
---|
488 | case SizeHorCursor:
|
---|
489 | id = SPTR_SIZEWE;
|
---|
490 | break;
|
---|
491 | case SizeBDiagCursor:
|
---|
492 | id = SPTR_SIZENESW;
|
---|
493 | break;
|
---|
494 | case SizeFDiagCursor:
|
---|
495 | id = SPTR_SIZENWSE;
|
---|
496 | break;
|
---|
497 | case SizeAllCursor:
|
---|
498 | id = SPTR_MOVE;
|
---|
499 | break;
|
---|
500 | case ForbiddenCursor:
|
---|
501 | id = SPTR_ILLEGAL;
|
---|
502 | break;
|
---|
503 | case WhatsThisCursor:
|
---|
504 | bits = whatsthis_bits;
|
---|
505 | mask = whatsthism_bits;
|
---|
506 | data->hx = data->hy = 0;
|
---|
507 | break;
|
---|
508 | // case BusyCursor:
|
---|
509 | // bits = busy_bits;
|
---|
510 | // mask = busym_bits;
|
---|
511 | // data->hx = data->hy = 0;
|
---|
512 | // break;
|
---|
513 | case PointingHandCursor:
|
---|
514 | bits = phand_bits;
|
---|
515 | mask = phandm_bits;
|
---|
516 | data->hx = 7;
|
---|
517 | data->hy = 0;
|
---|
518 | break;
|
---|
519 | case SplitVCursor:
|
---|
520 | bits = vsplit_bits;
|
---|
521 | mask = vsplitm_bits;
|
---|
522 | data->hx = data->hy = 16;
|
---|
523 | break;
|
---|
524 | case SplitHCursor:
|
---|
525 | bits = hsplit_bits;
|
---|
526 | mask = hsplitm_bits;
|
---|
527 | data->hx = data->hy = 16;
|
---|
528 | break;
|
---|
529 | case UpArrowCursor:
|
---|
530 | bits = uparrow_bits;
|
---|
531 | mask = uparrowm_bits;
|
---|
532 | data->hx = 15;
|
---|
533 | data->hy = 6;
|
---|
534 | break;
|
---|
535 | case BitmapCursor:
|
---|
536 | isbitmap = TRUE;
|
---|
537 | break;
|
---|
538 | case CrossCursor: {
|
---|
539 | QBitmap ptr( 32, 64, cross_bits_os2, TRUE );
|
---|
540 | GpiSetBitmap( ptr.handle(), 0 );
|
---|
541 | data->hx = data->hy = 16;
|
---|
542 | data->hptr = WinCreatePointer(
|
---|
543 | HWND_DESKTOP, ptr.hbm(), TRUE, data->hx, 31 - data->hy
|
---|
544 | );
|
---|
545 | return;
|
---|
546 | }
|
---|
547 | case BusyCursor: {
|
---|
548 | // we create a busy cursor below as a combination of the standard
|
---|
549 | // arrow and wait cursors
|
---|
550 | POINTERINFO piarrow, piwait;
|
---|
551 | HPOINTER harrow = WinQuerySysPointer( HWND_DESKTOP, SPTR_ARROW, FALSE );
|
---|
552 | WinQueryPointerInfo( harrow, &piarrow );
|
---|
553 | HPOINTER hwait = WinQuerySysPointer( HWND_DESKTOP, SPTR_WAIT, FALSE );
|
---|
554 | WinQueryPointerInfo( hwait, &piwait );
|
---|
555 | if ( piarrow.hbmColor ) {
|
---|
556 | QPixmap ptr( 32, 32 );
|
---|
557 | HPS hpsPtr = ptr.handle();
|
---|
558 | QPixmap tmp( 32, 32 );
|
---|
559 | HPS hpsTmp = tmp.handle();
|
---|
560 | QBitmap mask( 32, 64, TRUE );
|
---|
561 | HPS hpsMask = mask.handle();
|
---|
562 | // copy the overlying pointer
|
---|
563 | POINTL ptls[] = { { 0, 0 }, { 31, 31 }, { 0, 0 }, { 32, 32 } };
|
---|
564 | GpiWCBitBlt( hpsTmp, piarrow.hbmColor, 4, ptls, ROP_SRCCOPY, BBO_IGNORE );
|
---|
565 | // make its transparent pixels black
|
---|
566 | ptls[2].y += 32; ptls[3].y += 32;
|
---|
567 | GpiSetColor( hpsTmp, CLR_TRUE );
|
---|
568 | GpiSetBackColor( hpsTmp, CLR_FALSE );
|
---|
569 | GpiWCBitBlt( hpsTmp, piarrow.hbmPointer, 4, ptls, 0x22, BBO_IGNORE );
|
---|
570 | // copy the underlying pointer
|
---|
571 | ptls[2].y -= 32; ptls[3].y -= 32;
|
---|
572 | GpiWCBitBlt( hpsPtr, piwait.hbmColor, 4, ptls, ROP_SRCCOPY, BBO_IGNORE );
|
---|
573 | // make non-transparent pixels from the overlying pointer black
|
---|
574 | ptls[2].y += 32; ptls[3].y += 32;
|
---|
575 | GpiSetColor( hpsPtr, CLR_TRUE );
|
---|
576 | GpiSetBackColor( hpsPtr, CLR_FALSE );
|
---|
577 | GpiWCBitBlt( hpsPtr, piarrow.hbmPointer, 4, ptls, ROP_SRCAND, BBO_IGNORE );
|
---|
578 | // put the overlying pointer there
|
---|
579 | ptls[2].y -= 32; ptls[3].y -= 32;
|
---|
580 | ptls[1].x ++; ptls[1].y ++;
|
---|
581 | GpiBitBlt( hpsPtr, hpsTmp, 4, ptls, ROP_SRCPAINT, BBO_IGNORE );
|
---|
582 | // copy both underlying pointer's masks
|
---|
583 | ptls[1].x --; ptls[1].y --;
|
---|
584 | ptls[1].y += 32; ptls[3].y += 32;
|
---|
585 | GpiWCBitBlt( hpsMask, piwait.hbmPointer, 4, ptls, ROP_SRCCOPY, BBO_IGNORE );
|
---|
586 | // add overlying pointer's XOR mask
|
---|
587 | ptls[1].y -= 32; ptls[3].y -= 32;
|
---|
588 | GpiWCBitBlt( hpsMask, piarrow.hbmPointer, 4, ptls, ROP_SRCPAINT, BBO_IGNORE );
|
---|
589 | // add overlying pointer's AND mask
|
---|
590 | ptls[0].y += 32; ptls[2].y += 32;
|
---|
591 | ptls[1].y += 32; ptls[3].y += 32;
|
---|
592 | GpiWCBitBlt( hpsMask, piarrow.hbmPointer, 4, ptls, ROP_SRCAND, BBO_IGNORE );
|
---|
593 | // create the new pointer
|
---|
594 | GpiSetBitmap( hpsPtr, 0 );
|
---|
595 | GpiSetBitmap( hpsMask, 0 );
|
---|
596 | piarrow.hbmColor = ptr.hbm();
|
---|
597 | piarrow.hbmPointer = mask.hbm();
|
---|
598 | piarrow.hbmMiniColor = 0;
|
---|
599 | piarrow.hbmMiniPointer = 0;
|
---|
600 | data->hptr = WinCreatePointerIndirect( HWND_DESKTOP, &piarrow );
|
---|
601 | } else {
|
---|
602 | QBitmap ptr( 32, 64, TRUE );
|
---|
603 | HPS hps = ptr.handle();
|
---|
604 | POINTL ptls[] = { { 0, 0 }, { 31, 63 }, { 0, 0 }, { 32, 64 } };
|
---|
605 | // make a copy of the underlying pointer
|
---|
606 | GpiWCBitBlt( hps, piwait.hbmPointer, 4, ptls, ROP_SRCCOPY, BBO_IGNORE );
|
---|
607 | // combine AND masks
|
---|
608 | ptls[0].y += 32; ptls[2].y += 32;
|
---|
609 | GpiWCBitBlt( hps, piarrow.hbmPointer, 4, ptls, ROP_SRCAND, BBO_IGNORE );
|
---|
610 | // apply the overlying AND mask to the underlying XOR mask
|
---|
611 | ptls[0].y -= 32; ptls[1].y -= 32;
|
---|
612 | GpiWCBitBlt( hps, piarrow.hbmPointer, 4, ptls, ROP_SRCAND, BBO_IGNORE );
|
---|
613 | // apply the overlying XOR mask to the underlying XOR mask
|
---|
614 | ptls[2].y -= 32; ptls[3].y -= 32;
|
---|
615 | GpiWCBitBlt( hps, piarrow.hbmPointer, 4, ptls, ROP_SRCINVERT, BBO_IGNORE );
|
---|
616 | // create the new pointer
|
---|
617 | GpiSetBitmap( hps, 0 );
|
---|
618 | data->hptr = WinCreatePointer(
|
---|
619 | HWND_DESKTOP, ptr.hbm(), TRUE, piarrow.xHotspot, piarrow.yHotspot
|
---|
620 | );
|
---|
621 | }
|
---|
622 | data->hx = piarrow.xHotspot;
|
---|
623 | data->hy = 31 - piarrow.yHotspot;
|
---|
624 | return;
|
---|
625 | }
|
---|
626 | default:
|
---|
627 | #if defined(QT_CHECK_RANGE)
|
---|
628 | qWarning( "QCursor::update: Invalid cursor shape %d",
|
---|
629 | data->cshape );
|
---|
630 | #endif
|
---|
631 | return;
|
---|
632 | }
|
---|
633 |
|
---|
634 | if ( (bits && mask) || isbitmap ) {
|
---|
635 | QBitmap bm = isbitmap ? *data->bm : QBitmap( 32, 32, bits, TRUE );
|
---|
636 | QBitmap bmm = isbitmap ? *data->bmm : QBitmap( 32, 32, mask, TRUE );
|
---|
637 | QBitmap ptr( 32, 64, TRUE );
|
---|
638 | // prepare XOR mask
|
---|
639 | bitBlt( &ptr, 0, 32, &bm, 0, 0, -1, -1, NotCopyROP, TRUE );
|
---|
640 | // crop XOR mask
|
---|
641 | bitBlt( &ptr, 0, 32, &bmm, 0, 0, -1, -1, AndROP, TRUE );
|
---|
642 | // set AND mask
|
---|
643 | bitBlt( &ptr, 0, 0, &bmm, 0, 0, -1, -1, NotCopyROP, TRUE );
|
---|
644 | GpiSetBitmap( ptr.handle(), 0 );
|
---|
645 | data->hptr = WinCreatePointer(
|
---|
646 | HWND_DESKTOP, ptr.hbm(), TRUE, data->hx, 31 - data->hy
|
---|
647 | );
|
---|
648 | } else {
|
---|
649 | data->hptr = WinQuerySysPointer( HWND_DESKTOP, id, FALSE );
|
---|
650 | data->is_sysptr = true;
|
---|
651 | }
|
---|
652 | }
|
---|