e5fcad3 by Lars Knoll at 2009-03-23 1
/****************************************************************************
2
**
89c08c0 by Jason McDonald at 2012-01-11 3
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
04e3b30 by Jason McDonald at 2009-09-09 4
** All rights reserved.
858c70f by Jason McDonald at 2009-06-16 5
** Contact: Nokia Corporation (qt-info@nokia.com)
e5fcad3 by Lars Knoll at 2009-03-23 6
**
7
** This file is part of the QtCore module of the Qt Toolkit.
8
**
9
** $QT_BEGIN_LICENSE:LGPL$
10
** GNU Lesser General Public License Usage
1eea52e by Jyri Tahtela at 2011-05-13 11
** This file may be used under the terms of the GNU Lesser General Public
12
** License version 2.1 as published by the Free Software Foundation and
13
** appearing in the file LICENSE.LGPL included in the packaging of this
14
** file. Please review the following information to ensure the GNU Lesser
15
** General Public License version 2.1 requirements will be met:
16
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
e5fcad3 by Lars Knoll at 2009-03-23 17
**
04e3b30 by Jason McDonald at 2009-09-09 18
** In addition, as a special exception, Nokia gives you certain additional
1eea52e by Jyri Tahtela at 2011-05-13 19
** rights. These rights are described in the Nokia Qt LGPL Exception
04e3b30 by Jason McDonald at 2009-09-09 20
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
e5fcad3 by Lars Knoll at 2009-03-23 21
**
1eea52e by Jyri Tahtela at 2011-05-13 22
** GNU General Public License Usage
23
** Alternatively, this file may be used under the terms of the GNU General
24
** Public License version 3.0 as published by the Free Software Foundation
25
** and appearing in the file LICENSE.GPL included in the packaging of this
26
** file. Please review the following information to ensure the GNU General
27
** Public License version 3.0 requirements will be met:
28
** http://www.gnu.org/copyleft/gpl.html.
29
**
30
** Other Usage
31
** Alternatively, this file may be used in accordance with the terms and
32
** conditions contained in a signed written agreement between you and Nokia.
309db73 by Jason McDonald at 2009-08-31 33
**
34
**
35
**
36
**
e5fcad3 by Lars Knoll at 2009-03-23 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>
bb2e4df by Alexis Menard at 2009-04-17 47
#include <QtCore/qobjectdefs.h>
e5fcad3 by Lars Knoll at 2009-03-23 48
49
QT_BEGIN_HEADER
50
51
QT_BEGIN_NAMESPACE
52
53
QT_MODULE(Core)
54
55
class QEventPrivate;
56
class Q_CORE_EXPORT QEvent           // event base class
57
{
bb2e4df by Alexis Menard at 2009-04-17 58
    Q_GADGET
e5fcad3 by Lars Knoll at 2009-03-23 59
    QDOC_PROPERTY(bool accepted READ isAccepted WRITE setAccepted)
bb2e4df by Alexis Menard at 2009-04-17 60
    Q_ENUMS(Type)
e5fcad3 by Lars Knoll at 2009-03-23 61
public:
62
    enum Type {
63
        /*
64
          If you get a strange compiler error on the line with None,
65
          it's probably because you're also including X11 headers,
66
          which #define the symbol None. Put the X11 includes after
67
          the Qt includes to solve this problem.
68
        */
69
        None = 0,                               // invalid event
70
        Timer = 1,                              // timer event
71
        MouseButtonPress = 2,                   // mouse button pressed
72
        MouseButtonRelease = 3,                 // mouse button released
73
        MouseButtonDblClick = 4,                // mouse button double click
74
        MouseMove = 5,                          // mouse move
75
        KeyPress = 6,                           // key pressed
76
        KeyRelease = 7,                         // key released
77
        FocusIn = 8,                            // keyboard focus received
78
        FocusOut = 9,                           // keyboard focus lost
79
        Enter = 10,                             // mouse enters widget
80
        Leave = 11,                             // mouse leaves widget
81
        Paint = 12,                             // paint widget
82
        Move = 13,                              // move widget
83
        Resize = 14,                            // resize widget
84
        Create = 15,                            // after widget creation
85
        Destroy = 16,                           // during widget destruction
86
        Show = 17,                              // widget is shown
87
        Hide = 18,                              // widget is hidden
88
        Close = 19,                             // request to close widget
89
        Quit = 20,                              // request to quit application
90
        ParentChange = 21,                      // widget has been reparented
91
        ParentAboutToChange = 131,              // sent just before the parent change is done
92
#ifdef QT3_SUPPORT
93
        Reparent = ParentChange,
94
#endif
95
        ThreadChange = 22,                      // object has changed threads
