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
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// 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
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2009-01-31 10:58:10 +00:00
|
|
|
class wxFDIODispatcher;
|
|
|
|
|
|
|
|
namespace wxPrivate
|
|
|
|
{
|
|
|
|
class PipeIOHandler;
|
2009-02-19 07:35:55 +00:00
|
|
|
}
|
2009-01-31 10:58:10 +00:00
|
|
|
|
2007-05-14 23:43:39 +00:00
|
|
|
class WXDLLIMPEXP_BASE wxConsoleEventLoop : public wxEventLoopManual
|
|
|
|
{
|
|
|
|
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
|
|
|
|
virtual bool Pending() const;
|
|
|
|
virtual bool Dispatch();
|
2008-12-26 22:28:34 +00:00
|
|
|
virtual int DispatchTimeout(unsigned long timeout);
|
2007-05-14 23:43:39 +00:00
|
|
|
virtual void WakeUp();
|
|
|
|
virtual bool IsOk() const { return m_dispatcher != NULL; }
|
2009-02-15 14:25:08 +00:00
|
|
|
virtual bool YieldFor(long WXUNUSED(eventsToProcess)) { return true; }
|
2007-05-14 23:43:39 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void OnNextIteration();
|
|
|
|
|
|
|
|
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
|
2009-01-31 10:58:10 +00:00
|
|
|
wxPrivate::PipeIOHandler *m_wakeupPipe;
|
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_
|