]>
Commit | Line | Data |
---|---|---|
e2478fde VZ |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: msw/basemsw.cpp | |
3 | // Purpose: misc stuff only used in console applications under MSW | |
4 | // Author: Vadim Zeitlin | |
5 | // Modified by: | |
6 | // Created: 22.06.2003 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwindows.org> | |
65571936 | 9 | // License: wxWindows licence |
e2478fde VZ |
10 | /////////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | // ============================================================================ | |
13 | // declarations | |
14 | // ============================================================================ | |
15 | ||
16 | // ---------------------------------------------------------------------------- | |
17 | // headers | |
18 | // ---------------------------------------------------------------------------- | |
19 | ||
20 | // for compilers that support precompilation, includes "wx.h". | |
21 | #include "wx/wxprec.h" | |
22 | ||
23 | #ifdef __BORLANDC__ | |
24 | #pragma hdrstop | |
25 | #endif | |
26 | ||
27 | #ifndef WX_PRECOMP | |
28 | #endif //WX_PRECOMP | |
29 | ||
30 | #include "wx/apptrait.h" | |
c2ca375c | 31 | #include "wx/msw/private/timer.h" |
548bf4b7 MB |
32 | // MBN: this is a workaround for MSVC 5: if it is not #included in |
33 | // some wxBase file, wxRecursionGuard methods won't be exported from | |
34 | // wxBase.dll, and MSVC 5 will give linker errors | |
35 | #include "wx/recguard.h" | |
e2478fde VZ |
36 | |
37 | #include "wx/msw/private.h" | |
38 | ||
535920ff VZ |
39 | // ============================================================================ |
40 | // wxAppTraits implementation | |
41 | // ============================================================================ | |
42 | ||
43 | WXDWORD wxAppTraits::DoSimpleWaitForThread(WXHANDLE hThread) | |
44 | { | |
45 | return ::WaitForSingleObject((HANDLE)hThread, INFINITE); | |
46 | } | |
47 | ||
e2478fde VZ |
48 | // ============================================================================ |
49 | // wxConsoleAppTraits implementation | |
50 | // ============================================================================ | |
51 | ||
52 | void wxConsoleAppTraits::AlwaysYield() | |
53 | { | |
686ecd15 VZ |
54 | // we need to use special logic to deal with WM_PAINT: as this pseudo |
55 | // message is generated automatically as long as there are invalidated | |
56 | // windows belonging to this thread, we'd never return if we waited here | |
57 | // until we have no more of them left. OTOH, this message is always the | |
58 | // last one in the queue, so we can safely return as soon as we detect it | |
e2478fde VZ |
59 | MSG msg; |
60 | while ( ::PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) ) | |
686ecd15 VZ |
61 | { |
62 | if ( msg.message == WM_PAINT ) | |
63 | break; | |
64 | } | |
e2478fde VZ |
65 | } |
66 | ||
67 | void *wxConsoleAppTraits::BeforeChildWaitLoop() | |
68 | { | |
69 | // nothing to do here | |
70 | return NULL; | |
71 | } | |
72 | ||
73 | void wxConsoleAppTraits::AfterChildWaitLoop(void * WXUNUSED(data)) | |
74 | { | |
75 | // nothing to do here | |
76 | } | |
77 | ||
78 | bool wxConsoleAppTraits::DoMessageFromThreadWait() | |
79 | { | |
80 | // nothing to process here | |
81 | return true; | |
82 | } | |
83 | ||
c2ca375c VZ |
84 | wxTimerImpl * |
85 | wxConsoleAppTraits::CreateTimerImpl(wxTimer *timer) | |
86 | { | |
87 | return new wxMSWTimerImpl(timer); | |
88 | } | |
89 | ||
90 | ||
e570a44b VZ |
91 | WXDWORD wxConsoleAppTraits::WaitForThread(WXHANDLE hThread) |
92 | { | |
535920ff | 93 | return DoSimpleWaitForThread(hThread); |
e570a44b VZ |
94 | } |
95 |