]>
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 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwindows.org> | |
526954c5 | 9 | // Licence: 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 | |
8bd9fa33 | 28 | #include "wx/event.h" |
e2478fde VZ |
29 | #endif //WX_PRECOMP |
30 | ||
31 | #include "wx/apptrait.h" | |
b46b1d59 | 32 | #include "wx/evtloop.h" |
c2ca375c | 33 | #include "wx/msw/private/timer.h" |
548bf4b7 MB |
34 | // MBN: this is a workaround for MSVC 5: if it is not #included in |
35 | // some wxBase file, wxRecursionGuard methods won't be exported from | |
36 | // wxBase.dll, and MSVC 5 will give linker errors | |
37 | #include "wx/recguard.h" | |
e2478fde | 38 | |
4081eb6f | 39 | #include "wx/crt.h" |
e2478fde VZ |
40 | #include "wx/msw/private.h" |
41 | ||
535920ff VZ |
42 | // ============================================================================ |
43 | // wxAppTraits implementation | |
44 | // ============================================================================ | |
45 | ||
dd1af40c | 46 | #if wxUSE_THREADS |
535920ff VZ |
47 | WXDWORD wxAppTraits::DoSimpleWaitForThread(WXHANDLE hThread) |
48 | { | |
49 | return ::WaitForSingleObject((HANDLE)hThread, INFINITE); | |
50 | } | |
dd1af40c | 51 | #endif // wxUSE_THREADS |
535920ff | 52 | |
e2478fde VZ |
53 | // ============================================================================ |
54 | // wxConsoleAppTraits implementation | |
55 | // ============================================================================ | |
56 | ||
e2478fde VZ |
57 | void *wxConsoleAppTraits::BeforeChildWaitLoop() |
58 | { | |
59 | // nothing to do here | |
60 | return NULL; | |
61 | } | |
62 | ||
63 | void wxConsoleAppTraits::AfterChildWaitLoop(void * WXUNUSED(data)) | |
64 | { | |
65 | // nothing to do here | |
66 | } | |
67 | ||
dd1af40c | 68 | #if wxUSE_THREADS |
e2478fde VZ |
69 | bool wxConsoleAppTraits::DoMessageFromThreadWait() |
70 | { | |
71 | // nothing to process here | |
72 | return true; | |
73 | } | |
74 | ||
dd1af40c VZ |
75 | WXDWORD wxConsoleAppTraits::WaitForThread(WXHANDLE hThread, int WXUNUSED(flags)) |
76 | { | |
77 | return DoSimpleWaitForThread(hThread); | |
78 | } | |
79 | #endif // wxUSE_THREADS | |
80 | ||
a8ff046b VZ |
81 | #if wxUSE_TIMER |
82 | ||
b46b1d59 | 83 | wxTimerImpl *wxConsoleAppTraits::CreateTimerImpl(wxTimer *timer) |
c2ca375c VZ |
84 | { |
85 | return new wxMSWTimerImpl(timer); | |
86 | } | |
87 | ||
a8ff046b VZ |
88 | #endif // wxUSE_TIMER |
89 | ||
2ddff00c | 90 | wxEventLoopBase *wxConsoleAppTraits::CreateEventLoop() |
b46b1d59 | 91 | { |
e0f88b1a | 92 | #if wxUSE_CONSOLE_EVENTLOOP |
b46b1d59 | 93 | return new wxEventLoop(); |
e0f88b1a VZ |
94 | #else // !wxUSE_CONSOLE_EVENTLOOP |
95 | return NULL; | |
96 | #endif // wxUSE_CONSOLE_EVENTLOOP/!wxUSE_CONSOLE_EVENTLOOP | |
b46b1d59 | 97 | } |
c2ca375c | 98 | |
a8ff046b | 99 | |
784ee7d5 VZ |
100 | bool wxConsoleAppTraits::WriteToStderr(const wxString& text) |
101 | { | |
102 | return wxFprintf(stderr, "%s", text) != -1; | |
103 | } |