]> git.saurik.com Git - wxWidgets.git/blob - src/msw/basemsw.cpp
XRC spec: document the "focused" window property.
[wxWidgets.git] / src / msw / basemsw.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/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 // Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwindows.org>
8 // Licence: wxWindows licence
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
27 #include "wx/event.h"
28 #endif //WX_PRECOMP
29
30 #include "wx/apptrait.h"
31 #include "wx/evtloop.h"
32 #include "wx/msw/private/timer.h"
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"
37
38 #include "wx/crt.h"
39 #include "wx/msw/private.h"
40
41 // ============================================================================
42 // wxAppTraits implementation
43 // ============================================================================
44
45 #if wxUSE_THREADS
46 WXDWORD wxAppTraits::DoSimpleWaitForThread(WXHANDLE hThread)
47 {
48 return ::WaitForSingleObject((HANDLE)hThread, INFINITE);
49 }
50 #endif // wxUSE_THREADS
51
52 // ============================================================================
53 // wxConsoleAppTraits implementation
54 // ============================================================================
55
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
67 #if wxUSE_THREADS
68 bool wxConsoleAppTraits::DoMessageFromThreadWait()
69 {
70 // nothing to process here
71 return true;
72 }
73
74 WXDWORD wxConsoleAppTraits::WaitForThread(WXHANDLE hThread, int WXUNUSED(flags))
75 {
76 return DoSimpleWaitForThread(hThread);
77 }
78 #endif // wxUSE_THREADS
79
80 #if wxUSE_TIMER
81
82 wxTimerImpl *wxConsoleAppTraits::CreateTimerImpl(wxTimer *timer)
83 {
84 return new wxMSWTimerImpl(timer);
85 }
86
87 #endif // wxUSE_TIMER
88
89 wxEventLoopBase *wxConsoleAppTraits::CreateEventLoop()
90 {
91 #if wxUSE_CONSOLE_EVENTLOOP
92 return new wxEventLoop();
93 #else // !wxUSE_CONSOLE_EVENTLOOP
94 return NULL;
95 #endif // wxUSE_CONSOLE_EVENTLOOP/!wxUSE_CONSOLE_EVENTLOOP
96 }
97
98
99 bool wxConsoleAppTraits::WriteToStderr(const wxString& text)
100 {
101 return wxFprintf(stderr, "%s", text) != -1;
102 }