1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/unix/evtloop.h
3 // Purpose: declares wxEventLoop class
4 // Author: Lukasz Michalski (lm@zork.pl)
7 // Copyright: (c) 2007 Lukasz Michalski
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_UNIX_EVTLOOP_H_
12 #define _WX_UNIX_EVTLOOP_H_
14 #if wxUSE_CONSOLE_EVENTLOOP
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 class wxFDIODispatcher
;
21 class wxUnixEventLoopSource
;
28 class WXDLLIMPEXP_BASE wxConsoleEventLoop
30 : public wxCFEventLoop
32 : public wxEventLoopManual
36 // initialize the event loop, use IsOk() to check if we were successful
38 virtual ~wxConsoleEventLoop();
40 // implement base class pure virtuals
41 virtual bool Pending() const;
42 virtual bool Dispatch();
43 virtual int DispatchTimeout(unsigned long timeout
);
44 virtual void WakeUp();
45 virtual bool IsOk() const { return m_dispatcher
!= NULL
; }
46 virtual bool YieldFor(long WXUNUSED(eventsToProcess
)) { return true; }
48 #if wxUSE_EVENTLOOP_SOURCE
49 virtual wxEventLoopSource
*
50 AddSourceForFD(int fd
, wxEventLoopSourceHandler
*handler
, int flags
);
51 #endif // wxUSE_EVENTLOOP_SOURCE
54 virtual void OnNextIteration();
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
59 wxPrivate::PipeIOHandler
*m_wakeupPipe
;
61 // either wxSelectDispatcher or wxEpollDispatcher
62 wxFDIODispatcher
*m_dispatcher
;
64 wxDECLARE_NO_COPY_CLASS(wxConsoleEventLoop
);
67 #endif // wxUSE_CONSOLE_EVENTLOOP
69 #endif // _WX_UNIX_EVTLOOP_H_