X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ac5ada96717ef787e5c371eaecaa25ebc13971b5..61577c614fd7c2d31470485cfb457cbb61441b28:/src/msw/window.cpp diff --git a/src/msw/window.cpp b/src/msw/window.cpp index f6e982303e..3189e52624 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -701,6 +701,110 @@ bool wxWindowMSW::Show(bool show) return true; } +bool +wxWindowMSW::MSWShowWithEffect(bool show, + wxShowEffect effect, + unsigned timeout, + wxDirection dir) +{ + typedef BOOL (WINAPI *AnimateWindow_t)(HWND, DWORD, DWORD); + + static AnimateWindow_t s_pfnAnimateWindow = NULL; + static bool s_initDone = false; + if ( !s_initDone ) + { + wxLogNull noLog; + + wxDynamicLibrary dllUser32(_T("user32.dll"), wxDL_VERBATIM); + wxDL_INIT_FUNC(s_pfn, AnimateWindow, dllUser32); + + s_initDone = true; + + // notice that it's ok to unload user32.dll here as it won't be really + // unloaded, being still in use because we link to it statically too + } + + if ( !s_pfnAnimateWindow ) + return Show(show); + + // prepare to use AnimateWindow() + + if ( !timeout ) + timeout = 200; // this is the default animation timeout, per MSDN + + DWORD dwFlags = show ? 0 : AW_HIDE; + bool needsDir = false; + switch ( effect ) + { + case wxSHOW_EFFECT_ROLL: + needsDir = true; + break; + + case wxSHOW_EFFECT_SLIDE: + needsDir = true; + dwFlags |= AW_SLIDE; + break; + + case wxSHOW_EFFECT_BLEND: + dwFlags |= AW_BLEND; + break; + + case wxSHOW_EFFECT_EXPAND: + dwFlags |= AW_CENTER; + break; + + + case wxSHOW_EFFECT_MAX: + wxFAIL_MSG( _T("invalid window show effect") ); + return false; + + default: + wxFAIL_MSG( _T("unknown window show effect") ); + return false; + } + + if ( needsDir ) + { + switch ( dir ) + { + case wxTOP: + dwFlags |= AW_VER_NEGATIVE; + break; + + case wxBOTTOM: + dwFlags |= AW_VER_POSITIVE; + break; + + case wxLEFT: + dwFlags |= AW_HOR_NEGATIVE; + break; + + case wxRIGHT: + dwFlags |= AW_HOR_POSITIVE; + break; + + default: + wxFAIL_MSG( _T("unknown window effect direction") ); + return false; + } + } + else // animation effect which doesn't need the direction + { + wxASSERT_MSG( dir == wxBOTTOM, + _T("non-default direction used unnecessarily") ); + } + + + if ( !(*s_pfnAnimateWindow)(GetHwnd(), timeout, dwFlags) ) + { + wxLogLastError(_T("AnimateWindow")); + + return false; + } + + return true; +} + // Raise the window to the top of the Z order void wxWindowMSW::Raise() { @@ -2260,10 +2364,10 @@ bool wxWindowMSW::MSWProcessMessage(WXMSG* pMsg) if ( !bCtrlDown ) { // this will contain the dialog code of this - // window and all of its parent windows + // window and all of its parent windows in turn LONG lDlgCode2 = lDlgCode; - while ( win && !win->IsTopLevel() ) + while ( win ) { if ( lDlgCode2 & DLGC_WANTMESSAGE ) { @@ -2273,6 +2377,13 @@ bool wxWindowMSW::MSWProcessMessage(WXMSG* pMsg) return false; } + // don't propagate keyboard messages beyond + // the first top level window parent + if ( win->IsTopLevel() ) + break; + + win = win->GetParent(); + lDlgCode2 = ::SendMessage ( GetHwndOf(win), @@ -2280,8 +2391,6 @@ bool wxWindowMSW::MSWProcessMessage(WXMSG* pMsg) 0, 0 ); - - win = win->GetParent(); } } else // bCtrlDown @@ -5015,7 +5124,7 @@ void wxWindowMSW::InitMouseEvent(wxMouseEvent& event, event.m_aux1Down = (flags & MK_XBUTTON1) != 0; event.m_aux2Down = (flags & MK_XBUTTON2) != 0; #endif // wxHAS_XBUTTON - event.m_altDown = ::GetKeyState(VK_MENU) < 0; + event.m_altDown = ::wxIsAltDown(); #ifndef __WXWINCE__ event.SetTimestamp(::GetMessageTime()); @@ -6056,9 +6165,9 @@ wxMouseState wxGetMouseState() ms.SetAux2Down(wxIsKeyDown(VK_XBUTTON2)); #endif // wxHAS_XBUTTON - ms.SetControlDown(wxIsKeyDown(VK_CONTROL)); - ms.SetShiftDown(wxIsKeyDown(VK_SHIFT)); - ms.SetAltDown(wxIsKeyDown(VK_MENU)); + ms.SetControlDown(wxIsCtrlDown ()); + ms.SetShiftDown (wxIsShiftDown()); + ms.SetAltDown (wxIsAltDown ()); // ms.SetMetaDown(); return ms;