Eneboo - Documentación para desarrolladores
|
00001 /**************************************************************************** 00002 ** $Id: qt/qeventloop.h 3.3.8 edited Jan 11 14:38 $ 00003 ** 00004 ** Declaration of QEventLoop class 00005 ** 00006 ** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved. 00007 ** 00008 ** This file is part of the kernel module of the Qt GUI Toolkit. 00009 ** 00010 ** This file may be distributed under the terms of the Q Public License 00011 ** as defined by Trolltech ASA of Norway and appearing in the file 00012 ** LICENSE.QPL included in the packaging of this file. 00013 ** 00014 ** This file may be distributed and/or modified under the terms of the 00015 ** GNU General Public License version 2 as published by the Free Software 00016 ** Foundation and appearing in the file LICENSE.GPL included in the 00017 ** packaging of this file. 00018 ** 00019 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition 00020 ** licenses may use this file in accordance with the Qt Commercial License 00021 ** Agreement provided with the Software. 00022 ** 00023 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00024 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00025 ** 00026 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for 00027 ** information about Qt Commercial License Agreements. 00028 ** See http://www.trolltech.com/qpl/ for QPL licensing information. 00029 ** See http://www.trolltech.com/gpl/ for GPL licensing information. 00030 ** 00031 ** Contact info@trolltech.com if any conditions of this licensing are 00032 ** not clear to you. 00033 ** 00034 **********************************************************************/ 00035 00036 #ifndef QEVENTLOOP_H 00037 #define QEVENTLOOP_H 00038 00039 #ifndef QT_H 00040 #include "qobject.h" 00041 #include "qsocketnotifier.h" 00042 #endif // QT_H 00043 00044 class QEventLoopPrivate; 00045 class QSocketNotifier; 00046 class QTimer; 00047 #ifdef Q_WS_MAC 00048 struct timeval; //stdc struct 00049 struct TimerInfo; //internal structure (qeventloop_mac.cpp) 00050 #endif 00051 00052 #if defined(QT_THREAD_SUPPORT) 00053 class QMutex; 00054 #endif // QT_THREAD_SUPPORT 00055 00056 00057 class Q_EXPORT QEventLoop : public QObject 00058 { 00059 Q_OBJECT 00060 00061 public: 00062 QEventLoop( QObject *parent = 0, const char *name = 0 ); 00063 ~QEventLoop(); 00064 00065 enum ProcessEvents { 00066 AllEvents = 0x00, 00067 ExcludeUserInput = 0x01, 00068 ExcludeSocketNotifiers = 0x02, 00069 WaitForMore = 0x04, 00070 EventLoopExec = 0x20 00071 }; 00072 typedef uint ProcessEventsFlags; 00073 00074 void processEvents( ProcessEventsFlags flags, int maxtime ); 00075 virtual bool processEvents( ProcessEventsFlags flags ); 00076 00077 virtual bool hasPendingEvents() const; 00078 00079 virtual void registerSocketNotifier( QSocketNotifier * ); 00080 virtual void unregisterSocketNotifier( QSocketNotifier * ); 00081 void setSocketNotifierPending( QSocketNotifier * ); 00082 int activateSocketNotifiers(); 00083 00084 int activateTimers(); 00085 int timeToWait() const; 00086 00087 virtual int exec(); 00088 virtual void exit( int retcode = 0 ); 00089 00090 virtual int enterLoop(); 00091 virtual void exitLoop(); 00092 virtual int loopLevel() const; 00093 00094 virtual void wakeUp(); 00095 00096 signals: 00097 void awake(); 00098 void aboutToBlock(); 00099 00100 private: 00101 #if defined(Q_WS_MAC) 00102 friend QMAC_PASCAL void qt_mac_select_timer_callbk(EventLoopTimerRef, void *); 00103 int macHandleSelect(timeval *); 00104 void macHandleTimer(TimerInfo *); 00105 #endif // Q_WS_MAC 00106 00107 // internal initialization/cleanup - implemented in various platform specific files 00108 void init(); 00109 void cleanup(); 00110 virtual void appStartingUp(); 00111 virtual void appClosingDown(); 00112 00113 // data for the default implementation - other implementations should not 00114 // use/need this data 00115 QEventLoopPrivate *d; 00116 00117 friend class QApplication; 00118 }; 00119 00120 #endif // QEVENTLOOP_H