56 #include "private/qbackingstore_p.h" 57 #include "private/qwindowsurface_raster_p.h" 61 #include <private/qabstractscrollarea_p.h> 65 #include <private/qapplication_p.h> 66 #include <private/qwininputcontext_p.h> 67 #include <private/qpaintengine_raster_p.h> 68 #include <private/qsystemlibrary_p.h> 70 #if defined(Q_WS_WINCE) 83 #ifndef QT_NO_DIRECTDRAW 85 #include <private/qimage_p.h> 92 #if defined(QT_NON_COMMERCIAL) 96 #if !defined(WS_EX_TOOLWINDOW) 97 #define WS_EX_TOOLWINDOW 0x00000080 100 #if !defined(GWLP_WNDPROC) 101 #define GWLP_WNDPROC GWL_WNDPROC 105 #define PACKETDATA (PK_X | PK_Y | PK_BUTTONS | PK_NORMAL_PRESSURE | PK_TANGENT_PRESSURE \ 106 | PK_ORIENTATION | PK_CURSOR | PK_Z) 128 #ifndef QT_NO_TABLETEVENT 132 #endif // QT_NO_TABLETEVENT 144 #ifndef QT_NO_TABLETEVENT 147 #if defined(Q_OS_WINCE) 163 static bool firstTime =
true;
167 qt_tablet_widget =
new QWidget(0);
175 struct tagAXIS tpOri[3];
181 qWarning(
"QWidget: Wintab services not available");
195 lcMine.lcOptions |= CXO_MESSAGES | CXO_CSRMESSAGES;
199 lcMine.lcOutOrgX = 0;
200 lcMine.lcOutExtX = lcMine.lcInExtX;
201 lcMine.lcOutOrgY = 0;
202 lcMine.lcOutExtY = -lcMine.lcInExtY;
209 qWarning(
"QWidget: Failed to open the tablet");
222 Q_ASSERT_X(0,
"Qt::Internal",
"There is no packet queue for" 223 " the tablet. The tablet will not work");
234 qt_tablet_widget = 0;
236 #endif // QT_NO_TABLETEVENT 240 #ifndef QT_NO_DRAGANDDROP 255 #define XCOORD_MAX 16383 256 #define WRECT_MAX 16383 266 static int sw = -1, sh = -1;
280 HWND parentw, destroyw = 0;
286 initializeWindow =
true;
292 sw = GetSystemMetrics(SM_CXSCREEN);
293 sh = GetSystemMetrics(SM_CYSCREEN);
299 GetSystemMetrics(78 ), GetSystemMetrics(79 ));
302 parentw = q->parentWidget() ? q->parentWidget()->effectiveWinId() : 0;
305 int style = WS_CHILD;
309 style = GetWindowLong(window, GWL_STYLE);
315 }
else if (topLevel && !desktop) {
319 style = WS_OVERLAPPED;
327 #ifndef Q_FLATTEN_EXPOSE 328 style |= WS_CLIPSIBLINGS | WS_CLIPCHILDREN ;
337 style |= WS_DLGFRAME;
344 style |= WS_MINIMIZEBOX;
345 if (shouldShowMaximizeButton())
346 style |= WS_MAXIMIZEBOX;
350 exsty |= WS_EX_CONTEXTHELP;
358 title = q->isWindow() ?
qAppName() : q->objectName();
367 if (destroyOldWindow)
371 LONG res = SetWindowLong(window, GWL_STYLE, style);
373 qErrnoWarning(
"QWidget::create: Failed to set window style");
377 res = SetWindowLong( window, GWL_WNDPROC, (LONG)QtWndProc );
380 qErrnoWarning(
"QWidget::create: Failed to set window procedure");
381 }
else if (desktop) {
382 id = GetDesktopWindow();
391 }
else if (topLevel) {
398 int w = CW_USEDEFAULT;
399 int h = CW_USEDEFAULT;
402 RECT rect = {0,0,0,0};
404 if (isVisibleOnScreen && AdjustWindowRectEx(&rect, style & ~WS_OVERLAPPED,
FALSE, exsty)) {
417 if (isVisibleOnScreen && topLevel && initializeWindow && (style & WS_POPUP)) {
422 int dx = rect.right - rect.left;
423 int dy = rect.bottom - rect.top;
431 x =
qMax(sw/2 - w/2, 0);
432 y =
qMax(sh/2 - h/2, 0);
436 id = CreateWindowEx(exsty, reinterpret_cast<const wchar_t *>(windowClassName.
utf16()),
437 reinterpret_cast<const wchar_t *>(title.
utf16()), style,
439 parentw, NULL, appinst, NULL);
444 SetWindowPos(
id,
HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
446 qWarning() <<
"QWidget: Incompatible window flags: the window can't be on top and on bottom at the same time";
448 SetWindowPos(
id, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
451 id = CreateWindowEx(exsty, reinterpret_cast<const wchar_t *>(windowClassName.
utf16()),
452 reinterpret_cast<const wchar_t *>(title.
utf16()), style,
454 parentw, NULL, appinst, NULL);
457 SetWindowPos(
id, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
465 GetClientRect(
id, &cr);
470 ClientToScreen(
id, &pt);
476 QPoint(pt.x + cr.right - 1, pt.y + cr.bottom - 1));
488 HMENU systemMenu = GetSystemMenu((HWND)q->internalWinId(),
FALSE);
490 EnableMenuItem(systemMenu, SC_CLOSE, MF_BYCOMMAND|MF_ENABLED);
492 EnableMenuItem(systemMenu, SC_CLOSE, MF_BYCOMMAND|MF_GRAYED);
500 registerTouchWindow();
503 if (IsWindowVisible(window))
512 #if defined(QT_NON_COMMERCIAL) 518 q->inputContext()->setFocusWidget(q);
522 DestroyWindow(destroyw);
525 #ifndef QT_NO_TABLETEVENT 528 #endif // QT_NO_TABLETEVENT 542 ShowWindow(q->internalWinId(), SW_SHOW);
554 parentWidget()->d_func()->invalidateBuffer(
d->effectiveRectFor(geometry()));
555 d->deactivateWidgetCleanup();
558 for(
int i = 0; i <
d->children.size(); ++i) {
559 register QObject *obj =
d->children.at(i);
561 ((
QWidget*)obj)->destroy(destroySubWindows,
564 if (mouseGrb ==
this)
566 if (keyboardGrb ==
this)
571 qApp->d_func()->closePopup(
this);
572 if (destroyWindow && !(windowType() ==
Qt::Desktop) && internalWinId()) {
573 DestroyWindow(internalWinId());
576 if (destroyWindow && (windowType() ==
Qt::Desktop) && !GetDesktopWindow()) {
577 DestroyWindow(internalWinId());
583 }
QT_CATCH (
const std::bad_alloc &) {
589 void QWidgetPrivate::reparentChildren()
593 for(
int i = 0; i < chlist.
size(); ++i) {
607 w->d_func()->invalidateBuffer(w->
rect());
609 w->d_func()->reparentChildren();
619 if (q->isVisible() && q->parentWidget() && parent != q->
parentWidget())
620 q->parentWidget()->d_func()->invalidateBuffer(
effectiveRectFor(q->geometry()));
629 bool dropSiteWasRegistered =
false;
631 dropSiteWasRegistered =
true;
636 if (
const QWExtra *
extra = nativeParent->d_func()->extra) {
662 if (q->isWindow() || (!parent || parent->
isVisible()) || explicitlyHidden)
680 #ifndef QT_NO_DRAGANDDROP 686 RevokeDragDrop(old_winid);
687 if (q->internalWinId())
690 #endif // !QT_NO_DRAGANDDROP 691 DestroyWindow(old_winid);
697 foreach (
QWidget *w, registeredDropChildren)
704 SetWindowText(q->internalWinId(), (
wchar_t*)txt.
utf16());
718 #ifndef QT_NO_GRAPHICSVIEW 720 #endif //QT_NO_GRAPHICSVIEW 723 QPoint pt = mapTo(parentWindow, pos);
724 POINT p = {pt.
x(), pt.
y()};
728 QPoint toGlobal = mapTo(parentWindow, pos) + parentWindow->
pos();
738 ClientToScreen(internalWinId(), &p);
749 #ifndef QT_NO_GRAPHICSVIEW 751 #endif //QT_NO_GRAPHICSVIEW 754 POINT p = {pos.
x(), pos.
y()};
756 return mapFrom(parentWindow,
QPoint(p.x, p.y));
758 QPoint fromGlobal = mapFrom(parentWindow, pos - parentWindow->
pos());
767 ScreenToClient(internalWinId(), &p);
768 return d->mapFromWS(
QPoint(p.x, p.y));
795 SetWindowText(q->internalWinId(), (
wchar_t*)caption.
utf16());
828 DestroyIcon(x->winIconBig);
831 if (x->winIconSmall) {
832 DestroyIcon(x->winIconSmall);
837 GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON),
840 GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON),
843 SendMessage(q->internalWinId(), WM_SETICON, 0 , (LPARAM)x->winIconSmall);
844 SendMessage(q->internalWinId(), WM_SETICON, 1 , (LPARAM)x->winIconBig);
846 SendMessage(q->internalWinId(), WM_SETICON, 0 , (LPARAM)x->winIconSmall);
847 SendMessage(q->internalWinId(), WM_SETICON, 1 , (LPARAM)x->winIconSmall);
867 return CallNextHookEx(
journalRec, nCode, wParam, lParam);
877 void QWidgetPrivate::grabMouseWhileInWindow()
884 SetCapture(q->effectiveWinId());
887 mouseGrbCur =
new QCursor(mouseGrb->cursor());
900 SetCapture(effectiveWinId());
916 SetCapture(effectiveWinId());
917 mouseGrbCur =
new QCursor(cursor);
918 SetCursor(mouseGrbCur->
handle());
970 SetForegroundWindow(
window()->internalWinId());
977 Qt::WindowStates
oldstate = windowState();
978 if (oldstate == newstate)
981 int max = SW_MAXIMIZE;
982 int min = SW_MINIMIZE;
984 int normal = SW_SHOWNOACTIVATE;
986 max = SW_SHOWMAXIMIZED;
988 normal = SW_SHOWNORMAL;
1001 d->topData()->normalGeometry = geometry();
1003 ShowWindow(internalWinId(), (newstate & Qt::WindowMaximized) ? max : normal);
1004 if (!(newstate & Qt::WindowFullScreen)) {
1005 QRect r =
d->topData()->normalGeometry;
1006 if (!(newstate & Qt::WindowMaximized) && r.
width() >= 0) {
1008 d->topData()->normalGeometry =
QRect(0,0,-1,-1);
1013 d->updateFrameStrut();
1019 if (newstate & Qt::WindowFullScreen) {
1021 d->topData()->normalGeometry = geometry();
1022 d->topData()->savedFlags = Qt::WindowFlags(GetWindowLong(internalWinId(), GWL_STYLE));
1023 #ifndef Q_FLATTEN_EXPOSE 1024 UINT style = WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_POPUP;
1026 UINT style = WS_POPUP;
1028 if (
ulong(
d->topData()->savedFlags) & WS_SYSMENU)
1029 style |= WS_SYSMENU;
1031 style |= WS_VISIBLE;
1032 SetWindowLong(internalWinId(), GWL_STYLE, style);
1034 UINT swpf = SWP_FRAMECHANGED;
1035 if (newstate & Qt::WindowActive)
1036 swpf |= SWP_NOACTIVATE;
1038 SetWindowPos(internalWinId(), HWND_TOP, r.
left(), r.
top(), r.
width(), r.
height(), swpf);
1039 d->updateFrameStrut();
1041 UINT style =
d->topData()->savedFlags;
1043 style |= WS_VISIBLE;
1044 SetWindowLong(internalWinId(), GWL_STYLE, style);
1046 UINT swpf = SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOSIZE | SWP_NOMOVE;
1047 if (newstate & Qt::WindowActive)
1048 swpf |= SWP_NOACTIVATE;
1049 SetWindowPos(internalWinId(), 0, 0, 0, 0, 0, swpf);
1050 d->updateFrameStrut();
1054 ShowWindow(internalWinId(), (newstate & Qt::WindowMaximized) ? max : normal);
1056 if (!(newstate & Qt::WindowMaximized)) {
1057 QRect r =
d->topData()->normalGeometry;
1058 d->topData()->normalGeometry =
QRect(0,0,-1,-1);
1068 (newstate & Qt::WindowMaximized) ? max : normal);
1090 HWND handle = FindWindow(L
"HHTaskBar", L
"");
1092 ShowWindow(handle, 1);
1093 EnableWindow(handle,
true);
1098 if ((q->windowFlags() &
Qt::Popup) && q->internalWinId())
1099 ShowWindow(q->internalWinId(), SW_HIDE);
1100 else if (q->internalWinId())
1101 SetWindowPos(q->internalWinId(),0, 0,0,0,0, SWP_HIDEWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER);
1103 if (q->isWindow()) {
1105 bs->releaseBuffer();
1121 #if defined(QT_NON_COMMERCIAL) 1136 if (!extra->hotkeyRegistered) {
1138 STARTUPINFO startupInfo;
1139 GetStartupInfo(&startupInfo);
1141 if (startupInfo.dwFlags & 0x00000200) {
1142 WPARAM hotKey = (WPARAM)startupInfo.hStdInput;
1143 SendMessage(
data.
winid, WM_SETHOTKEY, hotKey, 0);
1145 extra->hotkeyRegistered = 1;
1149 int sm = SW_SHOWNORMAL;
1150 bool fakedMaximize =
false;
1151 if (q->isWindow()) {
1152 if (q->isMinimized()) {
1154 if (!IsWindowVisible(q->internalWinId()))
1155 sm = SW_SHOWMINNOACTIVE;
1156 }
else if (q->isMaximized()) {
1157 sm = SW_SHOWMAXIMIZED;
1166 fakedMaximize =
TRUE;
1167 int style = GetWindowLong(q->internalWinId(), GWL_STYLE);
1168 SetWindowLong(q->internalWinId(), GWL_STYLE, style | WS_MAXIMIZEBOX);
1175 || (q->windowType() ==
Qt::Tool)) {
1176 sm = SW_SHOWNOACTIVATE;
1180 if (q->internalWinId())
1181 ShowWindow(q->internalWinId(), sm);
1183 if (fakedMaximize) {
1184 int style = GetWindowLong(q->internalWinId(), GWL_STYLE);
1185 SetWindowLong(q->internalWinId(), GWL_STYLE, style & ~WS_MAXIMIZEBOX);
1186 SetWindowPos(q->internalWinId(), 0, 0, 0, 0, 0,
1187 SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER
1188 | SWP_FRAMECHANGED);
1191 if (q->internalWinId()) {
1192 if (IsIconic(q->internalWinId()))
1194 if (IsZoomed(q->internalWinId()))
1199 !q->parentWidget() && !
qApp->activeWindow())
1200 q->activateWindow();
1213 SetFocus(q->effectiveWinId());
1220 if (q->internalWinId())
1221 SetWindowPos(q->internalWinId(), HWND_TOP, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
1228 if (q->internalWinId())
1229 SetWindowPos(q->internalWinId(), HWND_BOTTOM, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
1238 SetWindowPos(q->internalWinId(), w->
internalWinId() , 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
1253 void QWidgetPrivate::setWSGeometry(
bool dontShow,
const QRect &)
1276 if (!parentWRect.
contains(xrect)) {
1277 xrect &= parentWRect;
1299 if (q->internalWinId())
1300 MoveWindow(q->internalWinId(), xrect.
x(), xrect.
y(), xrect.
width(), xrect.
height(),
true);
1305 if (!validRange.contains(xrect)) {
1318 bool outsideRange = !xrect.
isValid();
1319 bool mapWindow =
false;
1323 if (q->internalWinId())
1324 ShowWindow(q->internalWinId(), SW_HIDE);
1326 }
else if (!q->isHidden()) {
1343 w->d_func()->setWSGeometry();
1350 if (q->internalWinId()) {
1353 MoveWindow(q->internalWinId(), xrect.
x(), xrect.
y(), xrect.
width(), xrect.
height(), !
jump);
1355 if (mapWindow && !dontShow) {
1357 if (q->internalWinId())
1358 ShowWindow(q->internalWinId(), SW_SHOWNOACTIVATE);
1361 if (jump && q->internalWinId())
1362 InvalidateRect(q->internalWinId(), 0,
false);
1386 QSize oldSize(q->size());
1391 bool isResize = w != oldSize.
width() || h != oldSize.height();
1393 if (!isMove && !isResize)
1397 ValidateRgn(q->internalWinId(), 0);
1402 if (isResize && q->isMaximized())
1412 if (q->isWindow()) {
1417 style |= WS_VISIBLE;
1418 SetWindowLong(q->internalWinId(), GWL_STYLE, style);
1420 UINT swpf = SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOSIZE | SWP_NOMOVE;
1422 swpf |= SWP_NOACTIVATE;
1423 SetWindowPos(q->internalWinId(), 0, 0, 0, 0, 0, swpf);
1430 QTLWExtra *tlwExtra = q->window()->d_func()->maybeTopData();
1431 const bool inTopLevelResize = tlwExtra ? tlwExtra->
inTopLevelResize :
false;
1436 if (q->internalWinId())
1443 }
else if (q->isWindow()) {
1451 if (w == 0 || h == 0) {
1460 MoveWindow(q->internalWinId(), fs.
x(), fs.
y(), fs.
width(), fs.
height(),
true);
1463 GetClientRect(q->internalWinId(), &rect);
1475 WINDOWPLACEMENT wndpl;
1476 GetWindowPlacement(q->internalWinId(), &wndpl);
1477 if ((wndpl.showCmd == SW_MAXIMIZE && !IsWindowVisible(q->internalWinId())) || wndpl.showCmd ==
SW_SHOWMINIMIZED) {
1478 RECT normal = {fs.
x(), fs.
y(), fs.
x()+fs.
width(), fs.
y()+fs.
height()};
1479 wndpl.rcNormalPosition = normal;
1481 SetWindowPlacement(q->internalWinId(), &wndpl);
1488 MoveWindow(q->internalWinId(), fs.
x(), fs.
y(), fs.
width(), fs.
height(),
true);
1490 if (!q->isVisible())
1491 InvalidateRect(q->internalWinId(), 0,
FALSE);
1496 if (isTranslucentWindow) {
1499 GetClientRect(q->internalWinId(), &rect);
1500 RECT rcNormalPosition ={0, 0, 0, 0};
1502 if (!tlwExtra || !tlwExtra->
embedded)
1503 GetWindowRect(q->internalWinId(), &rcNormalPosition);
1506 rcNormalPosition.top + fStrut.top(),
1507 rect.right - rect.left,
1508 rect.bottom - rect.top);
1518 if (q->isVisible() && (!inTopLevelResize || q->internalWinId())) {
1521 if (inTopLevelResize)
1525 moveRect(
QRect(oldPos, oldSize), x - oldPos.
x(), y - oldPos.y());
1529 if (inTopLevelResize)
1538 if (q->isWindow() && q->isVisible() && isResize && !inTopLevelResize) {
1544 if (q->isVisible()) {
1545 if (isMove && q->pos() != oldPos) {
1550 static bool slowResize =
qgetenv(
"QT_SLOW_TOPLEVEL_RESIZE").
toInt();
1555 const bool setTopLevelResize = !slowResize && q->isWindow() &&
extra &&
extra->
topextra 1559 if (setTopLevelResize)
1563 if (setTopLevelResize)
1567 if (isMove && q->pos() != oldPos)
1574 bool QWidgetPrivate::shouldShowMaximizeButton()
1591 void QWidgetPrivate::winUpdateIsOpaque()
1603 SetWindowLong(q->internalWinId(), GWL_EXSTYLE,
1606 SetWindowLong(q->internalWinId(), GWL_EXSTYLE,
1614 #ifndef Q_WS_WINCE_WM 1617 int style = GetWindowLong(q->internalWinId(), GWL_STYLE);
1618 if (shouldShowMaximizeButton())
1619 style |= WS_MAXIMIZEBOX;
1621 style &= ~WS_MAXIMIZEBOX;
1622 SetWindowLong(q->internalWinId(), GWL_STYLE, style);
1635 UINT flags = SW_INVALIDATE;
1639 ScrollWindowEx(q->internalWinId(), dx, dy, 0, 0, 0, 0, flags);
1640 UpdateWindow(q->internalWinId());
1654 wr.bottom = r.
bottom()+1;
1655 wr.right = r.
right()+1;
1657 UINT flags = SW_INVALIDATE;
1661 ScrollWindowEx(q->internalWinId(), dx, dy, &wr, &wr, 0, 0, flags);
1662 UpdateWindow(q->internalWinId());
1672 if (m == PdmWidth) {
1674 }
else if (m == PdmHeight) {
1681 case PdmPhysicalDpiX:
1682 if (
d->extra &&
d->extra->customDpiX)
1683 val =
d->extra->customDpiX;
1685 val =
static_cast<QWidget *
>(
d->parent)->metric(m);
1687 val = GetDeviceCaps(gdc, LOGPIXELSX);
1690 case PdmPhysicalDpiY:
1691 if (
d->extra &&
d->extra->customDpiY)
1692 val =
d->extra->customDpiY;
1694 val =
static_cast<QWidget *
>(
d->parent)->metric(m);
1696 val = GetDeviceCaps(gdc, LOGPIXELSY);
1700 * GetDeviceCaps(gdc, HORZSIZE)
1701 / GetDeviceCaps(gdc, HORZRES);
1705 * GetDeviceCaps(gdc, VERTSIZE)
1706 / GetDeviceCaps(gdc, VERTRES);
1709 if (GetDeviceCaps(gdc, RASTERCAPS) & RC_PALETTE)
1710 val = GetDeviceCaps(gdc, SIZEPALETTE);
1712 HDC
hd =
d->hd ? HDC(
d->hd) : gdc;
1713 int bpp = GetDeviceCaps(hd, BITSPIXEL);
1717 val = GetDeviceCaps(hd, NUMCOLORS);
1719 val = 1 << (bpp * GetDeviceCaps(hd, PLANES));
1723 val = GetDeviceCaps(gdc, BITSPIXEL);
1727 qWarning(
"QWidget::metric: Invalid metric command");
1737 #ifndef QT_NO_DRAGANDDROP 1773 #ifndef QT_NO_DRAGANDDROP 1774 if (!q->internalWinId())
1775 q->nativeParentWidget()->d_func()->createExtra();
1783 #ifndef QT_NO_DRAGANDDROP 1792 #ifndef QT_NO_DRAGANDDROP 1800 QWExtra *nativeExtra = nativeParent->d_func()->extra;
1805 nativeExtra->
dropTarget = registerOleDnd(nativeParent);
1808 CoLockObjectExternal(nativeExtra->
dropTarget,
false,
true);
1815 CoLockObjectExternal(dropTarget,
true,
true);
1826 dropTarget->Release();
1828 while (nativeParent) {
1829 QWExtra *nativeExtra = nativeParent->d_func()->extra;
1840 CoLockObjectExternal(nativeExtra->
dropTarget,
false,
true);
1855 CoLockObjectExternal(dropTarget,
false,
true);
1858 dropTarget->Release();
1863 #endif //QT_NO_DRAGANDDROP 1870 if (!q->internalWinId())
1874 SetWindowRgn(q->internalWinId(), 0,
true);
1881 CombineRgn(wr, region.
handle(), 0, RGN_COPY);
1883 QPoint offset = (q->isWindow()
1886 OffsetRgn(wr, offset.x(), offset.y());
1889 if (!SetWindowRgn(
data.
winid, wr,
true))
1900 if (!q->internalWinId()) {
1905 RECT rect = {0,0,0,0};
1908 uint exstyle = GetWindowLong(q->internalWinId(), GWL_EXSTYLE);
1909 uint style = GetWindowLong(q->internalWinId(), GWL_STYLE);
1911 if (AdjustWindowRectEx(&rect, style & ~(WS_OVERLAPPED),
FALSE, exstyle)) {
1913 if (AdjustWindowRectEx(&rect, style,
FALSE, exstyle)) {
1926 if (GetWindowLong(q->internalWinId(), GWL_EXSTYLE) &
Q_WS_EX_LAYERED) {
1927 BLENDFUNCTION blend = {AC_SRC_OVER, 0, (
BYTE)(255.0 * level), AC_SRC_ALPHA};
1933 static bool function_resolved =
false;
1934 if (!function_resolved) {
1937 "SetLayeredWindowAttributes");
1938 function_resolved =
true;
1944 int wl = GetWindowLong(q->internalWinId(), GWL_EXSTYLE);
1950 SetWindowLong(q->internalWinId(), GWL_EXSTYLE, wl & ~Q_WS_EX_LAYERED);
1964 #ifndef QT_NO_DIRECTDRAW 1978 qWarning(
"DirectDrawCreate failed: %d", res);
1982 DDSURFACEDESC surfaceDesc;
1983 memset(&surfaceDesc, 0,
sizeof(DDSURFACEDESC));
1985 surfaceDesc.dwSize =
sizeof(DDSURFACEDESC);
1986 surfaceDesc.dwFlags = DDSD_CAPS;
1987 surfaceDesc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
1991 qWarning(
"CreateSurface failed: %d", res);
1993 memset(&surfaceDesc, 0,
sizeof(DDSURFACEDESC));
1994 surfaceDesc.dwSize =
sizeof(DDSURFACEDESC);
1995 res =
qt_ddraw_primary->Lock(0, &surfaceDesc, DDLOCK_WAIT | DDLOCK_SURFACEMEMORYPTR, 0);
1997 qWarning(
"Locking surface failed: %d", res);
1999 if (surfaceDesc.ddpfPixelFormat.dwFlags == DDPF_RGB) {
2000 qt_primary_surface_bits = (
uchar *) surfaceDesc.lpSurface;
2001 qt_primary_surface_stride = surfaceDesc.lPitch;
2004 qWarning(
"QWidget painting: unsupported device depth for onscreen painting...\n");
2020 qt_primary_surface_stride,
2021 qt_primary_surface_format))
2023 device =
static_cast<QImage *
>(d_func()->device);
2029 originalSystemClip = clip;
2031 setSystemClip(clip);
2034 DDSURFACEDESC surface;
2035 surface.dwSize =
sizeof(DDSURFACEDESC);
2038 qWarning(
"QWidget painting: locking onscreen bits failed: %d\n", res);
2042 if (surface.lpSurface == qt_primary_surface_bits) {
2043 qt_primary_surface_bits = (
uchar *) surface.lpSurface;
2054 qWarning(
"QWidget::paint, failed to unlock DirectDraw surface: %d", res);
2056 setSystemClip(originalSystemClip);
2075 #ifndef QT_NO_DIRECTDRAW 2110 void QWidgetPrivate::registerTouchWindow()
2121 void QWidgetPrivate::winSetupGestures()
2123 #if !defined(QT_NO_GESTURES) && !defined(QT_NO_NATIVE_GESTURES) 2125 if (!q || !q->isVisible() || !nativeGesturePanEnabled)
2133 WId winid = q->internalWinId();
2137 bool singleFingerPanEnabled =
false;
2139 #ifndef QT_NO_SCROLLAREA 2141 QScrollBar *hbar = asa->horizontalScrollBar();
2149 singleFingerPanEnabled = asa->d_func()->singleFingerPanEnabled;
2154 #endif //QT_NO_SCROLLAREA 2157 memset(gc, 0,
sizeof(gc));
2159 if (nativeGesturePanEnabled) {
2161 if (needv && singleFingerPanEnabled)
2165 if (needh && singleFingerPanEnabled)
2173 qAppPriv->
SetGestureConfig(winid, 0,
sizeof(gc)/
sizeof(gc[0]), gc,
sizeof(gc[0]));
HCURSOR_or_HANDLE handle() const
Returns a platform-specific cursor handle.
static void jump(QtMsgType t, const char *m)
The QApplication class manages the GUI application's control flow and main settings.
Format
The following image formats are available in Qt.
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
#define GC_PAN_WITH_SINGLE_FINGER_VERTICALLY
void push_back(const T &t)
This function is provided for STL compatibility.
PtrUpdateLayeredWindowIndirect ptrUpdateLayeredWindowIndirect
void setBottom(int pos)
Sets the bottom edge of the rectangle to the given y coordinate.
The QCursor class provides a mouse cursor with an arbitrary shape.
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
#define QT_END_NAMESPACE
This macro expands to.
QPointer< QWidget > widget
RegionType
Specifies the shape of the region to be created.
bool remove(const T &value)
bool end()
Reimplement this function to finish painting on the current paint device.
bool begin(QPaintDevice *device)
Reimplemented Function
PtrSetGestureConfig SetGestureConfig
int left() const
Returns the x-coordinate of the rectangle's left edge.
int width() const
Returns the width of the rectangle.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
QPoint coordinateOffset() const
Returns the offset from the painters origo to the engines origo.
static QApplicationPrivate * instance()
QRect boundingRect() const
Returns the bounding rectangle of this region.
int height() const
Returns the height of the rectangle.
int bottom() const
Returns the y-coordinate of the rectangle's bottom edge.
The QString class provides a Unicode character string.
The QObject class is the base class of all Qt objects.
bool end()
Reimplemented Function
Q_CORE_EXPORT QTextStream & right(QTextStream &s)
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
void setObjectName(const QString &name)
Q_CORE_EXPORT void qDebug(const char *,...)
void setParent_helper(QObject *)
The QBitmap class provides monochrome (1-bit depth) pixmaps.
static QThread * currentThread()
Returns a pointer to a QThread which manages the currently executing thread.
void append(const T &t)
Inserts value at the end of the list.
#define QT_BEGIN_NAMESPACE
This macro expands to.
The QMoveEvent class contains event parameters for move events.
QBool contains(const T &t) const
Returns true if the list contains an occurrence of value; otherwise returns false.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
void setTop(int pos)
Sets the top edge of the rectangle to the given y coordinate.
#define Q_GLOBAL_STATIC(TYPE, NAME)
Declares a global static variable with the given type and name.
QSize size() const
Returns the size of the rectangle.
const T & at(int i) const
Returns the item at index position i in the list.
bool isNull() const
Returns true if the icon is empty; otherwise returns false.
void setRight(int pos)
Sets the right edge of the rectangle to the given x coordinate.
The QResizeEvent class contains event parameters for resize events.
Q_CORE_EXPORT void qWarning(const char *,...)
The QImage class provides a hardware-independent image representation that allows direct access to th...
#define GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY
#define FALSE
Synonym for false.
static bool HasTouchSupport
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
The QRegion class specifies a clip region for a painter.
static PtrRegisterTouchWindow RegisterTouchWindow
void setCoords(int x1, int y1, int x2, int y2)
Sets the coordinates of the rectangle's top-left corner to (x1, y1), and the coordinates of its botto...
The QPaintEngine class provides an abstract definition of how QPainter draws to a given device on a g...
bool contains(const QPoint &p, bool proper=false) const
Returns true if the given point is inside or on the edge of the rectangle, otherwise returns false...
The QWindowSurface class provides the drawing area for top-level windows.
static QWidget * parentWidget(const QWidget *w)
static QDesktopWidget * desktop()
Returns the desktop widget (also called the root window).
#define TRUE
Synonym for true.
QOnScreenRasterPaintEngine()
#define Q_ASSERT_X(cond, where, what)
bool isWidgetType() const
Returns true if the object is a widget; otherwise returns false.
int top() const
Returns the y-coordinate of the rectangle's top edge.
void * resolve(const char *symbol)
The QWindowStateChangeEvent class provides the window state before a window state change...
int right() const
Returns the x-coordinate of the rectangle's right edge.
void qt_win_set_cursor(QWidget *, bool)
bool begin(QPaintDevice *)
Reimplement this function to initialise your paint engine when painting is to start on the paint devi...
HICON toWinHICON() const
Returns the HICON handle.
void setLeft(int pos)
Sets the left edge of the rectangle to the given x coordinate.
int y() const
Returns the y-coordinate of the rectangle's top edge.
QSize actualSize(const QSize &size, Mode mode=Normal, State state=Off) const
Returns the actual size of the icon for the requested size, mode, and state.
int x() const
Returns the x-coordinate of the rectangle's left edge.
int toInt(bool *ok=0, int base=10) const
Returns the byte array converted to an int using base base, which is 10 by default and must be betwee...
void setRect(int x, int y, int w, int h)
Sets the coordinates of the rectangle's top-left corner to ({x}, {y}), and its size to the given widt...
The QPoint class defines a point in the plane using integer precision.
int size() const
Returns the number of items in the list.
The QRect class defines a rectangle in the plane using integer precision.
int y() const
Returns the y coordinate of this point.
#define QT_USE_NAMESPACE
This macro expands to using QT_NAMESPACE if QT_NAMESPACE is defined and nothing otherwise.
The QPixmap class is an off-screen image representation that can be used as a paint device...
QPixmap pixmap(const QSize &size, Mode mode=Normal, State state=Off) const
Returns a pixmap with the requested size, mode, and state, generating one if necessary.
Q_CORE_EXPORT HINSTANCE qWinAppInst()
void translate(int dx, int dy)
Translates (moves) the region dx along the X axis and dy along the Y axis.
The QSize class defines the size of a two-dimensional object using integer point precision.
int x() const
Returns the x coordinate of this point.
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...
bool isNull() const
Returns true if this is a null pixmap; otherwise returns false.
bool isValid() const
Returns true if the rectangle is valid, otherwise returns false.
static const int QLAYOUTSIZE_MAX
void translate(int dx, int dy)
Moves the rectangle dx along the x axis and dy along the y axis, relative to the current position...
QRegion originalSystemClip
Q_CORE_EXPORT QTextStream & left(QTextStream &s)
void qAddPostRoutine(QtCleanUpFunction ptr)
Adds a global routine that will be called from the QApplication destructor.
static void leaveModal(QWidget *)
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
PtrUpdateLayeredWindow ptrUpdateLayeredWindow
Handle handle() const
Returns a platform-specific region handle.
static Qt::KeyboardModifiers oldstate
const ushort * utf16() const
Returns the QString as a '\0\'-terminated array of unsigned shorts.
void qErrnoWarning(const char *msg,...)
QPoint topLeft() const
Returns the position of the rectangle's top-left corner.
int removeAll(const T &t)
Removes all occurrences of value in the list and returns the number of entries removed.
The QIcon class provides scalable icons in different modes and states.