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