qcoreevent.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 **
00003 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
00004 ** All rights reserved.
00005 ** Contact: Nokia Corporation (qt-info@nokia.com)
00006 **
00007 ** This file is part of the QtCore module of the Qt Toolkit.
00008 **
00009 ** $QT_BEGIN_LICENSE:LGPL$
00010 ** Commercial Usage
00011 ** Licensees holding valid Qt Commercial licenses may use this file in
00012 ** accordance with the Qt Commercial License Agreement provided with the
00013 ** Software or, alternatively, in accordance with the terms contained in
00014 ** a written agreement between you and Nokia.
00015 **
00016 ** GNU Lesser General Public License Usage
00017 ** Alternatively, this file may be used under the terms of the GNU Lesser
00018 ** General Public License version 2.1 as published by the Free Software
00019 ** Foundation and appearing in the file LICENSE.LGPL included in the
00020 ** packaging of this file.  Please review the following information to
00021 ** ensure the GNU Lesser General Public License version 2.1 requirements
00022 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
00023 **
00024 ** In addition, as a special exception, Nokia gives you certain additional
00025 ** rights.  These rights are described in the Nokia Qt LGPL Exception
00026 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this module.
00027 **
00028 ** GNU General Public License Usage
00029 ** Alternatively, this file may be used under the terms of the GNU
00030 ** General Public License version 3.0 as published by the Free Software
00031 ** Foundation and appearing in the file LICENSE.GPL included in the
00032 ** packaging of this file.  Please review the following information to
00033 ** ensure the GNU General Public License version 3.0 requirements will be
00034 ** met: http://www.gnu.org/copyleft/gpl.html.
00035 **
00036 ** If you have questions regarding the use of this file, please contact
00037 ** Nokia at qt-info@nokia.com.
00038 ** $QT_END_LICENSE$
00039 **
00040 ****************************************************************************/
00041 
00042 #ifndef QCOREEVENT_H
00043 #define QCOREEVENT_H
00044 
00045 #include <QtCore/qnamespace.h>
00046 #include <QtCore/qbytearray.h>
00047 #include <QtCore/qobjectdefs.h>
00048 
00049 QT_BEGIN_HEADER
00050 
00051 QT_BEGIN_NAMESPACE
00052 
00053 QT_MODULE(Core)
00054 
00055 class QEventPrivate;
00056 class Q_CORE_EXPORT QEvent           // event base class
00057 {
00058     Q_GADGET
00059     QDOC_PROPERTY(bool accepted READ isAccepted WRITE setAccepted)
00060     Q_ENUMS(Type)
00061 public:
00062     enum Type {
00063         /*
00064           If you get a strange compiler error on the line with None,
00065           it's probably because you're also including X11 headers,
00066           which #define the symbol None. Put the X11 includes after
00067           the Qt includes to solve this problem.
00068         */
00069         None = 0,                               // invalid event
00070         Timer = 1,                              // timer event
00071         MouseButtonPress = 2,                   // mouse button pressed
00072         MouseButtonRelease = 3,                 // mouse button released
00073         MouseButtonDblClick = 4,                // mouse button double click
00074         MouseMove = 5,                          // mouse move
00075         KeyPress = 6,                           // key pressed
00076         KeyRelease = 7,                         // key released
00077         FocusIn = 8,                            // keyboard focus received
00078         FocusOut = 9,                           // keyboard focus lost
00079         Enter = 10,                             // mouse enters widget
00080         Leave = 11,                             // mouse leaves widget
00081         Paint = 12,                             // paint widget
00082         Move = 13,                              // move widget
00083         Resize = 14,                            // resize widget
00084         Create = 15,                            // after widget creation
00085         Destroy = 16,                           // during widget destruction
00086         Show = 17,                              // widget is shown
00087         Hide = 18,                              // widget is hidden
00088         Close = 19,                             // request to close widget
00089         Quit = 20,                              // request to quit application
00090         ParentChange = 21,                      // widget has been reparented
00091         ParentAboutToChange = 131,              // sent just before the parent change is done
00092 #ifdef QT3_SUPPORT
00093         Reparent = ParentChange,
00094 #endif
00095         ThreadChange = 22,                      // object has changed threads
00096         WindowActivate = 24,                    // window was activated
00097         WindowDeactivate = 25,                  // window was deactivated
00098         ShowToParent = 26,                      // widget is shown to parent
00099         HideToParent = 27,                      // widget is hidden to parent
00100         Wheel = 31,                             // wheel event
00101         WindowTitleChange = 33,                 // window title changed
00102         WindowIconChange = 34,                  // icon changed
00103         ApplicationWindowIconChange = 35,       // application icon changed
00104         ApplicationFontChange = 36,             // application font changed
00105         ApplicationLayoutDirectionChange = 37,  // application layout direction changed
00106         ApplicationPaletteChange = 38,          // application palette changed
00107         PaletteChange = 39,                     // widget palette changed
00108         Clipboard = 40,                         // internal clipboard event
00109         Speech = 42,                            // reserved for speech input
00110         MetaCall =  43,                         // meta call event
00111         SockAct = 50,                           // socket activation
00112         WinEventAct = 132,                      // win event activation
00113         DeferredDelete = 52,                    // deferred delete event
00114         DragEnter = 60,                         // drag moves into widget
00115         DragMove = 61,                          // drag moves in widget
00116         DragLeave = 62,                         // drag leaves or is cancelled
00117         Drop = 63,                              // actual drop
00118         DragResponse = 64,                      // drag accepted/rejected
00119         ChildAdded = 68,                        // new child widget
00120         ChildPolished = 69,                     // polished child widget
00121 #ifdef QT3_SUPPORT
00122         ChildInsertedRequest = 67,              // send ChildInserted compatibility events to receiver
00123         ChildInserted = 70,                     // compatibility child inserted
00124         LayoutHint = 72,                        // compatibility relayout request
00125 #endif
00126         ChildRemoved = 71,                      // deleted child widget
00127         ShowWindowRequest = 73,                 // widget's window should be mapped
00128         PolishRequest = 74,                     // widget should be polished
00129         Polish = 75,                            // widget is polished
00130         LayoutRequest = 76,                     // widget should be relayouted
00131         UpdateRequest = 77,                     // widget should be repainted
00132         UpdateLater = 78,                       // request update() later
00133 
00134         EmbeddingControl = 79,                  // ActiveX embedding
00135         ActivateControl = 80,                   // ActiveX activation
00136         DeactivateControl = 81,                 // ActiveX deactivation
00137         ContextMenu = 82,                       // context popup menu
00138         InputMethod = 83,                       // input method
00139         AccessibilityPrepare = 86,              // accessibility information is requested
00140         TabletMove = 87,                        // Wacom tablet event
00141         LocaleChange = 88,                      // the system locale changed
00142         LanguageChange = 89,                    // the application language changed
00143         LayoutDirectionChange = 90,             // the layout direction changed
00144         Style = 91,                             // internal style event
00145         TabletPress = 92,                       // tablet press
00146         TabletRelease = 93,                     // tablet release
00147         OkRequest = 94,                         // CE (Ok) button pressed
00148         HelpRequest = 95,                       // CE (?)  button pressed
00149 
00150         IconDrag = 96,                          // proxy icon dragged
00151 
00152         FontChange = 97,                        // font has changed
00153         EnabledChange = 98,                     // enabled state has changed
00154         ActivationChange = 99,                  // window activation has changed
00155         StyleChange = 100,                      // style has changed
00156         IconTextChange = 101,                   // icon text has changed
00157         ModifiedChange = 102,                   // modified state has changed
00158         MouseTrackingChange = 109,              // mouse tracking state has changed
00159 
00160         WindowBlocked = 103,                    // window is about to be blocked modally
00161         WindowUnblocked = 104,                  // windows modal blocking has ended
00162         WindowStateChange = 105,
00163 
00164         ToolTip = 110,
00165         WhatsThis = 111,
00166         StatusTip = 112,
00167 
00168         ActionChanged = 113,
00169         ActionAdded = 114,
00170         ActionRemoved = 115,
00171 
00172         FileOpen = 116,                         // file open request
00173 
00174         Shortcut = 117,                         // shortcut triggered
00175         ShortcutOverride = 51,                  // shortcut override request
00176 
00177 #ifdef QT3_SUPPORT
00178         Accel = 30,                             // accelerator event
00179         AccelAvailable = 32,                    // accelerator available event
00180         AccelOverride = ShortcutOverride,       // accelerator override event
00181 #endif
00182 
00183         WhatsThisClicked = 118,
00184 
00185 #ifdef QT3_SUPPORT
00186         CaptionChange = WindowTitleChange,
00187         IconChange = WindowIconChange,
00188 #endif
00189         ToolBarChange = 120,                    // toolbar visibility toggled
00190 
00191         ApplicationActivate = 121,              // application has been changed to active
00192         ApplicationActivated = ApplicationActivate, // deprecated
00193         ApplicationDeactivate = 122,            // application has been changed to inactive
00194         ApplicationDeactivated = ApplicationDeactivate, // deprecated
00195 
00196         QueryWhatsThis = 123,                   // query what's this widget help
00197         EnterWhatsThisMode = 124,
00198         LeaveWhatsThisMode = 125,
00199 
00200         ZOrderChange = 126,                     // child widget has had its z-order changed
00201 
00202         HoverEnter = 127,                       // mouse cursor enters a hover widget
00203         HoverLeave = 128,                       // mouse cursor leaves a hover widget
00204         HoverMove = 129,                        // mouse cursor move inside a hover widget
00205 
00206         AccessibilityHelp = 119,                // accessibility help text request
00207         AccessibilityDescription = 130,         // accessibility description text request
00208 
00209         // last event id used = 132
00210 
00211 #ifdef QT_KEYPAD_NAVIGATION
00212         EnterEditFocus = 150,                   // enter edit mode in keypad navigation
00213         LeaveEditFocus = 151,                   // enter edit mode in keypad navigation
00214 #endif
00215         AcceptDropsChange = 152,
00216 
00217         MenubarUpdated = 153,                    // Support event for Q3MainWindow, which needs to
00218                                                  // knwow when QMenubar is updated.
00219 
00220         ZeroTimerEvent = 154,                   // Used for Windows Zero timer events
00221 
00222         GraphicsSceneMouseMove = 155,           // GraphicsView
00223         GraphicsSceneMousePress = 156,
00224         GraphicsSceneMouseRelease = 157,
00225         GraphicsSceneMouseDoubleClick = 158,
00226         GraphicsSceneContextMenu = 159,
00227         GraphicsSceneHoverEnter = 160,
00228         GraphicsSceneHoverMove = 161,
00229         GraphicsSceneHoverLeave = 162,
00230         GraphicsSceneHelp = 163,
00231         GraphicsSceneDragEnter = 164,
00232         GraphicsSceneDragMove = 165,
00233         GraphicsSceneDragLeave = 166,
00234         GraphicsSceneDrop = 167,
00235         GraphicsSceneWheel = 168,
00236 
00237         KeyboardLayoutChange = 169,             // keyboard layout changed
00238 
00239         DynamicPropertyChange = 170,            // A dynamic property was changed through setProperty/property
00240 
00241         TabletEnterProximity = 171,
00242         TabletLeaveProximity = 172,
00243 
00244         NonClientAreaMouseMove = 173,
00245         NonClientAreaMouseButtonPress = 174,
00246         NonClientAreaMouseButtonRelease = 175,
00247         NonClientAreaMouseButtonDblClick = 176,
00248 
00249         MacSizeChange = 177,                    // when the Qt::WA_Mac{Normal,Small,Mini}Size changes
00250 
00251         ContentsRectChange = 178,               // sent by QWidget::setContentsMargins (internal)
00252 
00253         MacGLWindowChange = 179,                // Internal! the window of the GLWidget has changed
00254 
00255         FutureCallOut = 180,
00256 
00257         GraphicsSceneResize  = 181,
00258         GraphicsSceneMove  = 182,
00259 
00260         CursorChange = 183,
00261         ToolTipChange = 184,
00262 
00263         NetworkReplyUpdated = 185,              // Internal for QNetworkReply
00264 
00265         GrabMouse = 186,
00266         UngrabMouse = 187,
00267         GrabKeyboard = 188,
00268         UngrabKeyboard = 189,
00269         MacGLClearDrawable = 191,               // Internal Cocoa, the window has changed, so we must clear
00270 
00271         StateMachineSignal = 192,
00272         StateMachineWrapped = 193,
00273 
00274         TouchBegin = 194,
00275         TouchUpdate = 195,
00276         TouchEnd = 196,
00277 
00278 #ifndef QT_NO_GESTURES
00279         NativeGesture = 197,                    // Internal for platform gesture support
00280 #endif
00281         RequestSoftwareInputPanel = 199,
00282         CloseSoftwareInputPanel = 200,
00283 
00284         UpdateSoftKeys = 201,                   // Internal for compressing soft key updates
00285 
00286         WinIdChange = 203,
00287 #ifndef QT_NO_GESTURES
00288         Gesture = 198,
00289         GestureOverride = 202,
00290 #endif
00291         // 512 reserved for Qt Jambi's MetaCall event
00292         // 513 reserved for Qt Jambi's DeleteOnMainThread event
00293 
00294         User = 1000,                            // first user event id
00295         MaxUser = 65535                         // last user event id
00296     };
00297 
00298     QEvent(Type type);
00299     virtual ~QEvent();
00300     inline Type type() const { return static_cast<Type>(t); }
00301     inline bool spontaneous() const { return spont; }
00302 
00303     inline void setAccepted(bool accepted) { m_accept = accepted; }
00304     inline bool isAccepted() const { return m_accept; }
00305 
00306     inline void accept() { m_accept = true; }
00307     inline void ignore() { m_accept = false; }
00308 
00309     static int registerEventType(int hint = -1);
00310 
00311 protected:
00312     QEventPrivate *d;
00313     ushort t;
00314 
00315 private:
00316     ushort posted : 1;
00317     ushort spont : 1;
00318     ushort m_accept : 1;
00319     ushort reserved : 13;
00320 
00321     friend class QCoreApplication;
00322     friend class QCoreApplicationPrivate;
00323     friend class QThreadData;
00324     friend class QApplication;
00325     friend class QApplicationPrivate;
00326     friend class Q3AccelManager;
00327     friend class QShortcutMap;
00328     friend class QETWidget;
00329     friend class QGraphicsView;
00330     friend class QGraphicsViewPrivate;
00331     friend class QGraphicsScenePrivate;
00332 #ifndef QT_NO_GESTURES
00333     friend class QGestureManager;
00334 #endif
00335 };
00336 
00337 class Q_CORE_EXPORT QTimerEvent : public QEvent
00338 {
00339 public:
00340     QTimerEvent( int timerId );
00341     ~QTimerEvent();
00342     int timerId() const { return id; }
00343 protected:
00344     int id;
00345 };
00346 
00347 class QObject;
00348 
00349 class Q_CORE_EXPORT QChildEvent : public QEvent
00350 {
00351 public:
00352     QChildEvent( Type type, QObject *child );
00353     ~QChildEvent();
00354     QObject *child() const { return c; }
00355     bool added() const { return type() == ChildAdded; }
00356 #ifdef QT3_SUPPORT
00357     QT3_SUPPORT bool inserted() const { return type() == ChildInserted; }
00358 #endif
00359     bool polished() const { return type() == ChildPolished; }
00360     bool removed() const { return type() == ChildRemoved; }
00361 protected:
00362     QObject *c;
00363 };
00364 
00365 #ifdef QT3_SUPPORT
00366 class Q_CORE_EXPORT QCustomEvent : public QEvent
00367 {
00368 public:
00369     QT3_SUPPORT_CONSTRUCTOR QCustomEvent(int type, void *data = 0);
00370     ~QCustomEvent();
00371     QT3_SUPPORT void *data()  const { return d; }
00372     QT3_SUPPORT void setData(void* aData) { d = reinterpret_cast<QEventPrivate *>(aData); }
00373 };
00374 #endif
00375 
00376 class Q_CORE_EXPORT QDynamicPropertyChangeEvent : public QEvent
00377 {
00378 public:
00379     QDynamicPropertyChangeEvent(const QByteArray &name);
00380     ~QDynamicPropertyChangeEvent();
00381 
00382     inline QByteArray propertyName() const { return n; }
00383 
00384 private:
00385     QByteArray n;
00386 };
00387 
00388 QT_END_NAMESPACE
00389 
00390 QT_END_HEADER
00391 
00392 #endif // QCOREEVENT_H