src/corelib/kernel/qcoreevent.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 **
00003 ** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.
00004 **
00005 ** This file is part of the QtCore module of the Qt Toolkit.
00006 **
00007 ** This file may be used under the terms of the GNU General Public
00008 ** License version 2.0 as published by the Free Software Foundation
00009 ** and appearing in the file LICENSE.GPL included in the packaging of
00010 ** this file.  Please review the following information to ensure GNU
00011 ** General Public Licensing requirements will be met:
00012 ** http://www.trolltech.com/products/qt/opensource.html
00013 **
00014 ** If you are unsure which license is appropriate for your use, please
00015 ** review the following information:
00016 ** http://www.trolltech.com/products/qt/licensing.html or contact the
00017 ** sales department at sales@trolltech.com.
00018 **
00019 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00020 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00021 **
00022 ****************************************************************************/
00023 
00024 #ifndef QCOREEVENT_H
00025 #define QCOREEVENT_H
00026 
00027 #include <QtCore/qnamespace.h>
00028 #include <QtCore/qbytearray.h>
00029 
00030 QT_BEGIN_HEADER
00031 
00032 QT_MODULE(Core)
00033 
00034 class QEventPrivate;
00035 class Q_CORE_EXPORT QEvent           // event base class
00036 {
00037     QDOC_PROPERTY(bool accepted READ isAccepted WRITE setAccepted)
00038 public:
00039     enum Type {
00040         /*
00041           If you get a strange compiler error on the line with None,
00042           it's probably because you're also including X11 headers,
00043           which #define the symbol None. Put the X11 includes after
00044           the Qt includes to solve this problem.
00045         */
00046         None = 0,                               // invalid event
00047         Timer = 1,                              // timer event
00048         MouseButtonPress = 2,                   // mouse button pressed
00049         MouseButtonRelease = 3,                 // mouse button released
00050         MouseButtonDblClick = 4,                // mouse button double click
00051         MouseMove = 5,                          // mouse move
00052         KeyPress = 6,                           // key pressed
00053         KeyRelease = 7,                         // key released
00054         FocusIn = 8,                            // keyboard focus received
00055         FocusOut = 9,                           // keyboard focus lost
00056         Enter = 10,                             // mouse enters widget
00057         Leave = 11,                             // mouse leaves widget
00058         Paint = 12,                             // paint widget
00059         Move = 13,                              // move widget
00060         Resize = 14,                            // resize widget
00061         Create = 15,                            // after widget creation
00062         Destroy = 16,                           // during widget destruction
00063         Show = 17,                              // widget is shown
00064         Hide = 18,                              // widget is hidden
00065         Close = 19,                             // request to close widget
00066         Quit = 20,                              // request to quit application
00067         ParentChange = 21,                      // widget has been reparented
00068         ParentAboutToChange = 131,              // sent just before the parent change is done
00069 #ifdef QT3_SUPPORT
00070         Reparent = ParentChange,
00071 #endif
00072         ThreadChange = 22,                      // object has changed threads
00073         WindowActivate = 24,                    // window was activated
00074         WindowDeactivate = 25,                  // window was deactivated
00075         ShowToParent = 26,                      // widget is shown to parent
00076         HideToParent = 27,                      // widget is hidden to parent
00077         Wheel = 31,                             // wheel event
00078         WindowTitleChange = 33,                 // window title changed
00079         WindowIconChange = 34,                  // icon changed
00080         ApplicationWindowIconChange = 35,       // application icon changed
00081         ApplicationFontChange = 36,             // application font changed
00082         ApplicationLayoutDirectionChange = 37,  // application layout direction changed
00083         ApplicationPaletteChange = 38,          // application palette changed
00084         PaletteChange = 39,                     // widget palette changed
00085         Clipboard = 40,                         // internal clipboard event
00086         Speech = 42,                            // reserved for speech input
00087         MetaCall =  43,                         // meta call event
00088         SockAct = 50,                           // socket activation
00089         WinEventAct = 132,                      // win event activation
00090         DeferredDelete = 52,                    // deferred delete event
00091         DragEnter = 60,                         // drag moves into widget
00092         DragMove = 61,                          // drag moves in widget
00093         DragLeave = 62,                         // drag leaves or is cancelled
00094         Drop = 63,                              // actual drop
00095         DragResponse = 64,                      // drag accepted/rejected
00096         ChildAdded = 68,                        // new child widget
00097         ChildPolished = 69,                     // polished child widget
00098 #ifdef QT3_SUPPORT
00099         ChildInserted = 70,                     // compatibility posted insert
00100         LayoutHint = 72,                        // compatibility relayout request
00101 #endif
00102         ChildRemoved = 71,                      // deleted child widget
00103         ShowWindowRequest = 73,                 // widget's window should be mapped
00104         PolishRequest = 74,                     // widget should be polished
00105         Polish = 75,                            // widget is polished
00106         LayoutRequest = 76,                     // widget should be relayouted
00107         UpdateRequest = 77,                     // widget should be repainted
00108         UpdateLater = 78,                       // request update() later
00109 
00110         EmbeddingControl = 79,                  // ActiveX embedding
00111         ActivateControl = 80,                   // ActiveX activation
00112         DeactivateControl = 81,                 // ActiveX deactivation
00113         ContextMenu = 82,                       // context popup menu
00114         InputMethod = 83,                       // input method
00115         AccessibilityPrepare = 86,              // accessibility information is requested
00116         TabletMove = 87,                        // Wacom tablet event
00117         LocaleChange = 88,                      // the system locale changed
00118         LanguageChange = 89,                    // the application language changed
00119         LayoutDirectionChange = 90,             // the layout direction changed
00120         Style = 91,                             // internal style event
00121         TabletPress = 92,                       // tablet press
00122         TabletRelease = 93,                     // tablet release
00123         OkRequest = 94,                         // CE (Ok) button pressed
00124         HelpRequest = 95,                       // CE (?)  button pressed
00125 
00126         IconDrag = 96,                          // proxy icon dragged
00127 
00128         FontChange = 97,                        // font has changed
00129         EnabledChange = 98,                     // enabled state has changed
00130         ActivationChange = 99,                  // window activation has changed
00131         StyleChange = 100,                      // style has changed
00132         IconTextChange = 101,                   // icon text has changed
00133         ModifiedChange = 102,                   // modified state has changed
00134         MouseTrackingChange = 109,              // mouse tracking state has changed
00135 
00136         WindowBlocked = 103,                    // window is about to be blocked modally
00137         WindowUnblocked = 104,                  // windows modal blocking has ended
00138         WindowStateChange = 105,
00139 
00140         ToolTip = 110,
00141         WhatsThis = 111,
00142         StatusTip = 112,
00143 
00144         ActionChanged = 113,
00145         ActionAdded = 114,
00146         ActionRemoved = 115,
00147 
00148         FileOpen = 116,                         // file open request
00149 
00150         Shortcut = 117,                         // shortcut triggered
00151         ShortcutOverride = 51,                  // shortcut override request
00152 
00153 #ifdef QT3_SUPPORT
00154         Accel = 30,                             // accelerator event
00155         AccelAvailable = 32,                    // accelerator available event
00156         AccelOverride = ShortcutOverride,       // accelerator override event
00157 #endif
00158 
00159         WhatsThisClicked = 118,
00160 
00161 #ifdef QT3_SUPPORT
00162         CaptionChange = WindowTitleChange,
00163         IconChange = WindowIconChange,
00164 #endif
00165         ToolBarChange = 120,                    // toolbar visibility toggled
00166 
00167         ApplicationActivated = 121,             // application has been changed to active
00168         ApplicationDeactivated = 122,           // application has been changed to inactive
00169 
00170         QueryWhatsThis = 123,                   // query what's this widget help
00171         EnterWhatsThisMode = 124,
00172         LeaveWhatsThisMode = 125,
00173 
00174         ZOrderChange = 126,                     // child widget has had its z-order changed
00175 
00176         HoverEnter = 127,                       // mouse cursor enters a hover widget
00177         HoverLeave = 128,                       // mouse cursor leaves a hover widget
00178         HoverMove = 129,                        // mouse cursor move inside a hover widget
00179 
00180         AccessibilityHelp = 119,                // accessibility help text request
00181         AccessibilityDescription = 130,         // accessibility description text request
00182 
00183         // last event id used = 132
00184 
00185 #ifdef QT_KEYPAD_NAVIGATION
00186         EnterEditFocus = 150,                   // enter edit mode in keypad navigation
00187         LeaveEditFocus = 151,                   // enter edit mode in keypad navigation
00188 #endif
00189         AcceptDropsChange = 152,
00190 
00191         MenubarUpdated = 153,                    // Support event for Q3MainWindow, which needs to
00192                                                  // knwow when QMenubar is updated.
00193 
00194         ZeroTimerEvent = 154,                   // Used for Windows Zero timer events
00195 
00196         GraphicsSceneMouseMove = 155,           // GraphicsView
00197         GraphicsSceneMousePress = 156,
00198         GraphicsSceneMouseRelease = 157,
00199         GraphicsSceneMouseDoubleClick = 158,
00200         GraphicsSceneContextMenu = 159,
00201         GraphicsSceneHoverEnter = 160,
00202         GraphicsSceneHoverMove = 161,
00203         GraphicsSceneHoverLeave = 162,
00204         GraphicsSceneHelp = 163,
00205         GraphicsSceneDragEnter = 164,
00206         GraphicsSceneDragMove = 165,
00207         GraphicsSceneDragLeave = 166,
00208         GraphicsSceneDrop = 167,
00209         GraphicsSceneWheel = 168,
00210 
00211         KeyboardLayoutChange = 169,             // keyboard layout changed
00212 
00213         DynamicPropertyChange = 170,            // A dynamic property was changed through setProperty/property
00214 
00215         TabletEnterProximity = 171,
00216         TabletLeaveProximity = 172,
00217         User = 1000,                            // first user event id
00218         MaxUser = 65535                         // last user event id
00219     };
00220 
00221     QEvent(Type type);
00222     virtual ~QEvent();
00223     inline Type type() const { return static_cast<Type>(t); }
00224     inline bool spontaneous() const { return spont; }
00225 
00226     inline void setAccepted(bool accepted) { m_accept = accepted; }
00227     inline bool isAccepted() const { return m_accept; }
00228 
00229     inline void accept() { m_accept = true; }
00230     inline void ignore() { m_accept = false; }
00231 
00232 protected:
00233     QEventPrivate *d;
00234     ushort t;
00235 
00236 private:
00237     ushort posted : 1;
00238     ushort spont : 1;
00239     ushort m_accept : 1;
00240     ushort reserved : 13;
00241 
00242     friend class QCoreApplication;
00243     friend class QCoreApplicationPrivate;
00244     friend class QThreadData;
00245     friend class QApplication;
00246     friend class QApplicationPrivate;
00247     friend class Q3AccelManager;
00248     friend class QShortcutMap;
00249     friend class QETWidget;
00250 };
00251 
00252 class Q_CORE_EXPORT QTimerEvent : public QEvent
00253 {
00254 public:
00255     QTimerEvent( int timerId );
00256     ~QTimerEvent();
00257     int timerId() const { return id; }
00258 protected:
00259     int id;
00260 };
00261 
00262 class QObject;
00263 
00264 class Q_CORE_EXPORT QChildEvent : public QEvent
00265 {
00266 public:
00267     QChildEvent( Type type, QObject *child );
00268     ~QChildEvent();
00269     QObject *child() const { return c; }
00270     bool added() const { return type() == ChildAdded; }
00271 #ifdef QT3_SUPPORT
00272     QT3_SUPPORT bool inserted() const { return type() == ChildInserted; }
00273 #endif
00274     bool polished() const { return type() == ChildPolished; }
00275     bool removed() const { return type() == ChildRemoved; }
00276 protected:
00277     QObject *c;
00278 };
00279 
00280 #ifdef QT3_SUPPORT
00281 class Q_CORE_EXPORT QCustomEvent : public QEvent
00282 {
00283 public:
00284     QT3_SUPPORT_CONSTRUCTOR QCustomEvent(int type, void *data = 0);
00285     ~QCustomEvent();
00286     QT3_SUPPORT void *data()  const { return d; }
00287     QT3_SUPPORT void setData(void* data) { d = reinterpret_cast<QEventPrivate *>(data); }
00288 };
00289 #endif
00290 
00291 class Q_CORE_EXPORT QDynamicPropertyChangeEvent : public QEvent
00292 {
00293 public:
00294     QDynamicPropertyChangeEvent(const QByteArray &name);
00295     ~QDynamicPropertyChangeEvent();
00296 
00297     inline QByteArray propertyName() const { return n; }
00298 
00299 private:
00300     QByteArray n;
00301 };
00302 
00303 QT_END_HEADER
00304 
00305 #endif // QCOREEVENT_H

Generated on Thu Mar 15 11:53:25 2007 for Qt 4.2 User's Guide by  doxygen 1.5.1