2009-10-22 11:36:35 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2007-05-14 23:43:39 +00:00
|
|
|
// Name: wx/unix/evtloop.h
|
|
|
|
// Purpose: declares wxEventLoop class
|
|
|
|
// Author: Lukasz Michalski (lm@zork.pl)
|
|
|
|
// Created: 2007-05-07
|
|
|
|
// Copyright: (c) 2007 Lukasz Michalski
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_UNIX_EVTLOOP_H_
|
|
|
|
#define _WX_UNIX_EVTLOOP_H_
|
|
|
|
|
2007-07-14 19:06:18 +00:00
|
|
|
#if wxUSE_CONSOLE_EVENTLOOP
|
|
|
|
|
2007-05-14 23:43:39 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
2009-01-31 10:58:10 +00:00
|
|
|
// wxConsoleEventLoop
|
2007-05-14 23:43:39 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2013-07-03 00:30:39 +00:00
|
|
|
class wxEventLoopSource;
|
2009-01-31 10:58:10 +00:00
|
|
|
class wxFDIODispatcher;
|
2013-07-03 00:27:53 +00:00
|
|
|
class wxWakeUpPipeMT;
|
2009-01-31 10:58:10 +00:00
|
|
|
|
2010-09-30 11:44:45 +00:00
|
|
|
class WXDLLIMPEXP_BASE wxConsoleEventLoop
|
2010-03-17 07:14:03 +00:00
|
|
|
#ifdef __WXOSX__
|
2010-03-17 08:05:04 +00:00
|
|
|
: public wxCFEventLoop
|
2010-03-17 07:14:03 +00:00
|
|
|
#else
|
|
|
|
: public wxEventLoopManual
|
|
|
|
#endif
|
2007-05-14 23:43:39 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
// initialize the event loop, use IsOk() to check if we were successful
|
|
|
|
wxConsoleEventLoop();
|
2009-01-31 10:58:10 +00:00
|
|
|
virtual ~wxConsoleEventLoop();
|
2007-05-14 23:43:39 +00:00
|
|
|
|
|
|
|
// implement base class pure virtuals
|
2014-03-30 00:02:23 +00:00
|
|
|
virtual bool Pending() const wxOVERRIDE;
|
|
|
|
virtual bool Dispatch() wxOVERRIDE;
|
|
|
|
virtual int DispatchTimeout(unsigned long timeout) wxOVERRIDE;
|
|
|
|
virtual void WakeUp() wxOVERRIDE;
|
|
|
|
virtual bool IsOk() const wxOVERRIDE { return m_dispatcher != NULL; }
|
2007-05-14 23:43:39 +00:00
|
|
|
|
|
|
|
protected:
|
2014-03-30 00:02:23 +00:00
|
|
|
virtual void OnNextIteration() wxOVERRIDE;
|
|
|
|
virtual void DoYieldFor(long eventsToProcess) wxOVERRIDE;
|
2007-05-14 23:43:39 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
// pipe used for wake up messages: when a child thread wants to wake up
|
|
|
|
// the event loop in the main thread it writes to this pipe
|
2013-07-03 00:27:53 +00:00
|
|
|
wxWakeUpPipeMT *m_wakeupPipe;
|
2007-05-14 23:43:39 +00:00
|
|
|
|
2013-07-03 00:30:39 +00:00
|
|
|
// the event loop source used to monitor this pipe
|
|
|
|
wxEventLoopSource* m_wakeupSource;
|
|
|
|
|
2007-05-14 23:43:39 +00:00
|
|
|
// either wxSelectDispatcher or wxEpollDispatcher
|
|
|
|
wxFDIODispatcher *m_dispatcher;
|
|
|
|
|
2009-02-08 11:45:59 +00:00
|
|
|
wxDECLARE_NO_COPY_CLASS(wxConsoleEventLoop);
|
2007-05-14 23:43:39 +00:00
|
|
|
};
|
|
|
|
|
2007-07-14 19:06:18 +00:00
|
|
|
#endif // wxUSE_CONSOLE_EVENTLOOP
|
|
|
|
|
2007-05-14 23:43:39 +00:00
|
|
|
#endif // _WX_UNIX_EVTLOOP_H_
|