1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qeventloop.cpp:41 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>TQEventLoop Class</title>
<style type="text/css"><!--
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
<a href="index.html">
<font color="#004faf">Home</font></a>
| <a href="classes.html">
<font color="#004faf">All Classes</font></a>
| <a href="mainclasses.html">
<font color="#004faf">Main Classes</font></a>
| <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
| <a href="groups.html">
<font color="#004faf">Grouped Classes</font></a>
| <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>TQEventLoop Class Reference</h1>
<p>The TQEventLoop class manages the event queue.
<a href="#details">More...</a>
<p><tt>#include <<a href="qeventloop-h.html">qeventloop.h</a>></tt>
<p>Inherits <a href="qobject.html">TQObject</a>.
<p>Inherited by <a href="qmotif.html">TQMotif</a>.
<p><a href="qeventloop-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#TQEventLoop"><b>TQEventLoop</b></a> ( TQObject * parent = 0, const char * name = 0 )</li>
<li class=fn><a href="#~TQEventLoop"><b>~TQEventLoop</b></a> ()</li>
<li class=fn>enum <a href="#ProcessEvents-enum"><b>ProcessEvents</b></a> { AllEvents = 0x00, ExcludeUserInput = 0x01, ExcludeSocketNotifiers = 0x02, WaitForMore = 0x04 }</li>
<li class=fn>typedef uint <a href="#ProcessEventsFlags"><b>ProcessEventsFlags</b></a></li>
<li class=fn>void <a href="#processEvents"><b>processEvents</b></a> ( ProcessEventsFlags flags, int maxTime )</li>
<li class=fn>virtual bool <a href="#processEvents-2"><b>processEvents</b></a> ( ProcessEventsFlags flags )</li>
<li class=fn>virtual bool <a href="#hasPendingEvents"><b>hasPendingEvents</b></a> () const</li>
<li class=fn>virtual void <a href="#registerSocketNotifier"><b>registerSocketNotifier</b></a> ( TQSocketNotifier * notifier )</li>
<li class=fn>virtual void <a href="#unregisterSocketNotifier"><b>unregisterSocketNotifier</b></a> ( TQSocketNotifier * notifier )</li>
<li class=fn>void <a href="#setSocketNotifierPending"><b>setSocketNotifierPending</b></a> ( TQSocketNotifier * notifier )</li>
<li class=fn>int <a href="#activateSocketNotifiers"><b>activateSocketNotifiers</b></a> ()</li>
<li class=fn>int <a href="#activateTimers"><b>activateTimers</b></a> ()</li>
<li class=fn>int <a href="#timeToWait"><b>timeToWait</b></a> () const</li>
<li class=fn>virtual int <a href="#exec"><b>exec</b></a> ()</li>
<li class=fn>virtual void <a href="#exit"><b>exit</b></a> ( int retcode = 0 )</li>
<li class=fn>virtual int <a href="#enterLoop"><b>enterLoop</b></a> ()</li>
<li class=fn>virtual void <a href="#exitLoop"><b>exitLoop</b></a> ()</li>
<li class=fn>virtual int <a href="#loopLevel"><b>loopLevel</b></a> () const</li>
<li class=fn>virtual void <a href="#wakeUp"><b>wakeUp</b></a> ()</li>
</ul>
<h2>Signals</h2>
<ul>
<li class=fn>void <a href="#awake"><b>awake</b></a> ()</li>
<li class=fn>void <a href="#aboutToBlock"><b>aboutToBlock</b></a> ()</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
The TQEventLoop class manages the event queue.
<p>
<p> It receives events from the window system and other sources. It
then sends them to <a href="qapplication.html">TQApplication</a> for processing and delivery.
<p> TQEventLoop allows the application programmer to have more control
over event delivery. Programs that perform long operations can
call either processOneEvent() or <a href="#processEvents">processEvents</a>() with various
ProcessEvent values OR'ed together to control which events should
be delivered.
<p> TQEventLoop also allows the integration of an external event loop
with the TQt event loop. The <a href="motif-extension.html#Motif">Motif</a> Extension included with TQt
includes a reimplementation of TQEventLoop for merging TQt and Motif
events together.
<p> To use your own instance of TQEventLoop or TQEventLoop subclass create
it before you create the TQApplication object.
<p>See also <a href="application.html">Main Window and Related Classes</a> and <a href="events.html">Event Classes</a>.
<hr><h2>Member Type Documentation</h2>
<h3 class=fn><a name="ProcessEvents-enum"></a>TQEventLoop::ProcessEvents</h3>
<p> This enum controls the types of events processed by the
<a href="#processEvents">processEvents</a>() functions.
<ul>
<li><tt>TQEventLoop::AllEvents</tt> - All events are processed
<li><tt>TQEventLoop::ExcludeUserInput</tt> - Do not process user input events.
( ButtonPress, KeyPress, etc. )
<li><tt>TQEventLoop::ExcludeSocketNotifiers</tt> - Do not process socket notifier
events.
<li><tt>TQEventLoop::WaitForMore</tt> - Wait for events if no pending events
are available.
</ul><p> <p>See also <a href="#processEvents">processEvents</a>().
<h3 class=fn><a name="ProcessEventsFlags"></a>TQEventLoop::ProcessEventsFlags</h3>
A <tt>typedef</tt> to allow various ProcessEvents values to be OR'ed together.
<p> <p>See also <a href="#ProcessEvents-enum">ProcessEvents</a>.
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="TQEventLoop"></a>TQEventLoop::TQEventLoop ( <a href="qobject.html">TQObject</a> * parent = 0, const char * name = 0 )
</h3>
Creates a TQEventLoop object, this object becomes the global event loop object.
There can only be one event loop object. The TQEventLoop is usually constructed
by calling <a href="qapplication.html#eventLoop">TQApplication::eventLoop</a>(). To create your own event loop object create
it before you instantiate the <a href="qapplication.html">TQApplication</a> object.
<p> The <em>parent</em> and <em>name</em> arguments are passed on to the <a href="qobject.html">TQObject</a> constructor.
<h3 class=fn><a name="~TQEventLoop"></a>TQEventLoop::~TQEventLoop ()
</h3>
Destructs the TQEventLoop object.
<h3 class=fn>void <a name="aboutToBlock"></a>TQEventLoop::aboutToBlock ()<tt> [signal]</tt>
</h3>
<p> This signal is emitted before the event loop calls a function that
could block.
<p> <p>See also <a href="#awake">awake</a>().
<h3 class=fn>int <a name="activateSocketNotifiers"></a>TQEventLoop::activateSocketNotifiers ()
</h3>
<p> Activates all pending socket notifiers and returns the number of
socket notifiers that were activated.
<h3 class=fn>int <a name="activateTimers"></a>TQEventLoop::activateTimers ()
</h3>
<p> Activates all TQt timers and returns the number of timers that were
activated.
<p> TQEventLoop subclasses that do their own timer handling need to
call this after the time returned by <a href="#timeToWait">timeToWait</a>() has elapsed.
<p> Note: This function is only useful on systems where <tt>select()</tt> is
used to block the eventloop. On Windows, this function always
returns 0. On MacOS X, this function always returns 0 when the
GUI is enabled. On MacOS X, this function returns the documented
value when the GUI is disabled.
<h3 class=fn>void <a name="awake"></a>TQEventLoop::awake ()<tt> [signal]</tt>
</h3>
<p> This signal is emitted after the event loop returns from a
function that could block.
<p> <p>See also <a href="#wakeUp">wakeUp</a>() and <a href="#aboutToBlock">aboutToBlock</a>().
<h3 class=fn>int <a name="enterLoop"></a>TQEventLoop::enterLoop ()<tt> [virtual]</tt>
</h3>
<p> This function enters the main event loop (recursively). Do not call
it unless you really know what you are doing.
<h3 class=fn>int <a name="exec"></a>TQEventLoop::exec ()<tt> [virtual]</tt>
</h3>
Enters the main event loop and waits until <a href="#exit">exit</a>() is called, and
returns the value that was set to exit().
<p> It is necessary to call this function to start event handling. The
main event loop receives events from the window system and
dispatches these to the application widgets.
<p> Generally speaking, no user interaction can take place before
calling <a href="#exec">exec</a>(). As a special case, modal widgets like <a href="qmessagebox.html">TQMessageBox</a>
can be used before calling exec(), because modal widgets call
exec() to start a local event loop.
<p> To make your application perform idle processing, i.e. executing a
special function whenever there are no pending events, use a
<a href="qtimer.html">TQTimer</a> with 0 timeout. More advanced idle processing schemes can
be achieved using <a href="#processEvents">processEvents</a>().
<p> <p>See also <a href="qapplication.html#quit">TQApplication::quit</a>(), <a href="#exit">exit</a>(), and <a href="#processEvents">processEvents</a>().
<h3 class=fn>void <a name="exit"></a>TQEventLoop::exit ( int retcode = 0 )<tt> [virtual]</tt>
</h3>
<p> Tells the event loop to exit with a return code.
<p> After this function has been called, the event loop returns from
the call to <a href="#exec">exec</a>(). The exec() function returns <em>retcode</em>.
<p> By convention, a <em>retcode</em> of 0 means success, and any non-zero
value indicates an error.
<p> Note that unlike the C library function of the same name, this
function <em>does</em> return to the caller -- it is event processing that
stops.
<p> <p>See also <a href="qapplication.html#quit">TQApplication::quit</a>() and <a href="#exec">exec</a>().
<h3 class=fn>void <a name="exitLoop"></a>TQEventLoop::exitLoop ()<tt> [virtual]</tt>
</h3>
<p> This function exits from a recursive call to the main event loop.
Do not call it unless you really know what you are doing.
<h3 class=fn>bool <a name="hasPendingEvents"></a>TQEventLoop::hasPendingEvents () const<tt> [virtual]</tt>
</h3>
<p> Returns TRUE if there is an event waiting, otherwise it returns FALSE.
<h3 class=fn>int <a name="loopLevel"></a>TQEventLoop::loopLevel () const<tt> [virtual]</tt>
</h3>
<p> Returns the current loop level.
<h3 class=fn>void <a name="processEvents"></a>TQEventLoop::processEvents ( <a href="qeventloop.html#ProcessEventsFlags">ProcessEventsFlags</a> flags, int maxTime )
</h3>
Process pending events that match <em>flags</em> for a maximum of <em>maxTime</em> milliseconds, or until there are no more events to
process, which ever is shorter.
<p> This function is especially useful if you have a long running
operation and want to show its progress without allowing user
input, i.e. by using the <a href="#ProcessEvents-enum">ExcludeUserInput</a> flag.
<p> NOTE: This function will not process events continuously; it
returns after all available events are processed.
<p> NOTE: Specifying the <a href="#ProcessEvents-enum">WaitForMore</a> flag makes no sense and will
be ignored.
<h3 class=fn>bool <a name="processEvents-2"></a>TQEventLoop::processEvents ( <a href="qeventloop.html#ProcessEventsFlags">ProcessEventsFlags</a> flags )<tt> [virtual]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Processes pending events that match <em>flags</em> until there are no
more events to process.
<p> This function is especially useful if you have a long running
operation and want to show its progress without allowing user
input, i.e. by using the <a href="#ProcessEvents-enum">ExcludeUserInput</a> flag.
<p> If the <a href="#ProcessEvents-enum">WaitForMore</a> flag is set in <em>flags</em>, the behavior of
this function is as follows:
<p> <ul>
<p> <li> If events are available, this function returns after processing
them.
<p> <li> If no events are available, this function will wait until more
are available and return after processing newly available events.
<p> </ul>
<p> If the <a href="#ProcessEvents-enum">WaitForMore</a> flag is <em>not</em> set in <em>flags</em>, and no
events are available, this function will return immediately.
<p> NOTE: This function will not process events continuously; it
returns after all available events are processed.
<p> This function returns TRUE if an event was processed; otherwise it
returns FALSE.
<p> <p>See also <a href="#ProcessEvents-enum">ProcessEvents</a> and <a href="#hasPendingEvents">hasPendingEvents</a>().
<h3 class=fn>void <a name="registerSocketNotifier"></a>TQEventLoop::registerSocketNotifier ( <a href="qsocketnotifier.html">TQSocketNotifier</a> * notifier )<tt> [virtual]</tt>
</h3>
<p> Registers <em>notifier</em> with the event loop. Subclasses need to
reimplement this method to tie a socket notifier into another
event loop. Reimplementations <em>MUST</em> call the base
implementation.
<h3 class=fn>void <a name="setSocketNotifierPending"></a>TQEventLoop::setSocketNotifierPending ( <a href="qsocketnotifier.html">TQSocketNotifier</a> * notifier )
</h3>
<p> Marks <em>notifier</em> as pending. The socket notifier will be
activated the next time <a href="#activateSocketNotifiers">activateSocketNotifiers</a>() is called.
<h3 class=fn>int <a name="timeToWait"></a>TQEventLoop::timeToWait () const
</h3>
<p> Returns the number of milliseconds that TQt needs to handle its
timers or -1 if there are no timers running.
<p> TQEventLoop subclasses that do their own timer handling need to use
this to make sure that TQt's timers continue to work.
<p> Note: This function is only useful on systems where <tt>select()</tt> is
used to block the eventloop. On Windows, this function always
returns -1. On MacOS X, this function always returns -1 when the
GUI is enabled. On MacOS X, this function returns the documented
value when the GUI is disabled.
<h3 class=fn>void <a name="unregisterSocketNotifier"></a>TQEventLoop::unregisterSocketNotifier ( <a href="qsocketnotifier.html">TQSocketNotifier</a> * notifier )<tt> [virtual]</tt>
</h3>
<p> Unregisters <em>notifier</em> from the event loop. Subclasses need to
reimplement this method to tie a socket notifier into another
event loop. Reimplementations <em>MUST</em> call the base
implementation.
<h3 class=fn>void <a name="wakeUp"></a>TQEventLoop::wakeUp ()<tt> [virtual]</tt>
</h3><p><b>Note:</b> This function is <a href="threads.html#threadsafe">thread-safe</a> when TQt is built withthread support.</p>
<p> Wakes up the event loop.
<p> <p>See also <a href="#awake">awake</a>().
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">TQt toolkit</a>.
Copyright © 1995-2007
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright © 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>TQt 3.3.8</div>
</table></div></address></body>
</html>
|