96
        WindowActivate = 24,                    // window was activated
97
        WindowDeactivate = 25,                  // window was deactivated
98
        ShowToParent = 26,                      // widget is shown to parent
99
        HideToParent = 27,                      // widget is hidden to parent
100
        Wheel = 31,                             // wheel event
101
        WindowTitleChange = 33,                 // window title changed
102
        WindowIconChange = 34,                  // icon changed
103
        ApplicationWindowIconChange = 35,       // application icon changed
104
        ApplicationFontChange = 36,             // application font changed
105
        ApplicationLayoutDirectionChange = 37,  // application layout direction changed
106
        ApplicationPaletteChange = 38,          // application palette changed
107
        PaletteChange = 39,                     // widget palette changed
108
        Clipboard = 40,                         // internal clipboard event
109
        Speech = 42,                            // reserved for speech input
110
        MetaCall =  43,                         // meta call event
111
        SockAct = 50,                           // socket activation
112
        WinEventAct = 132,                      // win event activation
113
        DeferredDelete = 52,                    // deferred delete event
114
        DragEnter = 60,                         // drag moves into widget
115
        DragMove = 61,                          // drag moves in widget
116
        DragLeave = 62,                         // drag leaves or is cancelled
117
        Drop = 63,                              // actual drop
118
        DragResponse = 64,                      // drag accepted/rejected
119
        ChildAdded = 68,                        // new child widget
120
        ChildPolished = 69,                     // polished child widget
121
#ifdef QT3_SUPPORT
122
        ChildInsertedRequest = 67,              // send ChildInserted compatibility events to receiver
123
        ChildInserted = 70,                     // compatibility child inserted
124
        LayoutHint = 72,                        // compatibility relayout request
125
#endif
126
        ChildRemoved = 71,                      // deleted child widget
127
        ShowWindowRequest = 73,                 // widget's window should be mapped
128
        PolishRequest = 74,                     // widget should be polished
129
        Polish = 75,                            // widget is polished
130
        LayoutRequest = 76,                     // widget should be relayouted
131
        UpdateRequest = 77,                     // widget should be repainted
132
        UpdateLater = 78,                       // request update() later
133
134
        EmbeddingControl = 79,                  // ActiveX embedding
135
        ActivateControl = 80,                   // ActiveX activation
136
        DeactivateControl = 81,                 // ActiveX deactivation
137
        ContextMenu = 82,                       // context popup menu
138
        InputMethod = 83,                       // input method
139
        AccessibilityPrepare = 86,              // accessibility information is requested
140
        TabletMove = 87,                        // Wacom tablet event
141
        LocaleChange = 88,                      // the system locale changed
142
        LanguageChange = 89,                    // the application language changed
143
        LayoutDirectionChange = 90,             // the layout direction changed
144
        Style = 91,                             // internal style event
145
        TabletPress = 92,                       // tablet press
146
        TabletRelease = 93,                     // tablet release
147
        OkRequest = 94,                         // CE (Ok) button pressed
148
        HelpRequest = 95,                       // CE (?)  button pressed
149
150
        IconDrag = 96,                          // proxy icon dragged
151
152
        FontChange = 97,                        // font has changed
153
        EnabledChange = 98,                     // enabled state has changed
154
        ActivationChange = 99,                  // window activation has changed
155
        StyleChange = 100,                      // style has changed
156
        IconTextChange = 101,                   // icon text has changed
157
        ModifiedChange = 102,                   // modified state has changed
158
        MouseTrackingChange = 109,              // mouse tracking state has changed
159
160
        WindowBlocked = 103,                    // window is about to be blocked modally
161
        WindowUnblocked = 104,                  // windows modal blocking has ended
162
        WindowStateChange = 105,
163
164
        ToolTip = 110,
165
        WhatsThis = 111,
166
        StatusTip = 112,
167
168
        ActionChanged = 113,
169
        ActionAdded = 114,
170
        ActionRemoved = 115,
171
172
        FileOpen = 116,                         // file open request
173
174
        Shortcut = 117,                         // shortcut triggered
175
        ShortcutOverride = 51,                  // shortcut override request
176
177
#ifdef QT3_SUPPORT
178
        Accel = 30,                             // accelerator event
179
        AccelAvailable = 32,                    // accelerator available event
180
        AccelOverride = ShortcutOverride,       // accelerator override event
181
#endif
182
183
        WhatsThisClicked = 118,
184
185
#ifdef QT3_SUPPORT
186
        CaptionChange = WindowTitleChange,
187
        IconChange = WindowIconChange,
188
#endif
189
        ToolBarChange = 120,                    // toolbar visibility toggled
190
191
        ApplicationActivate = 121,              // application has been changed to active
