2004-07-30 18:54:31 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/msw/evtloop.h
|
2012-07-10 19:52:00 -04:00
|
|
|
// Purpose: wxEventLoop class for wxMSW port
|
2004-07-30 18:54:31 -04:00
|
|
|
// Author: Vadim Zeitlin
|
|
|
|
// Modified by:
|
|
|
|
// Created: 2004-07-31
|
|
|
|
// Copyright: (c) 2003-2004 Vadim Zeitlin <vadim@wxwindows.org>
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_MSW_EVTLOOP_H_
|
|
|
|
#define _WX_MSW_EVTLOOP_H_
|
|
|
|
|
2009-02-15 14:34:58 -05:00
|
|
|
#include "wx/dynarray.h"
|
|
|
|
#include "wx/msw/wrapwin.h"
|
2006-01-15 05:13:40 -05:00
|
|
|
#include "wx/window.h"
|
2012-07-10 19:52:00 -04:00
|
|
|
#include "wx/msw/evtloopconsole.h" // for wxMSWEventLoopBase
|
2006-01-15 05:13:40 -05:00
|
|
|
|
2004-07-30 18:54:31 -04:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxEventLoop
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2009-02-26 09:15:20 -05:00
|
|
|
WX_DECLARE_EXPORTED_OBJARRAY(MSG, wxMSGArray);
|
2009-02-15 09:25:08 -05:00
|
|
|
|
2007-05-14 19:43:39 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxGUIEventLoop : public wxMSWEventLoopBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxGUIEventLoop() { }
|
|
|
|
|
|
|
|
// process a single message: calls PreProcessMessage() before dispatching
|
|
|
|
// it
|
|
|
|
virtual void ProcessMessage(WXMSG *msg);
|
2004-07-30 18:54:31 -04:00
|
|
|
|
|
|
|
// preprocess a message, return true if processed (i.e. no further
|
|
|
|
// dispatching required)
|
|
|
|
virtual bool PreProcessMessage(WXMSG *msg);
|
|
|
|
|
2005-07-15 18:57:49 -04:00
|
|
|
// set the critical window: this is the window such that all the events
|
|
|
|
// except those to this window (and its children) stop to be processed
|
|
|
|
// (typical examples: assert or crash report dialog)
|
|
|
|
//
|
|
|
|
// calling this function with NULL argument restores the normal event
|
|
|
|
// handling
|
2005-07-18 09:36:31 -04:00
|
|
|
static void SetCriticalWindow(wxWindowMSW *win) { ms_winCritical = win; }
|
2005-07-15 18:57:49 -04:00
|
|
|
|
|
|
|
// return true if there is no critical window or if this window is [a child
|
|
|
|
// of] the critical one
|
2005-07-18 09:36:31 -04:00
|
|
|
static bool AllowProcessing(wxWindowMSW *win)
|
2005-07-15 18:57:49 -04:00
|
|
|
{
|
|
|
|
return !ms_winCritical || IsChildOfCriticalWindow(win);
|
|
|
|
}
|
|
|
|
|
2006-01-12 20:31:37 -05:00
|
|
|
// override/implement base class virtuals
|
2007-05-14 19:43:39 -04:00
|
|
|
virtual bool Dispatch();
|
2008-12-26 17:28:34 -05:00
|
|
|
virtual int DispatchTimeout(unsigned long timeout);
|
2016-07-02 08:44:35 -04:00
|
|
|
virtual void WakeUp();
|
2007-05-14 19:43:39 -04:00
|
|
|
|
|
|
|
protected:
|
2006-01-12 20:31:37 -05:00
|
|
|
virtual void OnNextIteration();
|
2014-03-02 13:58:00 -05:00
|
|
|
virtual void DoYieldFor(long eventsToProcess);
|
2006-01-12 20:31:37 -05:00
|
|
|
|
2007-05-14 19:43:39 -04:00
|
|
|
private:
|
2005-07-15 18:57:49 -04:00
|
|
|
// check if the given window is a child of ms_winCritical (which must be
|
|
|
|
// non NULL)
|
2005-07-18 09:36:31 -04:00
|
|
|
static bool IsChildOfCriticalWindow(wxWindowMSW *win);
|
2005-07-15 18:57:49 -04:00
|
|
|
|
2009-02-15 09:25:08 -05:00
|
|
|
// array of messages used for temporary storage by YieldFor()
|
|
|
|
wxMSGArray m_arrMSG;
|
2005-07-15 18:57:49 -04:00
|
|
|
|
|
|
|
// critical window or NULL
|
2005-07-18 09:36:31 -04:00
|
|
|
static wxWindowMSW *ms_winCritical;
|
2004-07-30 18:54:31 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _WX_MSW_EVTLOOP_H_
|