#endif
#ifndef WX_PRECOMP
+ #include "wx/msw/wrapcctl.h"
+ #include "wx/dynarray.h"
#include "wx/frame.h"
#include "wx/app.h"
#include "wx/utils.h"
#include "wx/dialog.h"
#include "wx/msgdlg.h"
#include "wx/intl.h"
- #include "wx/dynarray.h"
- #include "wx/wxchar.h"
- #include "wx/icon.h"
+ #include "wx/crt.h"
#include "wx/log.h"
+ #include "wx/module.h"
#endif
#include "wx/apptrait.h"
#include "wx/filename.h"
-#include "wx/module.h"
#include "wx/dynlib.h"
#include "wx/evtloop.h"
#include "wx/msw/private.h"
#include "wx/msw/ole/oleutils.h"
+#include "wx/msw/private/timer.h"
#if wxUSE_TOOLTIPS
#include "wx/tooltip.h"
#include <string.h>
#include <ctype.h>
-#include "wx/msw/wrapcctl.h"
-
-// For MB_TASKMODAL
-#ifdef __WXWINCE__
-#include "wx/msw/wince/missing.h"
-#endif
+#include "wx/msw/missing.h"
// instead of including <shlwapi.h> which is not part of the core SDK and not
// shipped at all with other compilers, we always define the parts of it we
// global variables
// ---------------------------------------------------------------------------
-extern wxList WXDLLEXPORT wxPendingDelete;
-
#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
extern void wxSetKeyboardHook(bool doIt);
#endif
{
// we should return false only if the app should exit, i.e. only if
// Dispatch() determines that the main event loop should terminate
- wxEventLoop *evtLoop = wxEventLoop::GetActive();
+ wxEventLoopBase * const evtLoop = wxEventLoop::GetActive();
if ( !evtLoop || !evtLoop->Pending() )
{
// no events means no quit event
return evtLoop->Dispatch();
}
-wxToolkitInfo& wxGUIAppTraits::GetToolkitInfo()
+DWORD wxGUIAppTraits::WaitForThread(WXHANDLE hThread)
{
- static wxToolkitInfo info;
- wxToolkitInfo& baseInfo = wxAppTraits::GetToolkitInfo();
- info.versionMajor = baseInfo.versionMajor;
- info.versionMinor = baseInfo.versionMinor;
- info.os = baseInfo.os;
- info.shortName = _T("msw");
- info.name = _T("wxMSW");
-#ifdef __WXUNIVERSAL__
- info.shortName << _T("univ");
- info.name << _T("/wxUniversal");
+ // if we don't have a running event loop, we shouldn't wait for the
+ // messages as we never remove them from the message queue and so we enter
+ // an infinite loop as MsgWaitForMultipleObjects() keeps returning
+ // WAIT_OBJECT_0 + 1
+ if ( !wxEventLoop::GetActive() )
+ return DoSimpleWaitForThread(hThread);
+
+ return ::MsgWaitForMultipleObjects
+ (
+ 1, // number of objects to wait for
+ (HANDLE *)&hThread, // the objects
+ false, // wait for any objects, not all
+ INFINITE, // no timeout
+ QS_ALLINPUT | // return as soon as there are any events
+ QS_ALLPOSTMESSAGE
+ );
+}
+
+wxPortId wxGUIAppTraits::GetToolkitVersion(int *majVer, int *minVer) const
+{
+ OSVERSIONINFO info;
+ wxZeroMemory(info);
+
+ // on Windows, the toolkit version is the same of the OS version
+ // as Windows integrates the OS kernel with the GUI toolkit.
+ info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+ if ( ::GetVersionEx(&info) )
+ {
+ if ( majVer )
+ *majVer = info.dwMajorVersion;
+ if ( minVer )
+ *minVer = info.dwMinorVersion;
+ }
+
+#if defined(__WXHANDHELD__) || defined(__WXWINCE__)
+ return wxPORT_WINCE;
+#else
+ return wxPORT_MSW;
#endif
- return info;
+}
+
+#if wxUSE_TIMER
+
+wxTimerImpl *wxGUIAppTraits::CreateTimerImpl(wxTimer *timer)
+{
+ return new wxMSWTimerImpl(timer);
+}
+
+#endif // wxUSE_TIMER
+
+wxEventLoopBase* wxGUIAppTraits::CreateEventLoop()
+{
+ return new wxEventLoop;
}
// ===========================================================================
#ifdef __WXWINCE__
wxString tmp = GetAppName();
tmp += wxT("ClassName");
- wxCanvasClassName = wxStrdup( tmp.c_str() );
+ wxCanvasClassName = wxStrdup( tmp.wc_str() );
tmp += wxT("NR");
- wxCanvasClassNameNR = wxStrdup( tmp.c_str() );
+ wxCanvasClassNameNR = wxStrdup( tmp.wc_str() );
HWND hWnd = FindWindow( wxCanvasClassNameNR, NULL );
if (hWnd)
{
// fails to find a device.
SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOOPENFILEERRORBOX);
#endif
-
+
wxOleInitialize();
RegisterWindowClasses();
// wxApp idle handling
// ----------------------------------------------------------------------------
-void wxApp::OnIdle(wxIdleEvent& event)
+void wxApp::OnIdle(wxIdleEvent& WXUNUSED(event))
{
- wxAppBase::OnIdle(event);
-
#if wxUSE_DC_CACHEING
// automated DC cache management: clear the cached DCs and bitmap
// if it's likely that the app has finished with them, that is, we
// we're prepared to handle the errors
wxLogNull noLog;
-
+
#if wxUSE_DYNLIB_CLASS
// do we have it?
wxDynamicLibrary dllComCtl32(_T("comctl32.dll"), wxDL_VERBATIM);
}
}
}
-#endif
+#endif
}
return s_verComCtl32;
}
#endif // wxUSE_EXCEPTIONS
-
-// ----------------------------------------------------------------------------
-// deprecated event loop functions
-// ----------------------------------------------------------------------------
-
-#if WXWIN_COMPATIBILITY_2_4
-
-void wxApp::DoMessage(WXMSG *pMsg)
-{
- wxEventLoop *evtLoop = wxEventLoop::GetActive();
- if ( evtLoop )
- evtLoop->ProcessMessage(pMsg);
-}
-
-bool wxApp::DoMessage()
-{
- wxEventLoop *evtLoop = wxEventLoop::GetActive();
- return evtLoop ? evtLoop->Dispatch() : false;
-}
-
-bool wxApp::ProcessMessage(WXMSG* pMsg)
-{
- wxEventLoop *evtLoop = wxEventLoop::GetActive();
- return evtLoop && evtLoop->PreProcessMessage(pMsg);
-}
-
-#endif // WXWIN_COMPATIBILITY_2_4