1/////////////////////////////////////////////////////////////////////////////// 2// Name: wx/msw/evtloop.h 3// Purpose: wxEventLoop class for MSW 4// Author: Vadim Zeitlin 5// Modified by: 6// Created: 2004-07-31 7// RCS-ID: $Id: evtloop.h 36881 2006-01-15 10:13:40Z ABX $ 8// Copyright: (c) 2003-2004 Vadim Zeitlin <vadim@wxwindows.org> 9// Licence: wxWindows licence 10/////////////////////////////////////////////////////////////////////////////// 11 12#ifndef _WX_MSW_EVTLOOP_H_ 13#define _WX_MSW_EVTLOOP_H_ 14 15#include "wx/window.h" 16 17// ---------------------------------------------------------------------------- 18// wxEventLoop 19// ---------------------------------------------------------------------------- 20 21class WXDLLEXPORT wxEventLoop : public wxEventLoopManual 22{ 23public: 24 wxEventLoop(); 25 26 // implement base class pure virtuals 27 virtual bool Pending() const; 28 virtual bool Dispatch(); 29 30 // MSW-specific methods 31 // -------------------- 32 33 // preprocess a message, return true if processed (i.e. no further 34 // dispatching required) 35 virtual bool PreProcessMessage(WXMSG *msg); 36 37 // process a single message 38 virtual void ProcessMessage(WXMSG *msg); 39 40 // set the critical window: this is the window such that all the events 41 // except those to this window (and its children) stop to be processed 42 // (typical examples: assert or crash report dialog) 43 // 44 // calling this function with NULL argument restores the normal event 45 // handling 46 static void SetCriticalWindow(wxWindowMSW *win) { ms_winCritical = win; } 47 48 // return true if there is no critical window or if this window is [a child 49 // of] the critical one 50 static bool AllowProcessing(wxWindowMSW *win) 51 { 52 return !ms_winCritical || IsChildOfCriticalWindow(win); 53 } 54 55protected: 56 // override/implement base class virtuals 57 virtual void WakeUp(); 58 virtual void OnNextIteration(); 59 60 // check if the given window is a child of ms_winCritical (which must be 61 // non NULL) 62 static bool IsChildOfCriticalWindow(wxWindowMSW *win); 63 64 65 // critical window or NULL 66 static wxWindowMSW *ms_winCritical; 67}; 68 69#endif // _WX_MSW_EVTLOOP_H_ 70