~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to src/corelib/kernel/qcoreevent.h

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************
 
2
**
 
3
** Copyright (C) 1992-2005 Trolltech AS. All rights reserved.
 
4
**
 
5
** This file is part of the core module of the Qt Toolkit.
 
6
**
 
7
** This file may be distributed under the terms of the Q Public License
 
8
** as defined by Trolltech AS of Norway and appearing in the file
 
9
** LICENSE.QPL included in the packaging of this file.
 
10
**
 
11
** This file may be distributed and/or modified under the terms of the
 
12
** GNU General Public License version 2 as published by the Free Software
 
13
** Foundation and appearing in the file LICENSE.GPL included in the
 
14
** packaging of this file.
 
15
**
 
16
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
 
17
**   information about Qt Commercial License Agreements.
 
18
** See http://www.trolltech.com/qpl/ for QPL licensing information.
 
19
** See http://www.trolltech.com/gpl/ for GPL licensing information.
 
20
**
 
21
** Contact info@trolltech.com if any conditions of this licensing are
 
22
** not clear to you.
 
23
**
 
24
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 
25
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 
26
**
 
27
****************************************************************************/
 
28
 
 
29
#ifndef QCOREEVENT_H
 
30
#define QCOREEVENT_H
 
31
 
 
32
#include <QtCore/qnamespace.h>
 
33
 
 
34
 
 
35
class QEventPrivate;
 
36
class Q_CORE_EXPORT QEvent           // event base class
 
