2007-05-14 19:43:39 -04: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 15:06:18 -04:00
|
|
|
#if wxUSE_CONSOLE_EVENTLOOP
|
|
|
|
|
2007-05-14 19:43:39 -04:00
|
|
|
// ----------------------------------------------------------------------------
|
2009-01-31 05:58:10 -05:00
|
|
|
// wxConsoleEventLoop
|
2007-05-14 19:43:39 -04:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2009-01-31 05:58:10 -05:00
|
|
|
class wxFDIODispatcher;
|
|
|
|
|
|
|
|
namespace wxPrivate
|
|
|
|
{
|
|
|
|
class PipeIOHandler;
|
|
|
|
};
|
|
|
|
|
2007-05-14 19:43:39 -04:00
|
|
|
class WXDLLIMPEXP_BASE wxConsoleEventLoop : public wxEventLoopManual
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// initialize the event loop, use IsOk() to check if we were successful
|
|
|
|
wxConsoleEventLoop();
|
2009-01-31 05:58:10 -05:00
|
|
|
virtual ~wxConsoleEventLoop();
|
2007-05-14 19:43:39 -04:00
|
|
|
|
|
|
|
// implement base class pure virtuals
|
|
|
|
virtual bool Pending() const;
|
|
|
|
virtual bool Dispatch();
|
2008-12-26 17:28:34 -05:00
|
|
|
virtual int DispatchTimeout(unsigned long timeout);
|
2007-05-14 19:43:39 -04:00
|
|
|
virtual void WakeUp();
|
|
|
|
virtual bool IsOk() const { return m_dispatcher != NULL; }
|
|
|
|
|
|
|
|
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 05:58:10 -05:00
|
|
|
wxPrivate::PipeIOHandler *m_wakeupPipe;
|
2007-05-14 19:43:39 -04:00
|
|
|
|
|
|
|
// either wxSelectDispatcher or wxEpollDispatcher
|
|
|
|
wxFDIODispatcher *m_dispatcher;
|
|
|
|
|
|
|
|
DECLARE_NO_COPY_CLASS(wxConsoleEventLoop)
|
|
|
|
};
|
|
|
|
|
2007-07-14 15:06:18 -04:00
|
|
|
#endif // wxUSE_CONSOLE_EVENTLOOP
|
|
|
|
|
2007-05-14 19:43:39 -04:00
|
|
|
#endif // _WX_UNIX_EVTLOOP_H_
|