X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/655719367ac5e131d9642e5783f3ecf64d1a3385..78a87a5d73f90996161912b8a2ee257834f6f8fb:/src/msw/app.cpp diff --git a/src/msw/app.cpp b/src/msw/app.cpp index b7ea221656..2cf9c66e86 100644 --- a/src/msw/app.cpp +++ b/src/msw/app.cpp @@ -100,18 +100,16 @@ extern void wxSetKeyboardHook(bool doIt); // NB: all "NoRedraw" classes must have the same names as the "normal" classes // with NR suffix - wxWindow::MSWCreate() supposes this #ifdef __WXWINCE__ - wxChar *wxCanvasClassName; - wxChar *wxCanvasClassNameNR; +WXDLLIMPEXP_CORE wxChar *wxCanvasClassName; +WXDLLIMPEXP_CORE wxChar *wxCanvasClassNameNR; #else -const wxChar *wxCanvasClassName = wxT("wxWindowClass"); -const wxChar *wxCanvasClassNameNR = wxT("wxWindowClassNR"); +WXDLLIMPEXP_CORE const wxChar *wxCanvasClassName = wxT("wxWindowClass"); +WXDLLIMPEXP_CORE const wxChar *wxCanvasClassNameNR = wxT("wxWindowClassNR"); #endif -const wxChar *wxMDIFrameClassName = wxT("wxMDIFrameClass"); -const wxChar *wxMDIFrameClassNameNoRedraw = wxT("wxMDIFrameClassNR"); -const wxChar *wxMDIChildFrameClassName = wxT("wxMDIChildFrameClass"); -const wxChar *wxMDIChildFrameClassNameNoRedraw = wxT("wxMDIChildFrameClassNR"); - -HBRUSH wxDisableButtonBrush = (HBRUSH) 0; +WXDLLIMPEXP_CORE const wxChar *wxMDIFrameClassName = wxT("wxMDIFrameClass"); +WXDLLIMPEXP_CORE const wxChar *wxMDIFrameClassNameNoRedraw = wxT("wxMDIFrameClassNR"); +WXDLLIMPEXP_CORE const wxChar *wxMDIChildFrameClassName = wxT("wxMDIChildFrameClass"); +WXDLLIMPEXP_CORE const wxChar *wxMDIChildFrameClassNameNoRedraw = wxT("wxMDIChildFrameClassNR"); // ---------------------------------------------------------------------------- // private functions @@ -185,7 +183,7 @@ void wxGUIAppTraits::AfterChildWaitLoop(void *dataOrig) { wxEndBusyCursor(); - const ChildWaitLoopData * const data = (ChildWaitLoopData *)dataOrig; + ChildWaitLoopData * const data = (ChildWaitLoopData *)dataOrig; delete data->wd; @@ -193,6 +191,9 @@ void wxGUIAppTraits::AfterChildWaitLoop(void *dataOrig) // the other windows reenabled, the activation is going to return to the // window which had had it before data->winActive->Destroy(); + + // also delete the temporary data object itself + delete data; } bool wxGUIAppTraits::DoMessageFromThreadWait() @@ -290,7 +291,7 @@ bool wxApp::Initialize(int& argc, wxChar **argv) MB_ICONERROR | MB_OK ); - return FALSE; + return false; } #endif // wxUSE_UNICODE && !wxUSE_UNICODE_MSLU @@ -313,30 +314,8 @@ bool wxApp::Initialize(int& argc, wxChar **argv) #endif // wxUSE_OLE -#if wxUSE_CTL3D - if (!Ctl3dRegister(wxhInstance)) - wxLogError(wxT("Cannot register CTL3D")); - - Ctl3dAutoSubclass(wxhInstance); -#endif // wxUSE_CTL3D - RegisterWindowClasses(); -#if defined(__WXMICROWIN__) && !defined(__WXWINCE__) - // Create the brush for disabling bitmap buttons - - LOGBRUSH lb; - lb.lbStyle = BS_PATTERN; - lb.lbColor = 0; - lb.lbHatch = (int)LoadBitmap( wxhInstance, wxT("wxDISABLE_BUTTON_BITMAP") ); - if ( lb.lbHatch ) - { - wxDisableButtonBrush = ::CreateBrushIndirect( & lb ); - ::DeleteObject( (HGDIOBJ)lb.lbHatch ); - } - //else: wxWidgets resources are probably not linked in -#endif - #if wxUSE_PENWINDOWS wxRegisterPenWin(); #endif @@ -344,7 +323,7 @@ bool wxApp::Initialize(int& argc, wxChar **argv) wxWinHandleHash = new wxWinHashTable(wxKEY_INTEGER, 100); #if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) - wxSetKeyboardHook(TRUE); + wxSetKeyboardHook(true); #endif callBaseCleanup.Dismiss(); @@ -374,8 +353,8 @@ bool wxApp::RegisterWindowClasses() wndclass.hInstance = wxhInstance; wndclass.hCursor = ::LoadCursor((HINSTANCE)NULL, IDC_ARROW); - // Register the frame window class. - wndclass.hbrBackground = (HBRUSH)(COLOR_APPWORKSPACE + 1); + // register the class for all normal windows + wndclass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); wndclass.lpszClassName = wxCanvasClassName; wndclass.style = styleNormal; @@ -431,7 +410,7 @@ bool wxApp::RegisterWindowClasses() wxLogLastError(wxT("RegisterClass(no redraw MDI child)")); } - return TRUE; + return true; } // --------------------------------------------------------------------------- @@ -440,7 +419,7 @@ bool wxApp::RegisterWindowClasses() bool wxApp::UnregisterWindowClasses() { - bool retval = TRUE; + bool retval = true; #ifndef __WXMICROWIN__ // MDI frame window class. @@ -448,7 +427,7 @@ bool wxApp::UnregisterWindowClasses() { wxLogLastError(wxT("UnregisterClass(MDI parent)")); - retval = FALSE; + retval = false; } // "no redraw" MDI frame @@ -456,7 +435,7 @@ bool wxApp::UnregisterWindowClasses() { wxLogLastError(wxT("UnregisterClass(no redraw MDI parent frame)")); - retval = FALSE; + retval = false; } // MDI child frame window class. @@ -464,7 +443,7 @@ bool wxApp::UnregisterWindowClasses() { wxLogLastError(wxT("UnregisterClass(MDI child)")); - retval = FALSE; + retval = false; } // "no redraw" MDI child frame @@ -472,7 +451,7 @@ bool wxApp::UnregisterWindowClasses() { wxLogLastError(wxT("UnregisterClass(no redraw MDI child)")); - retval = FALSE; + retval = false; } // canvas class name @@ -480,14 +459,14 @@ bool wxApp::UnregisterWindowClasses() { wxLogLastError(wxT("UnregisterClass(canvas)")); - retval = FALSE; + retval = false; } if ( !::UnregisterClass(wxCanvasClassNameNR, wxhInstance) ) { wxLogLastError(wxT("UnregisterClass(no redraw canvas)")); - retval = FALSE; + retval = false; } #endif // __WXMICROWIN__ @@ -503,16 +482,13 @@ void wxApp::CleanUp() wxAppBase::CleanUp(); #if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) - wxSetKeyboardHook(FALSE); + wxSetKeyboardHook(false); #endif #if wxUSE_PENWINDOWS wxCleanUpPenWin(); #endif - if ( wxDisableButtonBrush ) - ::DeleteObject( wxDisableButtonBrush ); - #if wxUSE_OLE #ifdef __WXWINCE__ ::CoUninitialize(); @@ -527,10 +503,6 @@ void wxApp::CleanUp() // unregister the classes now UnregisterWindowClasses(); -#if wxUSE_CTL3D - Ctl3dUnregister(wxhInstance); -#endif - delete wxWinHandleHash; wxWinHandleHash = NULL; @@ -605,7 +577,7 @@ void wxApp::WakeUpIdle() void wxApp::OnEndSession(wxCloseEvent& WXUNUSED(event)) { if (GetTopWindow()) - GetTopWindow()->Close(TRUE); + GetTopWindow()->Close(true); } // Default behaviour: close the application with prompts. The @@ -615,7 +587,7 @@ void wxApp::OnQueryEndSession(wxCloseEvent& event) if (GetTopWindow()) { if (!GetTopWindow()->Close(!event.CanVeto())) - event.Veto(TRUE); + event.Veto(true); } } @@ -626,8 +598,7 @@ void wxApp::OnQueryEndSession(wxCloseEvent& event) /* static */ int wxApp::GetComCtl32Version() { -//FIX ME FOR DIGITALMARS!! -#if defined(__WXMICROWIN__) || defined(__WXWINCE__) || defined(__DIGITALMARS__) +#if defined(__WXMICROWIN__) || defined(__WXWINCE__) return 0; #else // cache the result @@ -714,7 +685,7 @@ int wxApp::GetComCtl32Version() bool wxApp::Yield(bool onlyIfNeeded) { // MT-FIXME - static bool s_inYield = FALSE; + static bool s_inYield = false; #if wxUSE_LOG // disable log flushing from here because a call to wxYield() shouldn't @@ -729,10 +700,10 @@ bool wxApp::Yield(bool onlyIfNeeded) wxFAIL_MSG( wxT("wxYield called recursively" ) ); } - return FALSE; + return false; } - s_inYield = TRUE; + s_inYield = true; // we don't want to process WM_QUIT from here - it should be processed in // the main event loop in order to stop it @@ -756,9 +727,9 @@ bool wxApp::Yield(bool onlyIfNeeded) wxLog::Resume(); #endif // wxUSE_LOG - s_inYield = FALSE; + s_inYield = false; - return TRUE; + return true; } #if wxUSE_EXCEPTIONS @@ -801,3 +772,33 @@ terminate the program,\r\n\ } #endif // wxUSE_EXCEPTIONS + +// ---------------------------------------------------------------------------- +// deprecated event loop functions +// ---------------------------------------------------------------------------- + +#if WXWIN_COMPATIBILITY_2_4 + +#include "wx/evtloop.h" + +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 +