- Timestamp:
- Aug 13, 2009, 9:16:52 PM (16 years ago)
- Location:
- trunk/src/gui/kernel
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gui/kernel/qcursor_p.h
r108 r111 94 94 HCURSOR hcurs; 95 95 #elif defined (Q_WS_PM) 96 HPOINTER hcurs; 96 HPOINTER hptr; 97 bool isSysPtr; 97 98 #elif defined (Q_WS_X11) 98 99 XColor fg, bg; -
trunk/src/gui/kernel/qcursor_pm.cpp
r108 r111 49 49 50 50 #include <qimage.h> 51 #include <qapplication.h> 52 #include <qdesktopwidget.h> 51 53 #include <qt_os2.h> 52 54 … … 60 62 61 63 QCursorData::QCursorData(Qt::CursorShape s) 62 : cshape(s), bm(0), bmm(0), hx(0), hy(0), h curs(NULLHANDLE)64 : cshape(s), bm(0), bmm(0), hx(0), hy(0), hptr(NULLHANDLE), isSysPtr(false) 63 65 { 64 66 ref = 1; … … 69 71 delete bm; 70 72 delete bmm; 71 // @todo 72 // if (hcurs) 73 // delete it... 73 if (hptr && !isSysPtr) 74 WinDestroyPointer(hptr); 74 75 } 75 76 … … 77 78 QCursorData *QCursorData::setBitmap(const QBitmap &bitmap, const QBitmap &mask, int hotX, int hotY) 78 79 { 79 // @todo implement 80 return 0; 80 if (!QCursorData::initialized) 81 QCursorData::initialize(); 82 if (bitmap.depth() != 1 || mask.depth() != 1 || bitmap.size() != mask.size()) { 83 qWarning("QCursor: Cannot create bitmap cursor; invalid bitmap(s)"); 84 QCursorData *c = qt_cursorTable[0]; 85 c->ref.ref(); 86 return c; 87 } 88 QCursorData *d = new QCursorData; 89 d->bm = new QBitmap(bitmap); 90 d->bmm = new QBitmap(mask); 91 d->hptr = NULLHANDLE; 92 d->cshape = Qt::BitmapCursor; 93 d->hx = hotX >= 0 ? hotX : bitmap.width()/2; 94 d->hy = hotY >= 0 ? hotY : bitmap.height()/2; 95 return d; 81 96 } 82 97 … … 85 100 if (!QCursorData::initialized) 86 101 QCursorData::initialize(); 87 if ( !d->hcurs)102 if (d->hptr == NULLHANDLE) 88 103 d->update(); 89 return d->h curs;104 return d->hptr; 90 105 } 91 106 … … 93 108 { 94 109 d = new QCursorData(Qt::CustomCursor); 95 d->h curs= handle;110 d->hptr = handle; 96 111 } 97 112 … … 100 115 QPoint QCursor::pos() 101 116 { 102 // @todo implement 103 return QPoint(); 117 POINTL p; 118 WinQueryPointerPos(HWND_DESKTOP, &p); 119 // flip y coordinate 120 p.y = QApplication::desktop()->height() - (p.y + 1); 121 return QPoint(p.x, p.y); 104 122 } 105 123 106 124 void QCursor::setPos(int x, int y) 107 125 { 108 // @todo implement 126 // flip y coordinate 127 y = QApplication::desktop()->height() - (y + 1); 128 WinSetPointerPos(HWND_DESKTOP, x, y); 109 129 } 110 130 … … 115 135 if (!QCursorData::initialized) 116 136 QCursorData::initialize(); 117 // @todo implement137 // @todo we depend on QPixmap vs HBITMAP integration here 118 138 } 119 139 140 #endif // QT_NO_CURSOR 141 120 142 QT_END_NAMESPACE 121 #endif // QT_NO_CURSOR
Note:
See TracChangeset
for help on using the changeset viewer.