192
        ApplicationActivated = ApplicationActivate, // deprecated
193
        ApplicationDeactivate = 122,            // application has been changed to inactive
194
        ApplicationDeactivated = ApplicationDeactivate, // deprecated
195
196
        QueryWhatsThis = 123,                   // query what's this widget help
197
        EnterWhatsThisMode = 124,
198
        LeaveWhatsThisMode = 125,
199
200
        ZOrderChange = 126,                     // child widget has had its z-order changed
201
202
        HoverEnter = 127,                       // mouse cursor enters a hover widget
203
        HoverLeave = 128,                       // mouse cursor leaves a hover widget
204
        HoverMove = 129,                        // mouse cursor move inside a hover widget
205
206
        AccessibilityHelp = 119,                // accessibility help text request
207
        AccessibilityDescription = 130,         // accessibility description text request
208
209
        // last event id used = 132
210
211
#ifdef QT_KEYPAD_NAVIGATION
a8f9fb7 by jaanttil at 2011-09-27 212
        EnterEditFocus = 150,                   // enter edit mode in keypad navigation (Defined only with QT_KEYPAD_NAVIGATION)
213
        LeaveEditFocus = 151,                   // leave edit mode in keypad navigation (Defined only with QT_KEYPAD_NAVIGATION)
e5fcad3 by Lars Knoll at 2009-03-23 214
#endif
215
        AcceptDropsChange = 152,
216
217
        MenubarUpdated = 153,                    // Support event for Q3MainWindow, which needs to
218
                                                 // knwow when QMenubar is updated.
219
220
        ZeroTimerEvent = 154,                   // Used for Windows Zero timer events
221
222
        GraphicsSceneMouseMove = 155,           // GraphicsView
223
        GraphicsSceneMousePress = 156,
224
        GraphicsSceneMouseRelease = 157,
225
        GraphicsSceneMouseDoubleClick = 158,
226
        GraphicsSceneContextMenu = 159,
227
        GraphicsSceneHoverEnter = 160,
228
        GraphicsSceneHoverMove = 161,
229
        GraphicsSceneHoverLeave = 162,
230
        GraphicsSceneHelp = 163,
231
        GraphicsSceneDragEnter = 164,
232
        GraphicsSceneDragMove = 165,
233
        GraphicsSceneDragLeave = 166,
234
        GraphicsSceneDrop = 167,
235
        GraphicsSceneWheel = 168,
236
237
        KeyboardLayoutChange = 169,             // keyboard layout changed
238
239
        DynamicPropertyChange = 170,            // A dynamic property was changed through setProperty/property
240
241
        TabletEnterProximity = 171,
242
        TabletLeaveProximity = 172,
243
244
        NonClientAreaMouseMove = 173,
245
        NonClientAreaMouseButtonPress = 174,
246
        NonClientAreaMouseButtonRelease = 175,
247
        NonClientAreaMouseButtonDblClick = 176,
248
249
        MacSizeChange = 177,                    // when the Qt::WA_Mac{Normal,Small,Mini}Size changes
250
251
        ContentsRectChange = 178,               // sent by QWidget::setContentsMargins (internal)
252
253
        MacGLWindowChange = 179,                // Internal! the window of the GLWidget has changed
254
255
        FutureCallOut = 180,
256
257
        GraphicsSceneResize  = 181,
258
        GraphicsSceneMove  = 182,
259
260
        CursorChange = 183,
261
        ToolTipChange = 184,
262
263
        NetworkReplyUpdated = 185,              // Internal for QNetworkReply
264
265
        GrabMouse = 186,
266
        UngrabMouse = 187,
267
        GrabKeyboard = 188,
268
        UngrabKeyboard = 189,
b4234ab by Norwegian Rock Cat at 2009-04-15 269
        MacGLClearDrawable = 191,               // Internal Cocoa, the window has changed, so we must clear
e5fcad3 by Lars Knoll at 2009-03-23 270
5d2f84d by Kent Hansen at 2009-10-02 271
        StateMachineSignal = 192,
272
        StateMachineWrapped = 193,
9e83807 by axis at 2009-05-04 273
8d8b3e0 by Bradley T. Hughes at 2009-06-05 274
        TouchBegin = 194,
275
        TouchUpdate = 195,
276
        TouchEnd = 196,
277
f629269 by Tasuku Suzuki at 2010-06-02 278
#ifndef QT_NO_GESTURES
fbee62a by Denis Dzyubenko at 2009-08-04 279
        NativeGesture = 197,                    // Internal for platform gesture support
f629269 by Tasuku Suzuki at 2010-06-02 280
#endif
6aa3624 by Jason Barron at 2009-07-07 281
        RequestSoftwareInputPanel = 199,
