X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/24e35cf87b9350d0d114fa8db0e2f5bef6410139..f46ad98f0df1e1b073a484cb34a91e2e1278fdb7:/src/msw/window.cpp?ds=sidebyside diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 67d2a2dab3..4522e1bfc2 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -829,7 +829,7 @@ void wxWindowMSW::MSWUpdateUIState(int action, int state) if ( s_needToUpdate == -1 ) { int verMaj, verMin; - s_needToUpdate = wxGetOsVersion(&verMaj, &verMin) == wxWINDOWS_NT && + s_needToUpdate = wxGetOsVersion(&verMaj, &verMin) == wxOS_WINDOWS_NT && verMaj >= 5; } @@ -2119,13 +2119,15 @@ bool wxWindowMSW::MSWProcessMessage(WXMSG* pMsg) if ( (lDlgCode & DLGC_WANTMESSAGE) && !bCtrlDown ) { // control wants to process Enter itself, don't - // call IsDialogMessage() which would interpret - // it + // call IsDialogMessage() which would consume it return false; } +#if wxUSE_BUTTON // currently active button should get enter press even - // if there is a default button elsewhere + // if there is a default button elsewhere so check if + // this window is a button first + wxWindow *btn = NULL; if ( lDlgCode & DLGC_DEFPUSHBUTTON ) { // let IsDialogMessage() handle this for all @@ -2135,56 +2137,38 @@ bool wxWindowMSW::MSWProcessMessage(WXMSG* pMsg) if ( (style & BS_OWNERDRAW) == BS_OWNERDRAW ) { // emulate the button click - wxWindow * - btn = wxFindWinFromHandle((WXHWND)msg->hwnd); - if ( btn ) - btn->MSWCommand(BN_CLICKED, 0 /* unused */); + btn = wxFindWinFromHandle((WXHWND)msg->hwnd); } bProcess = false; } - else // not a button itself + else // not a button itself, do we have default button? { -#if wxUSE_BUTTON - wxButton *btn = wxDynamicCast(GetDefaultItem(), - wxButton); - if ( btn && btn->IsEnabled() ) + wxTopLevelWindow * + tlw = wxDynamicCast(wxGetTopLevelParent(this), + wxTopLevelWindow); + if ( tlw ) { - // if we do have a default button, do press it - btn->MSWCommand(BN_CLICKED, 0 /* unused */); - - return true; + btn = wxDynamicCast(tlw->GetDefaultItem(), + wxButton); } - else // no default button + } + + if ( btn && btn->IsEnabled() ) + { + btn->MSWCommand(BN_CLICKED, 0 /* unused */); + return true; + } + #endif // wxUSE_BUTTON - { + #ifdef __WXWINCE__ - wxJoystickEvent event(wxEVT_JOY_BUTTON_DOWN); - event.SetEventObject(this); - if(GetEventHandler()->ProcessEvent(event)) - return true; -#endif - // this is a quick and dirty test for a text - // control - if ( !(lDlgCode & DLGC_HASSETSEL) ) - { - // don't process Enter, the control might - // need it for itself and don't let - // ::IsDialogMessage() have it as it can - // eat the Enter events sometimes - return false; - } - else if (!IsTopLevel()) - { - // if not a top level window, let parent - // handle it - return false; - } - //else: treat Enter as TAB: pass to the next - // control as this is the best thing to do - // if the text doesn't handle Enter itself - } - } + // map Enter presses into button presses on PDAs + wxJoystickEvent event(wxEVT_JOY_BUTTON_DOWN); + event.SetEventObject(this); + if ( GetEventHandler()->ProcessEvent(event) ) + return true; +#endif // __WXWINCE__ } break; @@ -4104,9 +4088,13 @@ bool wxWindowMSW::HandlePaletteChanged(WXHWND hWndPalChange) bool wxWindowMSW::HandleCaptureChanged(WXHWND hWndGainedCapture) { - wxMouseCaptureChangedEvent event(GetId(), wxFindWinFromHandle(hWndGainedCapture)); - event.SetEventObject(this); + // notify windows on the capture stack about lost capture + // (see http://sourceforge.net/tracker/index.php?func=detail&aid=1153662&group_id=9863&atid=109863): + wxWindowBase::NotifyCaptureLost(); + wxWindow *win = wxFindWinFromHandle(hWndGainedCapture); + wxMouseCaptureChangedEvent event(GetId(), win); + event.SetEventObject(this); return GetEventHandler()->ProcessEvent(event); } @@ -4409,7 +4397,7 @@ WXHBRUSH wxWindowMSW::MSWGetBgBrush(WXHDC hDC, WXHWND hWndToPaint) return 0; } -bool wxWindowMSW::HandlePrintClient(WXHDC hDC) +bool wxWindowMSW::HandlePrintClient(WXHDC WXUNUSED(hDC)) { // TODO: handle wxBG_STYLE_CUSTOM and/or wxBG_STYLE_COLOUR here so when // DrawParentThemeBackground() from uxtheme.dll is called we don't get