]>
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 | ||
3f8cdda4 | 20 | class wxFDIODispatcher; |
5cd99866 | 21 | class wxUnixEventLoopSource; |
3f8cdda4 VS |
22 | |
23 | namespace wxPrivate | |
24 | { | |
25 | class PipeIOHandler; | |
69cc4323 | 26 | } |
3f8cdda4 | 27 | |
ce00f59b | 28 | class WXDLLIMPEXP_BASE wxConsoleEventLoop |
80eee837 | 29 | #ifdef __WXOSX__ |
9aee1212 | 30 | : public wxCFEventLoop |
80eee837 SC |
31 | #else |
32 | : public wxEventLoopManual | |
33 | #endif | |
b46b1d59 VZ |
34 | { |
35 | public: | |
36 | // initialize the event loop, use IsOk() to check if we were successful | |
37 | wxConsoleEventLoop(); | |
3f8cdda4 | 38 | virtual ~wxConsoleEventLoop(); |
b46b1d59 VZ |
39 | |
40 | // implement base class pure virtuals | |
41 | virtual bool Pending() const; | |
42 | virtual bool Dispatch(); | |
9af42efd | 43 | virtual int DispatchTimeout(unsigned long timeout); |
b46b1d59 VZ |
44 | virtual void WakeUp(); |
45 | virtual bool IsOk() const { return m_dispatcher != NULL; } | |
dde19c21 | 46 | virtual bool YieldFor(long WXUNUSED(eventsToProcess)) { return true; } |
b46b1d59 | 47 | |
6b8ef0b3 | 48 | #if wxUSE_EVENTLOOP_SOURCE |
5cd99866 VZ |
49 | virtual wxEventLoopSource * |
50 | AddSourceForFD(int fd, wxEventLoopSourceHandler *handler, int flags); | |
51 | #endif // wxUSE_EVENTLOOP_SOURCE | |
6b8ef0b3 | 52 | |
b46b1d59 VZ |
53 | protected: |
54 | virtual void OnNextIteration(); | |
55 | ||
56 | private: | |
57 | // pipe used for wake up messages: when a child thread wants to wake up | |
58 | // the event loop in the main thread it writes to this pipe | |
3f8cdda4 | 59 | wxPrivate::PipeIOHandler *m_wakeupPipe; |
b46b1d59 VZ |
60 | |
61 | // either wxSelectDispatcher or wxEpollDispatcher | |
62 | wxFDIODispatcher *m_dispatcher; | |
63 | ||
c0c133e1 | 64 | wxDECLARE_NO_COPY_CLASS(wxConsoleEventLoop); |
b46b1d59 VZ |
65 | }; |
66 | ||
a1873279 VZ |
67 | #endif // wxUSE_CONSOLE_EVENTLOOP |
68 | ||
b46b1d59 | 69 | #endif // _WX_UNIX_EVTLOOP_H_ |