]>
git.saurik.com Git - wxWidgets.git/blob - 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
8 // Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwindows.org>
9 // License: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 // for compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
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"
38 #include "wx/msw/private.h"
40 // ============================================================================
41 // wxAppTraits implementation
42 // ============================================================================
44 GSocketManager
*wxAppTraits::ms_manager
= NULL
;
46 WXDWORD
wxAppTraits::DoSimpleWaitForThread(WXHANDLE hThread
)
48 return ::WaitForSingleObject((HANDLE
)hThread
, INFINITE
);
51 // ============================================================================
52 // wxConsoleAppTraits implementation
53 // ============================================================================
55 void wxConsoleAppTraits::AlwaysYield()
57 // we need to use special logic to deal with WM_PAINT: as this pseudo
58 // message is generated automatically as long as there are invalidated
59 // windows belonging to this thread, we'd never return if we waited here
60 // until we have no more of them left. OTOH, this message is always the
61 // last one in the queue, so we can safely return as soon as we detect it
63 while ( ::PeekMessage(&msg
, NULL
, 0, 0, PM_REMOVE
) )
65 if ( msg
.message
== WM_PAINT
)
70 void *wxConsoleAppTraits::BeforeChildWaitLoop()
76 void wxConsoleAppTraits::AfterChildWaitLoop(void * WXUNUSED(data
))
81 bool wxConsoleAppTraits::DoMessageFromThreadWait()
83 // nothing to process here
89 wxTimerImpl
*wxConsoleAppTraits::CreateTimerImpl(wxTimer
*timer
)
91 return new wxMSWTimerImpl(timer
);
96 wxEventLoopBase
*wxConsoleAppTraits::CreateEventLoop()
98 #if wxUSE_CONSOLE_EVENTLOOP
99 return new wxEventLoop();
100 #else // !wxUSE_CONSOLE_EVENTLOOP
102 #endif // wxUSE_CONSOLE_EVENTLOOP/!wxUSE_CONSOLE_EVENTLOOP
106 WXDWORD
wxConsoleAppTraits::WaitForThread(WXHANDLE hThread
)
108 return DoSimpleWaitForThread(hThread
);