]> git.saurik.com Git - wxWidgets.git/blob - src/msw/basemsw.cpp
Reverse hierarchy of wxPizza GdkWindows
[wxWidgets.git] / src / msw / basemsw.cpp
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>
9 // License: wxWindows licence
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 #include "wx/event.h"
29 #endif //WX_PRECOMP
30
31 #include "wx/apptrait.h"
32 #include "wx/evtloop.h"
33 #include "wx/msw/private/timer.h"
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"
38
39 #include "wx/crt.h"
40 #include "wx/msw/private.h"
41
42 // ============================================================================
43 // wxAppTraits implementation
44 // ============================================================================
45
46 WXDWORD wxAppTraits::DoSimpleWaitForThread(WXHANDLE hThread)
47 {
48 return ::WaitForSingleObject((HANDLE)hThread, INFINITE);
49 }
50
51 // ============================================================================
52 // wxConsoleAppTraits implementation
53 // ============================================================================
54
55 void *wxConsoleAppTraits::BeforeChildWaitLoop()
56 {
57 // nothing to do here
58 return NULL;
59 }
60
61 void wxConsoleAppTraits::AfterChildWaitLoop(void * WXUNUSED(data))
62 {
63 // nothing to do here
64 }
65
66 bool wxConsoleAppTraits::DoMessageFromThreadWait()
67 {
68 // nothing to process here
69 return true;
70 }
71
72 #if wxUSE_TIMER
73
74 wxTimerImpl *wxConsoleAppTraits::CreateTimerImpl(wxTimer *timer)
75 {
76 return new wxMSWTimerImpl(timer);
77 }
78
79 #endif // wxUSE_TIMER
80
81 wxEventLoopBase *wxConsoleAppTraits::CreateEventLoop()
82 {
83 #if wxUSE_CONSOLE_EVENTLOOP
84 return new wxEventLoop();
85 #else // !wxUSE_CONSOLE_EVENTLOOP
86 return NULL;
87 #endif // wxUSE_CONSOLE_EVENTLOOP/!wxUSE_CONSOLE_EVENTLOOP
88 }
89
90
91 WXDWORD wxConsoleAppTraits::WaitForThread(WXHANDLE hThread)
92 {
93 return DoSimpleWaitForThread(hThread);
94 }
95
96 bool wxConsoleAppTraits::WriteToStderr(const wxString& text)
97 {
98 return wxFprintf(stderr, "%s", text) != -1;
99 }