source: trunk/include/qeventloop.h@ 25

Last change on this file since 25 was 2, checked in by dmik, 20 years ago

Imported xplatform parts of the official release 3.3.1 from Trolltech

  • Property svn:keywords set to Id
File size: 3.5 KB
Line 
1/****************************************************************************
2** $Id: qeventloop.h 2 2005-11-16 15:49:26Z dmik $
3**
4** Declaration of QEventLoop class
5**
6** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
7**
8** This file is part of the kernel module of the Qt GUI Toolkit.
9**
10** This file may be distributed under the terms of the Q Public License
11** as defined by Trolltech AS of Norway and appearing in the file
12** LICENSE.QPL included in the packaging of this file.
13**
14** This file may be distributed and/or modified under the terms of the
15** GNU General Public License version 2 as published by the Free Software
16** Foundation and appearing in the file LICENSE.GPL included in the
17** packaging of this file.
18**
19** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
20** licenses may use this file in accordance with the Qt Commercial License
21** Agreement provided with the Software.
22**
23** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
24** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
25**
26** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
27** information about Qt Commercial License Agreements.
28** See http://www.trolltech.com/qpl/ for QPL licensing information.
29** See http://www.trolltech.com/gpl/ for GPL licensing information.
30**
31** Contact info@trolltech.com if any conditions of this licensing are
32** not clear to you.
33**
34**********************************************************************/
35
36#ifndef QEVENTLOOP_H
37#define QEVENTLOOP_H
38
39#ifndef QT_H
40#include "qobject.h"
41#include "qsocketnotifier.h"
42#endif // QT_H
43
44class QEventLoopPrivate;
45class QSocketNotifier;
46class QTimer;
47#ifdef Q_WS_MAC
48struct timeval; //stdc struct
49struct TimerInfo; //internal structure (qeventloop_mac.cpp)
50#endif
51
52#if defined(QT_THREAD_SUPPORT)
53class QMutex;
54#endif // QT_THREAD_SUPPORT
55
56
57class Q_EXPORT QEventLoop : public QObject
58{
59 Q_OBJECT
60
61public:
62 QEventLoop( QObject *parent = 0, const char *name = 0 );
63 ~QEventLoop();
64
65 enum ProcessEvents {
66 AllEvents = 0x00,
67 ExcludeUserInput = 0x01,
68 ExcludeSocketNotifiers = 0x02,
69 WaitForMore = 0x04
70 };
71 typedef uint ProcessEventsFlags;
72
73 void processEvents( ProcessEventsFlags flags, int maxtime );
74 virtual bool processEvents( ProcessEventsFlags flags );
75
76 virtual bool hasPendingEvents() const;
77
78 virtual void registerSocketNotifier( QSocketNotifier * );
79 virtual void unregisterSocketNotifier( QSocketNotifier * );
80 void setSocketNotifierPending( QSocketNotifier * );
81 int activateSocketNotifiers();
82
83 int activateTimers();
84 int timeToWait() const;
85
86 virtual int exec();
87 virtual void exit( int retcode = 0 );
88
89 virtual int enterLoop();
90 virtual void exitLoop();
91 virtual int loopLevel() const;
92
93 virtual void wakeUp();
94
95signals:
96 void awake();
97 void aboutToBlock();
98
99private:
100#if defined(Q_WS_MAC)
101 friend QMAC_PASCAL void qt_mac_select_timer_callbk(EventLoopTimerRef, void *);
102 int macHandleSelect(timeval *);
103 void macHandleTimer(TimerInfo *);
104#endif // Q_WS_MAC
105
106 // internal initialization/cleanup - implemented in various platform specific files
107 void init();
108 void cleanup();
109 virtual void appStartingUp();
110 virtual void appClosingDown();
111
112 // data for the default implementation - other implementations should not
113 // use/need this data
114 QEventLoopPrivate *d;
115
116 friend class QApplication;
117};
118
119#endif // QEVENTLOOP_H
Note: See TracBrowser for help on using the repository browser.