37
{
 
38
    QDOC_PROPERTY(bool accepted READ isAccepted WRITE setAccepted)
 
39
public:
 
40
    enum Type {
 
41
        /*
 
42
          If you get a strange compiler error on the line with None,
 
43
          it's probably because you're also including X11 headers,
 
44
          which #define the symbol None. Put the X11 includes after
 
45
          the Qt includes to solve this problem.
 
46
        */
 
47
        None = 0,                               // invalid event
 
48
        Timer = 1,                              // timer event
 
49
        MouseButtonPress = 2,                   // mouse button pressed
 
50
        MouseButtonRelease = 3,                 // mouse button released
 
51
        MouseButtonDblClick = 4,                // mouse button double click
 
52
        MouseMove = 5,                          // mouse move
 
53
        KeyPress = 6,                           // key pressed
 
54
        KeyRelease = 7,                         // key released
 
55
        FocusIn = 8,                            // keyboard focus received
 
56
        FocusOut = 9,                           // keyboard focus lost
 
57
        Enter = 10,                             // mouse enters widget
 
58
        Leave = 11,                             // mouse leaves widget
 
59
        Paint = 12,                             // paint widget
 
60
        Move = 13,                              // move widget
 
61
        Resize = 14,                            // resize widget
 
62
        Create = 15,                            // after widget creation
 
63
        Destroy = 16,                           // during widget destruction
 
64
        Show = 17,                              // widget is shown
 
65
        Hide = 18,                              // widget is hidden
 
66
        Close = 19,                             // request to close widget
 
67
        Quit = 20,                              // request to quit application
 
68
        ParentChange = 21,                      // widget has been reparented
 
69
        ParentAboutToChange = 131,              // sent just before the parent change is done
 
70
#ifdef QT3_SUPPORT
 
71
        Reparent = ParentChange,
 
72
#endif
 
73
        ThreadChange = 22,                      // object has changed threads
 
74
        WindowActivate = 24,                    // window was activated
 
75
        WindowDeactivate = 25,                  // window was deactivated
 
76
        ShowToParent = 26,                      // widget is shown to parent
 
77
        HideToParent = 27,                      // widget is hidden to parent
 
78
        Wheel = 31,                             // wheel event
 
79
        WindowTitleChange = 33,                 // window title changed
 
80
        WindowIconChange = 34,                  // icon changed
 
81
        ApplicationWindowIconChange = 35,       // application icon changed
 
82
        ApplicationFontChange = 36,             // application font changed
 
83
        ApplicationLayoutDirectionChange = 37,  // application layout direction changed
 
84
        ApplicationPaletteChange = 38,          // application palette changed
 
85
        PaletteChange = 39,                     // widget palette changed
 
86
        Clipboard = 40,                         // internal clipboard event
 
87
        Speech = 42,                            // reserved for speech input
 
88
        MetaCall =  43,                         // meta call event
 
89
        SockAct = 50,                           // socket activation
 
90
        WinEventAct = 132,                      // win event activation
 
91
        DeferredDelete = 52,                    // deferred delete event
 
92
        DragEnter = 60,                         // drag moves into widget
 
93
        DragMove = 61,                          // drag moves in widget
 
94
        DragLeave = 62,                         // drag leaves or is cancelled
 
95
        Drop = 63,                              // actual drop
 
96
        DragResponse = 64,                      // drag accepted/rejected
 
97
        ChildAdded = 68,                        // new child widget
 
98
        ChildPolished = 69,                     // polished child widget
 
99
#ifdef QT3_SUPPORT
 
100
        ChildInserted = 70,                     // compatibility posted insert
 
101
        LayoutHint = 72,                        // compatibility relayout request
 
102
#endif
 
103
        ChildRemoved = 71,                      // deleted child widget
 
104
        ShowWindowRequest = 73,                 // widget's window should be mapped
 
105
        PolishRequest = 74,                     // widget should be polished
 
106
        Polish = 75,                            // widget is polished
 
107
        LayoutRequest = 76,                     // widget should be relayouted
 
108
        UpdateRequest = 77,                     // widget should be repainted
 
109
#ifdef Q_WS_QWS
 
110
        QWSUpdate = 78,
 
111
#endif
 
112
        EmbeddingControl = 79,                  // ActiveX embedding
 
113
        ActivateControl = 80,                   // ActiveX activation
 
114
        DeactivateControl = 81,                 // ActiveX deactivation
 
115
        ContextMenu = 82,                       // context popup menu
 
116
        InputMethod = 83,                       // input method
 
117
        AccessibilityPrepare = 86,              // accessibility information is requested
 
118
        TabletMove = 87,                        // Wacom tablet event
 
119
        LocaleChange = 88,                      // the system locale changed
 
120
        LanguageChange = 89,                    // the application language changed
 
121
        LayoutDirectionChange = 90,             // the layout direction changed
 
122
        Style = 91,                             // internal style event
 
123
        TabletPress = 92,                       // tablet press
 
124
        TabletRelease = 93,                     // tablet release
 
125
        OkRequest = 94,                         // CE (Ok) button pressed
 
126
        HelpRequest = 95,                       // CE (?)  button pressed
 
127
 
 
128
        IconDrag = 96,                          // proxy icon dragged
 
129
 
 
130
        FontChange = 97,                        // font has changed
 
131
        EnabledChange = 98,                     // enabled state has changed
 
132
        ActivationChange = 99,                  // window activation has changed
 
133
        StyleChange = 100,                      // style has changed
 
134
        IconTextChange = 101,                   // icon text has changed
 
135
        ModifiedChange = 102,                   // modified state has changed
 
136
        MouseTrackingChange = 109,              // mouse tracking state has changed
 
137
 
 
138
        WindowBlocked = 103,                    // window is about to be blocked modally
 
139
        WindowUnblocked = 104,                  // windows modal blocking has ended
 
140
        WindowStateChange = 105,
 
141
 
 
142
        ToolTip = 110,
 
143
        WhatsThis = 111,
 
144
        StatusTip = 112,
 
145
 
 
146
        ActionChanged = 113,
 
147
        ActionAdded = 114,
 
148
        ActionRemoved = 115,
 
149
 
 
150
        FileOpen = 116,                         // file open request
 
151
 
 
152
        Shortcut = 117,                         // shortcut triggered
 
153
        ShortcutOverride = 51,                  // shortcut override request
 
154
 
 
155
#ifdef QT3_SUPPORT
 
156
        Accel = 30,                             // accelerator event
 
157
        AccelAvailable = 32,                    // accelerator available event
 
158
        AccelOverride = ShortcutOverride,       // accelerator override event
 
159
#endif
 
160
 
 
161
        WhatsThisClicked = 118,
 
162
 
 
163
#ifdef QT3_SUPPORT
 
164
        CaptionChange = WindowTitleChange,
 
165
        IconChange = WindowIconChange,
 
166
#endif
 
167
        ToolBarChange = 120,                    // toolbar visibility toggled
 
168
 
 
169
        ApplicationActivated = 121,             // application has been changed to active
 
170
        ApplicationDeactivated = 122,           // application has been changed to inactive
 
171
 
 
172
        QueryWhatsThis = 123,                   // query what's this widget help
 
173
        EnterWhatsThisMode = 124,
 
174
        LeaveWhatsThisMode = 125,
 
175
 
 
176
        ZOrderChange = 126,                     // child widget has had its z-order changed
 
177
 
 
178
        HoverEnter = 127,                       // mouse cursor enters a hover widget
 
179
        HoverLeave = 128,                       // mouse cursor leaves a hover widget
 
180
        HoverMove = 129,                        // mouse cursor move inside a hover widget
 
181
 
 
182
        AccessibilityHelp = 119,                // accessibility help text request
 
183
        AccessibilityDescription = 130,         // accessibility description text request
 
184
 
 
185
        // last event id used = 132
 
186
 
 
187
        User = 1000,                            // first user event id
 
188
        MaxUser = 65535                         // last user event id
 
189
    };
 
190
 
 
191
    QEvent(Type type);
 
192
    virtual ~QEvent();
 
193
    inline Type type() const { return static_cast<Type>(t); }
 
194
    inline bool spontaneous() const { return spont; }
 
195
 
 
196
    inline void setAccepted(bool accepted) { m_accept = accepted; }
 
197
    inline bool isAccepted() const { return m_accept; }
 
198
 
 
199
    inline void accept() { m_accept = true; }
 
200
    inline void ignore() { m_accept = false; }
 
201
 
 
202
protected:
 
203
    QEventPrivate *d;
 
204
    ushort t;
 
205
 
 
206
private:
 
207
    ushort posted : 1;
 
208
    ushort spont : 1;
 
209
    ushort m_accept : 1;
 
210
    ushort reserved : 13;
 
211
 
 
212
    friend class QCoreApplication;
 
213
    friend class QCoreApplicationPrivate;
 
214
    friend class QThreadData;
 
215
    friend class QApplication;
 
216
    friend class QApplicationPrivate;
 
217
    friend class Q3AccelManager;
 
218
    friend class QShortcutMap;
 
219
    friend class QETWidget;
 
220
};
 