282
        CloseSoftwareInputPanel = 200,
283
a93d0d1 by axis at 2009-09-30 284
        UpdateSoftKeys = 201,                   // Internal for compressing soft key updates
96f0746 by Jason Barron at 2009-09-21 285
a8e2a45 by Gareth Stockwell at 2009-10-09 286
        WinIdChange = 203,
f629269 by Tasuku Suzuki at 2010-06-02 287
#ifndef QT_NO_GESTURES
f2437d3 by Denis Dzyubenko at 2009-10-09 288
        Gesture = 198,
289
        GestureOverride = 202,
f629269 by Tasuku Suzuki at 2010-06-02 290
#endif
67ad051 by Lars Knoll at 2009-03-23 291
        // 512 reserved for Qt Jambi's MetaCall event
e5fcad3 by Lars Knoll at 2009-03-23 292
        // 513 reserved for Qt Jambi's DeleteOnMainThread event
293
294
        User = 1000,                            // first user event id
295
        MaxUser = 65535                         // last user event id
296
    };
297
298
    QEvent(Type type);
299
    virtual ~QEvent();
300
    inline Type type() const { return static_cast<Type>(t); }
301
    inline bool spontaneous() const { return spont; }
302
303
    inline void setAccepted(bool accepted) { m_accept = accepted; }
304
    inline bool isAccepted() const { return m_accept; }
305
306
    inline void accept() { m_accept = true; }
307
    inline void ignore() { m_accept = false; }
308
309
    static int registerEventType(int hint = -1);
310
311
protected:
312
    QEventPrivate *d;
313
    ushort t;
314
315
private:
316
    ushort posted : 1;
317
    ushort spont : 1;
318
    ushort m_accept : 1;
319
    ushort reserved : 13;
320
321
    friend class QCoreApplication;
322
    friend class QCoreApplicationPrivate;
323
    friend class QThreadData;
324
    friend class QApplication;
325
    friend class QApplicationPrivate;
326
    friend class Q3AccelManager;
327
    friend class QShortcutMap;
328
    friend class QETWidget;
b349831 by Denis Dzyubenko at 2009-05-11 329
    friend class QGraphicsView;
330
    friend class QGraphicsViewPrivate;
da4d520 by Denis Dzyubenko at 2010-10-19 331
    friend class QGraphicsScene;
b349831 by Denis Dzyubenko at 2009-05-11 332
    friend class QGraphicsScenePrivate;
f629269 by Tasuku Suzuki at 2010-06-02 333
#ifndef QT_NO_GESTURES
f2437d3 by Denis Dzyubenko at 2009-10-09 334
    friend class QGestureManager;
f629269 by Tasuku Suzuki at 2010-06-02 335
#endif
e5fcad3 by Lars Knoll at 2009-03-23 336
};
337
338
class Q_CORE_EXPORT QTimerEvent : public QEvent
339
{
340
public:
341
    QTimerEvent( int timerId );
342
    ~QTimerEvent();
343
    int timerId() const { return id; }
344
protected:
345
    int id;
346
};
347
348
class QObject;
349
350
class Q_CORE_EXPORT QChildEvent : public QEvent
351
{
352
public:
353
    QChildEvent( Type type, QObject *child );
354
    ~QChildEvent();
355
    QObject *child() const { return c; }
356
    bool added() const { return type() == ChildAdded; }
357
#ifdef QT3_SUPPORT
358
    QT3_SUPPORT bool inserted() const { return type() == ChildInserted; }
359
#endif
360
    bool polished() const { return type() == ChildPolished; }
361
    bool removed() const { return type() == ChildRemoved; }
362
protected:
363
    QObject *c;
364
};
365
366
#ifdef QT3_SUPPORT
367
class Q_CORE_EXPORT QCustomEvent : public QEvent
368
{
369
public:
370
    QT3_SUPPORT_CONSTRUCTOR QCustomEvent(int type, void *data = 0);
371
    ~QCustomEvent();
372
    QT3_SUPPORT void *data()  const { return d; }
373
    QT3_SUPPORT void setData(void* aData) { d = reinterpret_cast<QEventPrivate *>(aData); }
374
};
375
#endif
376
377
class Q_CORE_EXPORT QDynamicPropertyChangeEvent : public QEvent
378
{
379
public:
380
    QDynamicPropertyChangeEvent(const QByteArray &name);
381
    ~QDynamicPropertyChangeEvent();
382
383
    inline QByteArray propertyName() const { return n; }
384
385
private:
386
    QByteArray n;
387
};
388
389
QT_END_NAMESPACE
390
391
QT_END_HEADER
392
393
#endif // QCOREEVENT_H