X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9482617091b084d4ee006679a450176715d465e0..0b7824d78a475810924776e02004723cc4e20c84:/src/msw/app.cpp diff --git a/src/msw/app.cpp b/src/msw/app.cpp index d0adf0525b..03551b3c17 100644 --- a/src/msw/app.cpp +++ b/src/msw/app.cpp @@ -111,7 +111,7 @@ #if _WIN32_IE >= 0x0300 && \ (!defined(__MINGW32__) || wxCHECK_W32API_VERSION( 2, 0 )) && \ - !defined(__CYGWIN__) + !defined(__CYGWIN__) && !defined(__WXWINCE__) #include #endif @@ -119,9 +119,9 @@ // global variables // --------------------------------------------------------------------------- -extern wxChar *wxBuffer; extern wxList WXDLLEXPORT wxPendingDelete; -#ifndef __WXMICROWIN__ + +#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) extern void wxSetKeyboardHook(bool doIt); #endif @@ -190,8 +190,8 @@ void *wxGUIAppTraits::BeforeChildWaitLoop() wxWindow *winActive = new wxFrame ( wxTheApp->GetTopWindow(), - -1, - _T(""), + wxID_ANY, + wxEmptyString, wxPoint(32600, 32600), wxSize(1, 1), wxDEFAULT_FRAME_STYLE | wxFRAME_NO_TASKBAR @@ -258,7 +258,7 @@ private: }; //// Initialize -bool wxApp::Initialize(int argc, wxChar **argv) +bool wxApp::Initialize(int& argc, wxChar **argv) { if ( !wxAppBase::Initialize(argc, argv) ) return false; @@ -270,7 +270,7 @@ bool wxApp::Initialize(int argc, wxChar **argv) // program under Win9x w/o MSLU emulation layer - if so, abort right now // as it has no chance to work #if wxUSE_UNICODE && !wxUSE_UNICODE_MSLU - if ( wxGetOsVersion() != wxWINDOWS_NT ) + if ( wxGetOsVersion() != wxWINDOWS_NT && wxGetOsVersion() != wxWINDOWS_CE ) { // note that we can use MessageBoxW() as it's implemented even under // Win9x - OTOH, we can't use wxGetTranslation() because the file APIs @@ -278,7 +278,7 @@ bool wxApp::Initialize(int argc, wxChar **argv) ::MessageBox ( NULL, - _T("This program uses Unicode and requires Windows NT/2000/XP.\nProgram aborted."), + _T("This program uses Unicode and requires Windows NT/2000/XP/CE.\nProgram aborted."), _T("wxWindows Fatal Error"), MB_ICONERROR | MB_OK ); @@ -287,8 +287,6 @@ bool wxApp::Initialize(int argc, wxChar **argv) } #endif // wxUSE_UNICODE && !wxUSE_UNICODE_MSLU - wxBuffer = new wxChar[1500]; // FIXME - #if defined(__WIN95__) && !defined(__WXMICROWIN__) InitCommonControls(); #endif // __WIN95__ @@ -304,9 +302,14 @@ bool wxApp::Initialize(int argc, wxChar **argv) #if wxUSE_OLE // we need to initialize OLE library +#ifdef __WXWINCE__ + if ( FAILED(::CoInitializeEx(NULL, COINIT_MULTITHREADED)) ) + wxLogError(_("Cannot initialize OLE")); +#else if ( FAILED(::OleInitialize(NULL)) ) wxLogError(_("Cannot initialize OLE")); #endif +#endif #endif // wxUSE_OLE @@ -319,7 +322,7 @@ bool wxApp::Initialize(int argc, wxChar **argv) RegisterWindowClasses(); -#ifndef __WXMICROWIN__ +#if defined(__WXMICROWIN__) && !defined(__WXWINCE__) // Create the brush for disabling bitmap buttons LOGBRUSH lb; @@ -347,7 +350,7 @@ bool wxApp::Initialize(int argc, wxChar **argv) if (wxDummyChar) wxDummyChar++; #endif -#ifndef __WXMICROWIN__ +#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) wxSetKeyboardHook(TRUE); #endif @@ -500,10 +503,7 @@ bool wxApp::UnregisterWindowClasses() void wxApp::CleanUp() { - delete[] wxBuffer; - wxBuffer = NULL; - -#ifndef __WXMICROWIN__ +#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) wxSetKeyboardHook(FALSE); #endif @@ -515,7 +515,11 @@ void wxApp::CleanUp() ::DeleteObject( wxDisableButtonBrush ); #if wxUSE_OLE +#ifdef __WXWINCE__ + ::CoUninitialize(); +#else ::OleUninitialize(); +#endif #endif // for an EXE the classes are unregistered when it terminates but DLL may @@ -690,16 +694,6 @@ int wxApp::MainLoop() return s_currentMsg.wParam; } -// Returns TRUE if more time is needed. -bool wxApp::ProcessIdle() -{ - wxIdleEvent event; - event.SetEventObject(this); - ProcessEvent(event); - - return event.MoreRequested(); -} - void wxApp::ExitMainLoop() { // this will set m_keepGoing to FALSE a bit later @@ -808,23 +802,8 @@ void wxApp::OnIdle(wxIdleEvent& event) return; wxIsInOnIdleFlag = TRUE; - - // If there are pending events, we must process them: pending events - // are either events to the threads other than main or events posted - // with wxPostEvent() functions - // GRG: I have moved this here so that all pending events are processed - // before starting to delete any objects. This behaves better (in - // particular, wrt wxPostEvent) and is coherent with wxGTK's current - // behaviour. Changed Feb/2000 before 2.1.14 - ProcessPendingEvents(); - - // 'Garbage' collection of windows deleted with Close(). - DeletePendingObjects(); - -#if wxUSE_LOG - // flush the logged messages if any - wxLog::FlushActive(); -#endif // wxUSE_LOG + + wxAppBase::OnIdle(event); #if wxUSE_DC_CACHEING // automated DC cache management: clear the cached DCs and bitmap @@ -834,56 +813,9 @@ void wxApp::OnIdle(wxIdleEvent& event) wxDC::ClearCache(); #endif // wxUSE_DC_CACHEING - // Send OnIdle events to all windows - if ( SendIdleEvents() ) - { - // SendIdleEvents() returns TRUE if at least one window requested more - // idle events - event.RequestMore(TRUE); - } - wxIsInOnIdleFlag = FALSE; } -// Send idle event to all top-level windows -bool wxApp::SendIdleEvents() -{ - bool needMore = FALSE; - - wxWindowList::Node* node = wxTopLevelWindows.GetFirst(); - while (node) - { - wxWindow* win = node->GetData(); - if (SendIdleEvents(win)) - needMore = TRUE; - node = node->GetNext(); - } - - return needMore; -} - -// Send idle event to window and all subwindows -bool wxApp::SendIdleEvents(wxWindow* win) -{ - wxIdleEvent event; - event.SetEventObject(win); - win->GetEventHandler()->ProcessEvent(event); - - bool needMore = event.MoreRequested(); - - wxWindowList::Node *node = win->GetChildren().GetFirst(); - while ( node ) - { - wxWindow *win = node->GetData(); - if (SendIdleEvents(win)) - needMore = TRUE; - - node = node->GetNext(); - } - - return needMore; -} - void wxApp::WakeUpIdle() { // Send the top window a dummy message so idle handler processing will @@ -932,7 +864,7 @@ typedef HRESULT (CALLBACK* WXADLLGETVERSIONPROC)(WXADLLVERSIONINFO *); /* static */ int wxApp::GetComCtl32Version() { -#ifdef __WXMICROWIN__ +#if defined(__WXMICROWIN__) || defined(__WXWINCE__) return 0; #else // cache the result