221
 
 
222
class Q_CORE_EXPORT QTimerEvent : public QEvent
 
223
{
 
224
public:
 
225
    QTimerEvent( int timerId );
 
226
    ~QTimerEvent();
 
227
    int timerId() const { return id; }
 
228
protected:
 
229
    int id;
 
230
};
 
231
 
 
232
class QObject;
 
233
 
 
234
class Q_CORE_EXPORT QChildEvent : public QEvent
 
235
{
 
236
public:
 
237
    QChildEvent( Type type, QObject *child );
 
238
    ~QChildEvent();
 
239
    QObject *child() const { return c; }
 
240
    bool added() const { return type() == ChildAdded; }
 
241
#ifdef QT3_SUPPORT
 
242
    QT3_SUPPORT bool inserted() const { return type() == ChildInserted; }
 
243
#endif
 
244
    bool polished() const { return type() == ChildPolished; }
 
245
    bool removed() const { return type() == ChildRemoved; }
 
246
protected:
 
247
    QObject *c;
 
248
};
 
249
 
 
250
#ifdef QT3_SUPPORT
 
251
class Q_CORE_EXPORT QCustomEvent : public QEvent
 
252
{
 
253
public:
 
254
    QT3_SUPPORT_CONSTRUCTOR QCustomEvent(int type, void *data = 0);
 
255
    ~QCustomEvent();
 
256
    QT3_SUPPORT void *data()  const { return d; }
 
257
    QT3_SUPPORT void setData(void* data) { d = reinterpret_cast<QEventPrivate *>(data); }
 
258
};
 
259
#endif
 
260
 
 
261
#endif // QCOREEVENT_H