1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/evtloop.h
3 // Purpose: wxEventLoop class for wxMSW port
4 // Author: Vadim Zeitlin
7 // Copyright: (c) 2003-2004 Vadim Zeitlin <vadim@wxwindows.org>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_MSW_EVTLOOP_H_
12 #define _WX_MSW_EVTLOOP_H_
14 #include "wx/dynarray.h"
15 #include "wx/msw/wrapwin.h"
16 #include "wx/window.h"
17 #include "wx/msw/evtloopconsole.h" // for wxMSWEventLoopBase
19 // ----------------------------------------------------------------------------
21 // ----------------------------------------------------------------------------
23 WX_DECLARE_EXPORTED_OBJARRAY(MSG
, wxMSGArray
);
25 class WXDLLIMPEXP_CORE wxGUIEventLoop
: public wxMSWEventLoopBase
30 // process a single message: calls PreProcessMessage() before dispatching
32 virtual void ProcessMessage(WXMSG
*msg
);
34 // preprocess a message, return true if processed (i.e. no further
35 // dispatching required)
36 virtual bool PreProcessMessage(WXMSG
*msg
);
38 // set the critical window: this is the window such that all the events
39 // except those to this window (and its children) stop to be processed
40 // (typical examples: assert or crash report dialog)
42 // calling this function with NULL argument restores the normal event
44 static void SetCriticalWindow(wxWindowMSW
*win
) { ms_winCritical
= win
; }
46 // return true if there is no critical window or if this window is [a child
47 // of] the critical one
48 static bool AllowProcessing(wxWindowMSW
*win
)
50 return !ms_winCritical
|| IsChildOfCriticalWindow(win
);
53 // override/implement base class virtuals
54 virtual bool Dispatch();
55 virtual int DispatchTimeout(unsigned long timeout
);
56 virtual void WakeUp();
57 virtual bool YieldFor(long eventsToProcess
);
60 virtual void OnNextIteration();
63 // check if the given window is a child of ms_winCritical (which must be
65 static bool IsChildOfCriticalWindow(wxWindowMSW
*win
);
67 // array of messages used for temporary storage by YieldFor()
70 // critical window or NULL
71 static wxWindowMSW
*ms_winCritical
;
74 #endif // _WX_MSW_EVTLOOP_H_