1 /****************************************************************************
3 ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
6 ** This file is part of the plugins of the Qt Toolkit.
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
40 ****************************************************************************/
42 #ifndef QTWINDOWSGLOBAL_H
43 #define QTWINDOWSGLOBAL_H
45 #include "qtwindows_additional.h"
46 #include <QtCore/qnamespace.h>
48 # include "qplatformfunctions_wince.h"
58 WindowEventFlag = 0x10000,
59 MouseEventFlag = 0x20000,
60 NonClientEventFlag = 0x40000,
61 InputMethodEventFlag = 0x80000,
62 KeyEventFlag = 0x100000,
63 KeyDownEventFlag = 0x200000,
64 TouchEventFlag = 0x400000,
65 ClipboardEventFlag = 0x800000,
66 ApplicationEventFlag = 0x1000000,
67 ThemingEventFlag = 0x2000000
70 enum WindowsEventType // Simplify event types
72 ExposeEvent = WindowEventFlag + 1,
73 ActivateWindowEvent = WindowEventFlag + 2,
74 DeactivateWindowEvent = WindowEventFlag + 3,
75 LeaveEvent = WindowEventFlag + 5,
76 CloseEvent = WindowEventFlag + 6,
77 ShowEvent = WindowEventFlag + 7,
78 HideEvent = WindowEventFlag + 8,
79 DestroyEvent = WindowEventFlag + 9,
80 MoveEvent = WindowEventFlag + 10,
81 ResizeEvent = WindowEventFlag + 12,
82 QuerySizeHints = WindowEventFlag + 15,
83 CalculateSize = WindowEventFlag + 16,
84 FocusInEvent = WindowEventFlag + 17,
85 FocusOutEvent = WindowEventFlag + 18,
86 MouseEvent = MouseEventFlag + 1,
87 MouseWheelEvent = MouseEventFlag + 2,
88 CursorEvent = MouseEventFlag + 3,
89 TouchEvent = TouchEventFlag + 1,
90 NonClientMouseEvent = NonClientEventFlag + MouseEventFlag + 1,
91 KeyEvent = KeyEventFlag + 1,
92 KeyDownEvent = KeyEventFlag + KeyDownEventFlag + 1,
93 InputMethodKeyEvent = InputMethodEventFlag + KeyEventFlag + 1,
94 InputMethodKeyDownEvent = InputMethodEventFlag + KeyEventFlag + KeyDownEventFlag + 1,
95 ClipboardEvent = ClipboardEventFlag + 1,
96 ActivateApplicationEvent = ApplicationEventFlag + 1,
97 DeactivateApplicationEvent = ApplicationEventFlag + 2,
98 AccessibleObjectFromWindowRequest = ApplicationEventFlag + 3,
99 InputMethodStartCompositionEvent = InputMethodEventFlag + 1,
100 InputMethodCompositionEvent = InputMethodEventFlag + 2,
101 InputMethodEndCompositionEvent = InputMethodEventFlag + 3,
102 InputMethodOpenCandidateWindowEvent = InputMethodEventFlag + 4,
103 InputMethodCloseCandidateWindowEvent = InputMethodEventFlag + 5,
104 InputMethodRequest = InputMethodEventFlag + 6,
105 ThemeChanged = ThemingEventFlag + 1,
106 DisplayChangedEvent = 437,
107 SettingChangedEvent = DisplayChangedEvent + 1,
111 } // namespace QtWindows
113 inline QtWindows::WindowsEventType windowsEventType(UINT message, WPARAM wParamIn)
118 return QtWindows::ExposeEvent;
120 return QtWindows::CloseEvent;
122 return QtWindows::DestroyEvent;
124 return (int)wParamIn ?
125 QtWindows::ActivateApplicationEvent : QtWindows::DeactivateApplicationEvent;
127 return LOWORD(wParamIn) == WA_INACTIVE ?
128 QtWindows::DeactivateWindowEvent : QtWindows::ActivateWindowEvent;
130 return QtWindows::CursorEvent;
132 return QtWindows::MouseEvent;
135 return QtWindows::MouseWheelEvent;
137 return QtWindows::MoveEvent;
139 return wParamIn ? QtWindows::ShowEvent : QtWindows::HideEvent;
141 return QtWindows::ResizeEvent;
143 return QtWindows::CalculateSize;
144 case WM_GETMINMAXINFO:
145 return QtWindows::QuerySizeHints;
146 case WM_KEYDOWN: // keyboard event
148 return QtWindows::KeyDownEvent;
152 return QtWindows::KeyEvent;
154 return QtWindows::InputMethodKeyEvent;
156 return QtWindows::InputMethodKeyDownEvent;
158 return QtWindows::TouchEvent;
159 case WM_CHANGECBCHAIN:
160 case WM_DRAWCLIPBOARD:
161 case WM_RENDERFORMAT:
162 case WM_RENDERALLFORMATS:
163 case WM_DESTROYCLIPBOARD:
164 return QtWindows::ClipboardEvent;
165 case WM_IME_STARTCOMPOSITION:
166 return QtWindows::InputMethodStartCompositionEvent;
167 case WM_IME_ENDCOMPOSITION:
168 return QtWindows::InputMethodEndCompositionEvent;
169 case WM_IME_COMPOSITION:
170 return QtWindows::InputMethodCompositionEvent;
172 return QtWindows::InputMethodRequest;
174 switch (int(wParamIn)) {
175 case IMN_OPENCANDIDATE:
176 return QtWindows::InputMethodOpenCandidateWindowEvent;
177 case IMN_CLOSECANDIDATE:
178 return QtWindows::InputMethodCloseCandidateWindowEvent;
183 return QtWindows::AccessibleObjectFromWindowRequest;
185 return QtWindows::FocusInEvent;
187 return QtWindows::FocusOutEvent;
188 // Among other things, WM_SETTINGCHANGE happens when the taskbar is moved
189 // and therefore the "working area" changes.
190 // http://msdn.microsoft.com/en-us/library/ms695534(v=vs.85).aspx
191 case WM_SETTINGCHANGE:
192 return QtWindows::SettingChangedEvent;
193 case WM_DISPLAYCHANGE:
194 return QtWindows::DisplayChangedEvent;
195 case WM_THEMECHANGED:
196 return QtWindows::ThemeChanged;
200 if (message >= WM_NCMOUSEMOVE && message <= WM_NCMBUTTONDBLCLK)
201 return QtWindows::NonClientMouseEvent; //
202 if ((message >= WM_MOUSEFIRST && message <= WM_MOUSELAST)
203 || (message >= WM_XBUTTONDOWN && message <= WM_XBUTTONDBLCLK))
204 return QtWindows::MouseEvent;
205 return QtWindows::UnknownEvent;
210 #endif // QTWINDOWSGLOBAL_H