1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/evtloop.h
3 // Purpose: wxEventLoop class for MSW
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 2003-2004 Vadim Zeitlin <vadim@wxwindows.org>
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_MSW_EVTLOOP_H_
13 #define _WX_MSW_EVTLOOP_H_
16 #include "wx/window.h"
19 // ----------------------------------------------------------------------------
21 // ----------------------------------------------------------------------------
23 class WXDLLIMPEXP_BASE wxMSWEventLoopBase
: public wxEventLoopManual
28 // implement base class pure virtuals
29 virtual bool Pending() const;
32 // get the next message from queue and return true or return false if we
33 // got WM_QUIT or an error occurred
34 bool GetNextMessage(WXMSG
*msg
);
39 class WXDLLIMPEXP_CORE wxGUIEventLoop
: public wxMSWEventLoopBase
44 // process a single message: calls PreProcessMessage() before dispatching
46 virtual void ProcessMessage(WXMSG
*msg
);
48 // preprocess a message, return true if processed (i.e. no further
49 // dispatching required)
50 virtual bool PreProcessMessage(WXMSG
*msg
);
52 // set the critical window: this is the window such that all the events
53 // except those to this window (and its children) stop to be processed
54 // (typical examples: assert or crash report dialog)
56 // calling this function with NULL argument restores the normal event
58 static void SetCriticalWindow(wxWindowMSW
*win
) { ms_winCritical
= win
; }
60 // return true if there is no critical window or if this window is [a child
61 // of] the critical one
62 static bool AllowProcessing(wxWindowMSW
*win
)
64 return !ms_winCritical
|| IsChildOfCriticalWindow(win
);
67 // override/implement base class virtuals
68 virtual bool Dispatch();
69 virtual void WakeUp();
72 virtual void OnNextIteration();
75 // check if the given window is a child of ms_winCritical (which must be
77 static bool IsChildOfCriticalWindow(wxWindowMSW
*win
);
80 // critical window or NULL
81 static wxWindowMSW
*ms_winCritical
;
86 class WXDLLIMPEXP_BASE wxConsoleEventLoop
: public wxMSWEventLoopBase
89 wxConsoleEventLoop() { }
91 // override/implement base class virtuals
92 virtual bool Dispatch();
93 virtual void WakeUp();
96 virtual void OnNextIteration();
99 #endif // wxUSE_GUI/!wxUSE_GUI
101 #endif // _WX_MSW_EVTLOOP_H_