]>
Commit | Line | Data |
---|---|---|
e2478fde | 1 | /////////////////////////////////////////////////////////////////////////////// |
80fdcdb9 | 2 | // Name: src/msw/basemsw.cpp |
e2478fde VZ |
3 | // Purpose: misc stuff only used in console applications under MSW |
4 | // Author: Vadim Zeitlin | |
5 | // Modified by: | |
6 | // Created: 22.06.2003 | |
e2478fde | 7 | // Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwindows.org> |
526954c5 | 8 | // Licence: wxWindows licence |
e2478fde VZ |
9 | /////////////////////////////////////////////////////////////////////////////// |
10 | ||
11 | // ============================================================================ | |
12 | // declarations | |
13 | // ============================================================================ | |
14 | ||
15 | // ---------------------------------------------------------------------------- | |
16 | // headers | |
17 | // ---------------------------------------------------------------------------- | |
18 | ||
19 | // for compilers that support precompilation, includes "wx.h". | |
20 | #include "wx/wxprec.h" | |
21 | ||
22 | #ifdef __BORLANDC__ | |
23 | #pragma hdrstop | |
24 | #endif | |
25 | ||
26 | #ifndef WX_PRECOMP | |
8bd9fa33 | 27 | #include "wx/event.h" |
e2478fde VZ |
28 | #endif //WX_PRECOMP |
29 | ||
30 | #include "wx/apptrait.h" | |
b46b1d59 | 31 | #include "wx/evtloop.h" |
c2ca375c | 32 | #include "wx/msw/private/timer.h" |
548bf4b7 MB |
33 | // MBN: this is a workaround for MSVC 5: if it is not #included in |
34 | // some wxBase file, wxRecursionGuard methods won't be exported from | |
35 | // wxBase.dll, and MSVC 5 will give linker errors | |
36 | #include "wx/recguard.h" | |
e2478fde | 37 | |
4081eb6f | 38 | #include "wx/crt.h" |
e2478fde VZ |
39 | #include "wx/msw/private.h" |
40 | ||
535920ff VZ |
41 | // ============================================================================ |
42 | // wxAppTraits implementation | |
43 | // ============================================================================ | |
44 | ||
dd1af40c | 45 | #if wxUSE_THREADS |
535920ff VZ |
46 | WXDWORD wxAppTraits::DoSimpleWaitForThread(WXHANDLE hThread) |
47 | { | |
48 | return ::WaitForSingleObject((HANDLE)hThread, INFINITE); | |
49 | } | |
dd1af40c | 50 | #endif // wxUSE_THREADS |
535920ff | 51 | |
e2478fde VZ |
52 | // ============================================================================ |
53 | // wxConsoleAppTraits implementation | |
54 | // ============================================================================ | |
55 | ||
e2478fde VZ |
56 | void *wxConsoleAppTraits::BeforeChildWaitLoop() |
57 | { | |
58 | // nothing to do here | |
59 | return NULL; | |
60 | } | |
61 | ||
62 | void wxConsoleAppTraits::AfterChildWaitLoop(void * WXUNUSED(data)) | |
63 | { | |
64 | // nothing to do here | |
65 | } | |
66 | ||
dd1af40c | 67 | #if wxUSE_THREADS |
e2478fde VZ |
68 | bool wxConsoleAppTraits::DoMessageFromThreadWait() |
69 | { | |
70 | // nothing to process here | |
71 | return true; | |
72 | } | |
73 | ||
dd1af40c VZ |
74 | WXDWORD wxConsoleAppTraits::WaitForThread(WXHANDLE hThread, int WXUNUSED(flags)) |
75 | { | |
76 | return DoSimpleWaitForThread(hThread); | |
77 | } | |
78 | #endif // wxUSE_THREADS | |
79 | ||
a8ff046b VZ |
80 | #if wxUSE_TIMER |
81 | ||
b46b1d59 | 82 | wxTimerImpl *wxConsoleAppTraits::CreateTimerImpl(wxTimer *timer) |
c2ca375c VZ |
83 | { |
84 | return new wxMSWTimerImpl(timer); | |
85 | } | |
86 | ||
a8ff046b VZ |
87 | #endif // wxUSE_TIMER |
88 | ||
2ddff00c | 89 | wxEventLoopBase *wxConsoleAppTraits::CreateEventLoop() |
b46b1d59 | 90 | { |
e0f88b1a | 91 | #if wxUSE_CONSOLE_EVENTLOOP |
b46b1d59 | 92 | return new wxEventLoop(); |
e0f88b1a VZ |
93 | #else // !wxUSE_CONSOLE_EVENTLOOP |
94 | return NULL; | |
95 | #endif // wxUSE_CONSOLE_EVENTLOOP/!wxUSE_CONSOLE_EVENTLOOP | |
b46b1d59 | 96 | } |
c2ca375c | 97 | |
a8ff046b | 98 | |
784ee7d5 VZ |
99 | bool wxConsoleAppTraits::WriteToStderr(const wxString& text) |
100 | { | |
101 | return wxFprintf(stderr, "%s", text) != -1; | |
102 | } |