]>
Commit | Line | Data |
---|---|---|
3754265e VZ |
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$ | |
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 | // ---------------------------------------------------------------------------- | |
16 | // wxEventLoop | |
17 | // ---------------------------------------------------------------------------- | |
18 | ||
19 | class WXDLLEXPORT wxEventLoop : public wxEventLoopBase | |
20 | { | |
21 | public: | |
22 | wxEventLoop(); | |
23 | ||
24 | // implement base class pure virtuals | |
25 | virtual int Run(); | |
26 | virtual void Exit(int rc = 0); | |
27 | virtual bool Pending() const; | |
28 | virtual bool Dispatch(); | |
29 | virtual bool IsRunning() const; | |
30 | ||
31 | // MSW-specific methods | |
32 | // -------------------- | |
33 | ||
34 | // preprocess a message, return true if processed (i.e. no further | |
35 | // dispatching required) | |
36 | virtual bool PreProcessMessage(WXMSG *msg); | |
37 | ||
38 | // process a single message | |
39 | virtual void ProcessMessage(WXMSG *msg); | |
40 | ||
a7b7500c VZ |
41 | // set the critical window: this is the window such that all the events |
42 | // except those to this window (and its children) stop to be processed | |
43 | // (typical examples: assert or crash report dialog) | |
44 | // | |
45 | // calling this function with NULL argument restores the normal event | |
46 | // handling | |
b4626104 | 47 | static void SetCriticalWindow(wxWindowMSW *win) { ms_winCritical = win; } |
a7b7500c VZ |
48 | |
49 | // return true if there is no critical window or if this window is [a child | |
50 | // of] the critical one | |
b4626104 | 51 | static bool AllowProcessing(wxWindowMSW *win) |
a7b7500c VZ |
52 | { |
53 | return !ms_winCritical || IsChildOfCriticalWindow(win); | |
54 | } | |
55 | ||
3754265e | 56 | protected: |
a7b7500c VZ |
57 | // check if the given window is a child of ms_winCritical (which must be |
58 | // non NULL) | |
b4626104 | 59 | static bool IsChildOfCriticalWindow(wxWindowMSW *win); |
a7b7500c VZ |
60 | |
61 | ||
62 | // critical window or NULL | |
b4626104 | 63 | static wxWindowMSW *ms_winCritical; |
3754265e VZ |
64 | |
65 | // the loop exit code | |
66 | int m_exitcode; | |
a7b7500c VZ |
67 | |
68 | // should we exit the loop? | |
69 | bool m_shouldExit; | |
3754265e VZ |
70 | }; |
71 | ||
72 | #endif // _WX_MSW_EVTLOOP_H_ | |
73 |