]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/evtloop.h
Implement monitoring of file descriptors in wxMotif event loop.
[wxWidgets.git] / include / wx / msw / evtloop.h
CommitLineData
3754265e
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: wx/msw/evtloop.h
e27f5540 3// Purpose: wxEventLoop class for wxMSW port
3754265e
VZ
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 2004-07-31
7// RCS-ID: $Id$
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
8bd9fa33
FM
15#include "wx/dynarray.h"
16#include "wx/msw/wrapwin.h"
cafed236 17#include "wx/window.h"
e27f5540 18#include "wx/msw/evtloopconsole.h" // for wxMSWEventLoopBase
cafed236 19
3754265e
VZ
20// ----------------------------------------------------------------------------
21// wxEventLoop
22// ----------------------------------------------------------------------------
23
22cb3139 24WX_DECLARE_EXPORTED_OBJARRAY(MSG, wxMSGArray);
dde19c21 25
b46b1d59
VZ
26class WXDLLIMPEXP_CORE wxGUIEventLoop : public wxMSWEventLoopBase
27{
28public:
29 wxGUIEventLoop() { }
30
31 // process a single message: calls PreProcessMessage() before dispatching
32 // it
33 virtual void ProcessMessage(WXMSG *msg);
3754265e
VZ
34
35 // preprocess a message, return true if processed (i.e. no further
36 // dispatching required)
37 virtual bool PreProcessMessage(WXMSG *msg);
38
a7b7500c
VZ
39 // set the critical window: this is the window such that all the events
40 // except those to this window (and its children) stop to be processed
41 // (typical examples: assert or crash report dialog)
42 //
43 // calling this function with NULL argument restores the normal event
44 // handling
b4626104 45 static void SetCriticalWindow(wxWindowMSW *win) { ms_winCritical = win; }
a7b7500c
VZ
46
47 // return true if there is no critical window or if this window is [a child
48 // of] the critical one
b4626104 49 static bool AllowProcessing(wxWindowMSW *win)
a7b7500c
VZ
50 {
51 return !ms_winCritical || IsChildOfCriticalWindow(win);
52 }
53
b80e8ac9 54 // override/implement base class virtuals
b46b1d59 55 virtual bool Dispatch();
9af42efd 56 virtual int DispatchTimeout(unsigned long timeout);
b80e8ac9 57 virtual void WakeUp();
dde19c21 58 virtual bool YieldFor(long eventsToProcess);
b46b1d59
VZ
59
60protected:
b80e8ac9
VZ
61 virtual void OnNextIteration();
62
b46b1d59 63private:
a7b7500c
VZ
64 // check if the given window is a child of ms_winCritical (which must be
65 // non NULL)
b4626104 66 static bool IsChildOfCriticalWindow(wxWindowMSW *win);
a7b7500c 67
dde19c21
FM
68 // array of messages used for temporary storage by YieldFor()
69 wxMSGArray m_arrMSG;
a7b7500c
VZ
70
71 // critical window or NULL
b4626104 72 static wxWindowMSW *ms_winCritical;
3754265e
VZ
73};
74
75#endif // _WX_MSW_EVTLOOP_H_