52 #define PACKETDATA (PK_X | PK_Y | PK_BUTTONS | PK_NORMAL_PRESSURE | PK_TANGENT_PRESSURE \ 53 | PK_ORIENTATION | PK_CURSOR | PK_Z) 66 #ifndef QT_NO_TABLETEVENT 71 static bool firstTime =
true;
80 struct tagAXIS tpOri[3];
85 qWarning(
"QWidget: Wintab services not available");
99 lcMine.lcOptions |= CXO_MESSAGES | CXO_CSRMESSAGES;
103 lcMine.lcOutOrgX = 0;
104 lcMine.lcOutExtX = lcMine.lcInExtX;
105 lcMine.lcOutOrgY = 0;
106 lcMine.lcOutExtY = -lcMine.lcInExtY;
113 qWarning(
"QWidget: Failed to open the tablet");
126 Q_ASSERT_X(0,
"Qt::Internal",
"There is no packet queue for" 127 " the tablet. The tablet will not work");
139 #endif // QT_NO_TABLETEVENT 150 static int sw = -1, sh = -1;
164 HWND parentw, destroyw = 0;
170 initializeWindow =
true;
182 sw = GetSystemMetrics(SM_CXSCREEN);
183 sh = GetSystemMetrics(SM_CYSCREEN);
188 data.
crect.
setRect(0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN));
191 parentw = q->parentWidget() ? q->parentWidget()->effectiveWinId() : 0;
194 int style = WS_CHILD;
199 style = (WS_OVERLAPPED) | WS_SYSMENU;
204 exsty |= WS_EX_NOANIMATION;
211 exsty |= WS_EX_CONTEXTHELP;
212 #ifndef Q_WS_WINCE_WM 214 style |= WS_MINIMIZEBOX;
215 if (shouldShowMaximizeButton())
216 style |= WS_MAXIMIZEBOX;
223 style = WS_BORDER | WS_CAPTION;
229 exsty |= WS_EX_CONTEXTHELP;
233 exsty |= WS_EX_NOANIMATION;
237 title = q->isWindow() ?
qAppName() : q->objectName();
246 if (destroyOldWindow)
250 LONG res = SetWindowLong(
window, GWL_STYLE, style);
252 qErrnoWarning(
"QWidget::create: Failed to set window style");
257 qErrnoWarning(
"QWidget::create: Failed to set window procedure");
258 }
else if (desktop) {
259 id = GetDesktopWindow();
263 id = CreateWindow(reinterpret_cast<const wchar_t *>(windowClassName.
utf16()),
264 reinterpret_cast<const wchar_t *>(title.
utf16()), style,
265 r.left, r.top, r.right - r.left, r.bottom - r.top,
269 }
else if (topLevel) {
281 int w = CW_USEDEFAULT;
282 int h = CW_USEDEFAULT;
285 RECT rect = {0,0,0,0};
286 if (AdjustWindowRectEx(&rect, style,
FALSE, exsty)) {
299 id = CreateWindowEx(exsty, reinterpret_cast<const wchar_t *>(windowClassName.
utf16()),
300 reinterpret_cast<const wchar_t *>(title.
utf16()), style,
308 SetWindowPos(
id,
HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
310 id = CreateWindowEx(exsty, (
wchar_t*)windowClassName.
utf16(), (
wchar_t*)title.
utf16(), style,
312 parentw, NULL, appinst, NULL);
315 SetWindowPos(
id, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
323 GetClientRect(
id, &cr);
329 ClientToScreen(
id, &pt);
331 QPoint(pt.x + cr.right - 1, pt.y + cr.bottom - 1));
343 if (IsWindowVisible(
window))
352 #if defined(QT_NON_COMMERCIAL) 357 q->inputContext()->setFocusWidget(q);
360 DestroyWindow(destroyw);
363 #ifndef QT_NO_TABLETEVENT 366 #endif // QT_NO_TABLETEVENT 376 ShowWindow(q->internalWinId(), SW_SHOW);
386 #if defined(QT_NON_COMMERCIAL) 403 bool fakedMaximize =
false;
405 #ifndef Q_WS_WINCE_WM 406 if (q->isMinimized()) {
408 }
else if (q->isMaximized()) {
409 sm = SW_SHOWMAXIMIZED;
418 fakedMaximize =
TRUE;
419 int style = GetWindowLong(q->internalWinId(), GWL_STYLE);
420 SetWindowLong(q->internalWinId(), GWL_STYLE, style | WS_MAXIMIZEBOX);
425 if (q->isMinimized())
436 sm = SW_SHOWNOACTIVATE;
439 ShowWindow(q->internalWinId(), sm);
441 if (q->isMaximized() && q->isWindow())
444 #ifndef Q_WS_WINCE_WM 446 HWND handle = FindWindow(L
"HHTaskBar", L
"");
448 ShowWindow(handle, SW_HIDE);
449 EnableWindow(handle,
false);
454 int style = GetWindowLong(q->internalWinId(), GWL_STYLE);
455 SetWindowLong(q->internalWinId(), GWL_STYLE, style & ~WS_MAXIMIZEBOX);
456 SetWindowPos(q->internalWinId(), 0, 0, 0, 0, 0,
457 SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER
464 if (q->isWindow() && sm == SW_SHOW)
465 SetForegroundWindow(q->internalWinId());
473 Qt::WindowStates
oldstate = windowState();
474 if (oldstate == newstate)
477 int max = SW_SHOWNORMAL;
478 int normal = SW_SHOWNOACTIVATE;
483 normal = SW_SHOWNORMAL;
490 if (!
d->topData()->normalGeometry.isValid()) {
492 d->topData()->normalGeometry = geometry();
493 if (newstate & Qt::WindowMinimized && !(oldstate & Qt::WindowFullScreen))
494 d->topData()->normalGeometry = geometry();
497 if (!(newstate & Qt::WindowMaximized)) {
498 int style = GetWindowLong(internalWinId(), GWL_STYLE) | WS_BORDER | WS_POPUP | WS_CAPTION;
499 SetWindowLong(internalWinId(), GWL_STYLE, style);
500 SetWindowLong(internalWinId(), GWL_EXSTYLE, GetWindowLong (internalWinId(), GWL_EXSTYLE) & ~
WS_EX_NODRAG);
503 if (isVisible() && newstate & Qt::WindowMaximized)
505 if (isVisible() && !(newstate & Qt::WindowMinimized)) {
506 ShowWindow(internalWinId(), (newstate & Qt::WindowMaximized) ? max : normal);
508 QRect r =
d->topData()->normalGeometry;
509 if (!(newstate & Qt::WindowMaximized) && r.
width() >= 0) {
511 d->topData()->normalGeometry =
QRect(0,0,-1,-1);
516 d->updateFrameStrut();
521 if (newstate & Qt::WindowFullScreen) {
523 d->topData()->normalGeometry = geometry();
524 d->topData()->savedFlags = (Qt::WindowFlags)GetWindowLong(internalWinId(), GWL_STYLE);
525 UINT style = WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_POPUP;
528 SetWindowLong(internalWinId(), GWL_STYLE, style);
529 QRect r =
qApp->desktop()->screenGeometry(
this);
530 UINT swpf = SWP_FRAMECHANGED;
531 if (newstate & Qt::WindowActive)
532 swpf |= SWP_NOACTIVATE;
534 d->updateFrameStrut();
536 UINT style =
d->topData()->savedFlags;
539 SetWindowLong(internalWinId(), GWL_STYLE, style);
540 UINT swpf = SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOSIZE | SWP_NOMOVE;
541 if (newstate & Qt::WindowActive)
542 swpf |= SWP_NOACTIVATE;
544 d->updateFrameStrut();
548 ShowWindow(internalWinId(), (newstate & Qt::WindowMaximized) ? max : normal);
549 if (newstate & Qt::WindowMaximized)
552 if (!(newstate & Qt::WindowMaximized)) {
553 QRect r =
d->topData()->normalGeometry;
554 d->topData()->normalGeometry =
QRect(0,0,-1,-1);
561 if (newstate & Qt::WindowMinimized)
563 else if (newstate & Qt::WindowMaximized) {
564 ShowWindow(internalWinId(), max);
567 ShowWindow(internalWinId(), normal);
580 HWND handle = FindWindow(L
"HHTaskBar", L
"");
582 ShowWindow(handle, SW_SHOWNORMAL);
583 EnableWindow(handle,
true);
606 SetCapture(internalWinId());
617 SetCapture(internalWinId());
641 Qt::WindowFlags flags = windowFlags() & 0xff;
642 int threshold =
qApp->autoMaximizeThreshold();
647 int height = sizeHint().height();
648 int screenHeight = (
qreal(threshold) / 100.0f *
qApp->desktop()->screenGeometry(
this).height());
649 bool maximize = height > screenHeight;
655 for (
int i = 0; (i < list.
size()) && !expandingChild; ++i) {
658 maximize = expandingChild;
660 if ((minimumSizeHint().height() >
qApp->desktop()->screenGeometry(
this).height()) || (minimumSizeHint().width() >
qApp->desktop()->screenGeometry(
this).width()))
HCURSOR_or_HANDLE handle() const
Returns a platform-specific cursor handle.
void qt_wince_minimize(HWND hwnd)
The QCursor class provides a mouse cursor with an arbitrary shape.
#define QT_END_NAMESPACE
This macro expands to.
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
void qt_wince_maximize(QWidget *widget)
int height() const
Returns the height of the rectangle.
The QString class provides a Unicode character string.
void qt_wince_full_screen(HWND hwnd, bool fullScreen, UINT swpf)
void setObjectName(const QString &name)
Q_CORE_EXPORT void qDebug(const char *,...)
#define QT_BEGIN_NAMESPACE
This macro expands to.
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
void qt_wince_unmaximize(QWidget *widget)
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.
Q_CORE_EXPORT void qWarning(const char *,...)
#define FALSE
Synonym for false.
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
#define WS_EX_NOPARENTNOTIFY
#define TRUE
Synonym for true.
bool qt_wince_is_mobile()
#define Q_ASSERT_X(cond, where, what)
int top() const
Returns the y-coordinate of the rectangle's top edge.
The QWindowStateChangeEvent class provides the window state before a window state change...
int y() const
Returns the y-coordinate of the rectangle's top edge.
int x() const
Returns the x-coordinate of the rectangle's left edge.
static PtrWTInfo ptrWTInfo
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.
Policy verticalPolicy() const
The QRect class defines a rectangle in the plane using integer precision.
Q_CORE_EXPORT HINSTANCE qWinAppInst()
bool qt_tablet_tilt_support
bool isValid() const
Returns true if the rectangle is valid, otherwise returns false.
#define WS_EX_CAPTIONOKBTN
void qAddPostRoutine(QtCleanUpFunction ptr)
Adds a global routine that will be called from the QApplication destructor.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
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.