X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8e5ec129614e2473fd240f2a6e94ee56e3a9039b..5b8ee5dec95988e3931c5394fbeb607e48fb2931:/src/msw/combo.cpp diff --git a/src/msw/combo.cpp b/src/msw/combo.cpp index 401dc1033d..124204b43f 100644 --- a/src/msw/combo.cpp +++ b/src/msw/combo.cpp @@ -135,7 +135,7 @@ bool wxComboCtrl::Create(wxWindow *parent, CreateTextCtrl( wxNO_BORDER, validator ); // Add keyboard input handlers for main control and textctrl - InstallInputHandlers( true ); + InstallInputHandlers(); // Prepare background for double-buffering SetBackgroundStyle( wxBG_STYLE_CUSTOM ); @@ -529,5 +529,39 @@ wxCoord wxComboCtrl::GetNativeTextIndent() const return NATIVE_TEXT_INDENT_CLASSIC; } +bool wxComboCtrl::IsKeyPopupToggle(const wxKeyEvent& event) const +{ + const bool isPopupShown = IsPopupShown(); + + switch ( event.GetKeyCode() ) + { + case WXK_F4: + // F4 toggles the popup in the native comboboxes, so emulate them + if ( !event.AltDown() ) + return true; + break; + + case WXK_ESCAPE: + if ( isPopupShown ) + return true; + break; + + case WXK_DOWN: + case WXK_UP: + // On XP or with writable combo in Classic, arrows don't open the + // popup but Alt-arrow does + if ( event.AltDown() || + ( !isPopupShown && + HasFlag(wxCB_READONLY) && + !wxUxThemeEngine::GetIfActive() + ) ) + { + return true; + } + break; + } + + return false; +} #endif // wxUSE_COMBOCTRL