]>
Commit | Line | Data |
---|---|---|
5cd99866 | 1 | /////////////////////////////////////////////////////////////////////////////// |
b46b1d59 VZ |
2 | // Name: wx/unix/evtloop.h |
3 | // Purpose: declares wxEventLoop class | |
4 | // Author: Lukasz Michalski (lm@zork.pl) | |
5 | // Created: 2007-05-07 | |
6 | // RCS-ID: $Id$ | |
7 | // Copyright: (c) 2007 Lukasz Michalski | |
8 | // Licence: wxWindows licence | |
9 | /////////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #ifndef _WX_UNIX_EVTLOOP_H_ | |
12 | #define _WX_UNIX_EVTLOOP_H_ | |
13 | ||
a1873279 VZ |
14 | #if wxUSE_CONSOLE_EVENTLOOP |
15 | ||
b46b1d59 | 16 | // ---------------------------------------------------------------------------- |
3f8cdda4 | 17 | // wxConsoleEventLoop |
b46b1d59 VZ |
18 | // ---------------------------------------------------------------------------- |
19 | ||
39bc0168 | 20 | class wxEventLoopSource; |
3f8cdda4 | 21 | class wxFDIODispatcher; |
bd7cea0e | 22 | class wxWakeUpPipeMT; |
3f8cdda4 | 23 | |
ce00f59b | 24 | class WXDLLIMPEXP_BASE wxConsoleEventLoop |
80eee837 | 25 | #ifdef __WXOSX__ |
9aee1212 | 26 | : public wxCFEventLoop |
80eee837 SC |
27 | #else |
28 | : public wxEventLoopManual | |
29 | #endif | |
b46b1d59 VZ |
30 | { |
31 | public: | |
32 | // initialize the event loop, use IsOk() to check if we were successful | |
33 | wxConsoleEventLoop(); | |
3f8cdda4 | 34 | virtual ~wxConsoleEventLoop(); |
b46b1d59 VZ |
35 | |
36 | // implement base class pure virtuals | |
37 | virtual bool Pending() const; | |
38 | virtual bool Dispatch(); | |
9af42efd | 39 | virtual int DispatchTimeout(unsigned long timeout); |
b46b1d59 VZ |
40 | virtual void WakeUp(); |
41 | virtual bool IsOk() const { return m_dispatcher != NULL; } | |
dde19c21 | 42 | virtual bool YieldFor(long WXUNUSED(eventsToProcess)) { return true; } |
b46b1d59 VZ |
43 | |
44 | protected: | |
45 | virtual void OnNextIteration(); | |
46 | ||
47 | private: | |
48 | // pipe used for wake up messages: when a child thread wants to wake up | |
49 | // the event loop in the main thread it writes to this pipe | |
bd7cea0e | 50 | wxWakeUpPipeMT *m_wakeupPipe; |
b46b1d59 | 51 | |
39bc0168 VZ |
52 | // the event loop source used to monitor this pipe |
53 | wxEventLoopSource* m_wakeupSource; | |
54 | ||
b46b1d59 VZ |
55 | // either wxSelectDispatcher or wxEpollDispatcher |
56 | wxFDIODispatcher *m_dispatcher; | |
57 | ||
c0c133e1 | 58 | wxDECLARE_NO_COPY_CLASS(wxConsoleEventLoop); |
b46b1d59 VZ |
59 | }; |
60 | ||
a1873279 VZ |
61 | #endif // wxUSE_CONSOLE_EVENTLOOP |
62 | ||
b46b1d59 | 63 | #endif // _WX_UNIX_EVTLOOP_H_ |