Line data Source code
1 : /****************************************************************************
2 : **
3 : ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
4 : ** Contact: http://www.qt-project.org/legal
5 : **
6 : ** This file is part of the QtCore module of the Qt Toolkit.
7 : **
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.
16 : **
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.
24 : **
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.
28 : **
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.
36 : **
37 : **
38 : ** $QT_END_LICENSE$
39 : **
40 : ****************************************************************************/
41 :
42 : #ifndef QCOREEVENT_H
43 : #define QCOREEVENT_H
44 :
45 : #include <QtCore/qnamespace.h>
46 : #include <QtCore/qbytearray.h>
47 : #include <QtCore/qobjectdefs.h>
48 :
49 : QT_BEGIN_NAMESPACE
50 :
51 :
52 : class QEventPrivate;
53 : class Q_CORE_EXPORT QEvent // event base class
54 : {
55 : Q_GADGET
56 : QDOC_PROPERTY(bool accepted READ isAccepted WRITE setAccepted)
57 : Q_ENUMS(Type)
58 : public:
59 : enum Type {
60 : /*
61 : If you get a strange compiler error on the line with None,
62 : it's probably because you're also including X11 headers,
63 : which #define the symbol None. Put the X11 includes after
64 : the Qt includes to solve this problem.
65 : */
66 : None = 0, // invalid event
67 : Timer = 1, // timer event
68 : MouseButtonPress = 2, // mouse button pressed
69 : MouseButtonRelease = 3, // mouse button released
70 : MouseButtonDblClick = 4, // mouse button double click
71 : MouseMove = 5, // mouse move
72 : KeyPress = 6, // key pressed
73 : KeyRelease = 7, // key released
74 : FocusIn = 8, // keyboard focus received
75 : FocusOut = 9, // keyboard focus lost
76 : FocusAboutToChange = 23, // keyboard focus is about to be lost
77 : Enter = 10, // mouse enters widget
78 : Leave = 11, // mouse leaves widget
79 : Paint = 12, // paint widget
80 : Move = 13, // move widget
81 : Resize = 14, // resize widget
82 : Create = 15, // after widget creation
83 : Destroy = 16, // during widget destruction
84 : Show = 17, // widget is shown
85 : Hide = 18, // widget is hidden
86 : Close = 19, // request to close widget
87 : Quit = 20, // request to quit application
88 : ParentChange = 21, // widget has been reparented
89 : ParentAboutToChange = 131, // sent just before the parent change is done
90 : ThreadChange = 22, // object has changed threads
91 : WindowActivate = 24, // window was activated
92 : WindowDeactivate = 25, // window was deactivated
93 : ShowToParent = 26, // widget is shown to parent
94 : HideToParent = 27, // widget is hidden to parent
95 : Wheel = 31, // wheel event
96 : WindowTitleChange = 33, // window title changed
97 : WindowIconChange = 34, // icon changed
98 : ApplicationWindowIconChange = 35, // application icon changed
99 : ApplicationFontChange = 36, // application font changed
100 : ApplicationLayoutDirectionChange = 37, // application layout direction changed
101 : ApplicationPaletteChange = 38, // application palette changed
102 : PaletteChange = 39, // widget palette changed
103 : Clipboard = 40, // internal clipboard event
104 : Speech = 42, // reserved for speech input
105 : MetaCall = 43, // meta call event
106 : SockAct = 50, // socket activation
107 : WinEventAct = 132, // win event activation
108 : DeferredDelete = 52, // deferred delete event
109 : DragEnter = 60, // drag moves into widget
110 : DragMove = 61, // drag moves in widget
111 : DragLeave = 62, // drag leaves or is cancelled
112 : Drop = 63, // actual drop
113 : DragResponse = 64, // drag accepted/rejected
114 : ChildAdded = 68, // new child widget
115 : ChildPolished = 69, // polished child widget
116 : ChildRemoved = 71, // deleted child widget
117 : ShowWindowRequest = 73, // widget's window should be mapped
118 : PolishRequest = 74, // widget should be polished
119 : Polish = 75, // widget is polished
120 : LayoutRequest = 76, // widget should be relayouted
121 : UpdateRequest = 77, // widget should be repainted
122 : UpdateLater = 78, // request update() later
123 :
124 : EmbeddingControl = 79, // ActiveX embedding
125 : ActivateControl = 80, // ActiveX activation
126 : DeactivateControl = 81, // ActiveX deactivation
127 : ContextMenu = 82, // context popup menu
128 : InputMethod = 83, // input method
129 : TabletMove = 87, // Wacom tablet event
130 : LocaleChange = 88, // the system locale changed
131 : LanguageChange = 89, // the application language changed
132 : LayoutDirectionChange = 90, // the layout direction changed
133 : Style = 91, // internal style event
134 : TabletPress = 92, // tablet press
135 : TabletRelease = 93, // tablet release
136 : OkRequest = 94, // CE (Ok) button pressed
137 : HelpRequest = 95, // CE (?) button pressed
138 :
139 : IconDrag = 96, // proxy icon dragged
140 :
141 : FontChange = 97, // font has changed
142 : EnabledChange = 98, // enabled state has changed
143 : ActivationChange = 99, // window activation has changed
144 : StyleChange = 100, // style has changed
145 : IconTextChange = 101, // icon text has changed
146 : ModifiedChange = 102, // modified state has changed
147 : MouseTrackingChange = 109, // mouse tracking state has changed
148 :
149 : WindowBlocked = 103, // window is about to be blocked modally
150 : WindowUnblocked = 104, // windows modal blocking has ended
151 : WindowStateChange = 105,
152 :
153 : ToolTip = 110,
154 : WhatsThis = 111,
155 : StatusTip = 112,
156 :
157 : ActionChanged = 113,
158 : ActionAdded = 114,
159 : ActionRemoved = 115,
160 :
161 : FileOpen = 116, // file open request
162 :
163 : Shortcut = 117, // shortcut triggered
164 : ShortcutOverride = 51, // shortcut override request
165 :
166 : WhatsThisClicked = 118,
167 :
168 : ToolBarChange = 120, // toolbar visibility toggled
169 :
170 : ApplicationActivate = 121, // deprecated. Use ApplicationStateChange instead.
171 : ApplicationActivated = ApplicationActivate, // deprecated
172 : ApplicationDeactivate = 122, // deprecated. Use ApplicationStateChange instead.
173 : ApplicationDeactivated = ApplicationDeactivate, // deprecated
174 :
175 : QueryWhatsThis = 123, // query what's this widget help
176 : EnterWhatsThisMode = 124,
177 : LeaveWhatsThisMode = 125,
178 :
179 : ZOrderChange = 126, // child widget has had its z-order changed
180 :
181 : HoverEnter = 127, // mouse cursor enters a hover widget
182 : HoverLeave = 128, // mouse cursor leaves a hover widget
183 : HoverMove = 129, // mouse cursor move inside a hover widget
184 :
185 : // last event id used = 132
186 :
187 : #ifdef QT_KEYPAD_NAVIGATION
188 : EnterEditFocus = 150, // enter edit mode in keypad navigation
189 : LeaveEditFocus = 151, // enter edit mode in keypad navigation
190 : #endif
191 : AcceptDropsChange = 152,
192 :
193 : ZeroTimerEvent = 154, // Used for Windows Zero timer events
194 :
195 : GraphicsSceneMouseMove = 155, // GraphicsView
196 : GraphicsSceneMousePress = 156,
197 : GraphicsSceneMouseRelease = 157,
198 : GraphicsSceneMouseDoubleClick = 158,
199 : GraphicsSceneContextMenu = 159,
200 : GraphicsSceneHoverEnter = 160,
201 : GraphicsSceneHoverMove = 161,
202 : GraphicsSceneHoverLeave = 162,
203 : GraphicsSceneHelp = 163,
204 : GraphicsSceneDragEnter = 164,
205 : GraphicsSceneDragMove = 165,
206 : GraphicsSceneDragLeave = 166,
207 : GraphicsSceneDrop = 167,
208 : GraphicsSceneWheel = 168,
209 :
210 : KeyboardLayoutChange = 169, // keyboard layout changed
211 :
212 : DynamicPropertyChange = 170, // A dynamic property was changed through setProperty/property
213 :
214 : TabletEnterProximity = 171,
215 : TabletLeaveProximity = 172,
216 :
217 : NonClientAreaMouseMove = 173,
218 : NonClientAreaMouseButtonPress = 174,
219 : NonClientAreaMouseButtonRelease = 175,
220 : NonClientAreaMouseButtonDblClick = 176,
221 :
222 : MacSizeChange = 177, // when the Qt::WA_Mac{Normal,Small,Mini}Size changes
223 :
224 : ContentsRectChange = 178, // sent by QWidget::setContentsMargins (internal)
225 :
226 : MacGLWindowChange = 179, // Internal! the window of the GLWidget has changed
227 :
228 : FutureCallOut = 180,
229 :
230 : GraphicsSceneResize = 181,
231 : GraphicsSceneMove = 182,
232 :
233 : CursorChange = 183,
234 : ToolTipChange = 184,
235 :
236 : NetworkReplyUpdated = 185, // Internal for QNetworkReply
237 :
238 : GrabMouse = 186,
239 : UngrabMouse = 187,
240 : GrabKeyboard = 188,
241 : UngrabKeyboard = 189,
242 : MacGLClearDrawable = 191, // Internal Cocoa, the window has changed, so we must clear
243 :
244 : StateMachineSignal = 192,
245 : StateMachineWrapped = 193,
246 :
247 : TouchBegin = 194,
248 : TouchUpdate = 195,
249 : TouchEnd = 196,
250 :
251 : #ifndef QT_NO_GESTURES
252 : NativeGesture = 197, // QtGui native gesture
253 : #endif
254 : RequestSoftwareInputPanel = 199,
255 : CloseSoftwareInputPanel = 200,
256 :
257 : WinIdChange = 203,
258 : #ifndef QT_NO_GESTURES
259 : Gesture = 198,
260 : GestureOverride = 202,
261 : #endif
262 : ScrollPrepare = 204,
263 : Scroll = 205,
264 :
265 : Expose = 206,
266 :
267 : InputMethodQuery = 207,
268 : OrientationChange = 208, // Screen orientation has changed
269 :
270 : TouchCancel = 209,
271 :
272 : ThemeChange = 210,
273 :
274 : SockClose = 211, // socket closed
275 :
276 : PlatformPanel = 212,
277 :
278 : StyleAnimationUpdate = 213, // style animation target should be updated
279 : ApplicationStateChange = 214,
280 :
281 : WindowChangeInternal = 215, // internal for QQuickWidget
282 :
283 : // 512 reserved for Qt Jambi's MetaCall event
284 : // 513 reserved for Qt Jambi's DeleteOnMainThread event
285 :
286 : User = 1000, // first user event id
287 : MaxUser = 65535 // last user event id
288 : };
289 :
290 : explicit QEvent(Type type);
291 : QEvent(const QEvent &other);
292 : virtual ~QEvent();
293 : QEvent &operator=(const QEvent &other);
294 0 : inline Type type() const { return static_cast<Type>(t); }
295 : inline bool spontaneous() const { return spont; }
296 :
297 : inline void setAccepted(bool accepted) { m_accept = accepted; }
298 : inline bool isAccepted() const { return m_accept; }
299 :
300 : inline void accept() { m_accept = true; }
301 : inline void ignore() { m_accept = false; }
302 :
303 : static int registerEventType(int hint = -1);
304 :
305 : protected:
306 : QEventPrivate *d;
307 : ushort t;
308 :
309 : private:
310 : ushort posted : 1;
311 : ushort spont : 1;
312 : ushort m_accept : 1;
313 : ushort reserved : 13;
314 :
315 : friend class QCoreApplication;
316 : friend class QCoreApplicationPrivate;
317 : friend class QThreadData;
318 : friend class QApplication;
319 : friend class QApplicationPrivate;
320 : friend class QShortcutMap;
321 : friend class QETWidget;
322 : friend class QGraphicsView;
323 : friend class QGraphicsViewPrivate;
324 : friend class QGraphicsScene;
325 : friend class QGraphicsScenePrivate;
326 : friend class QWidgetWindow;
327 : #ifndef QT_NO_GESTURES
328 : friend class QGestureManager;
329 : #endif
330 : };
331 :
332 : class Q_CORE_EXPORT QTimerEvent : public QEvent
333 : {
334 : public:
335 : explicit QTimerEvent( int timerId );
336 : ~QTimerEvent();
337 0 : int timerId() const { return id; }
338 : protected:
339 : int id;
340 : };
341 :
342 : class QObject;
343 :
344 : class Q_CORE_EXPORT QChildEvent : public QEvent
345 : {
346 : public:
347 : QChildEvent( Type type, QObject *child );
348 : ~QChildEvent();
349 : QObject *child() const { return c; }
350 : bool added() const { return type() == ChildAdded; }
351 : bool polished() const { return type() == ChildPolished; }
352 : bool removed() const { return type() == ChildRemoved; }
353 : protected:
354 : QObject *c;
355 : };
356 :
357 : class Q_CORE_EXPORT QDynamicPropertyChangeEvent : public QEvent
358 : {
359 : public:
360 : explicit QDynamicPropertyChangeEvent(const QByteArray &name);
361 : ~QDynamicPropertyChangeEvent();
362 :
363 : inline QByteArray propertyName() const { return n; }
364 :
365 : private:
366 : QByteArray n;
367 : };
368 :
369 : class Q_CORE_EXPORT QDeferredDeleteEvent : public QEvent
370 : {
371 : public:
372 : explicit QDeferredDeleteEvent();
373 : ~QDeferredDeleteEvent();
374 : int loopLevel() const { return level; }
375 : private:
376 : int level;
377 : friend class QCoreApplication;
378 : };
379 :
380 : QT_END_NAMESPACE
381 :
382 : #endif // QCOREEVENT_H
|