X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/93f7f8be7ee1df8f5d449a072036f2433a387ab9..5942996c94a82dcbedf7b1041b08acd8d1d97449:/src/generic/combog.cpp diff --git a/src/generic/combog.cpp b/src/generic/combog.cpp index 84d31db480..4e602748e8 100644 --- a/src/generic/combog.cpp +++ b/src/generic/combog.cpp @@ -161,7 +161,7 @@ bool wxGenericComboControl::Create(wxWindow *parent, CreateTextCtrl( wxNO_BORDER, validator ); // Add keyboard input handlers for main control and textctrl - InstallInputHandlers( true ); + InstallInputHandlers(); // Set background SetBackgroundStyle( wxBG_STYLE_CUSTOM ); // for double-buffering @@ -280,7 +280,7 @@ void wxGenericComboControl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) ) void wxGenericComboControl::OnMouseEvent( wxMouseEvent& event ) { - bool isOnButtonArea = m_btnArea.Inside(event.m_x,event.m_y); + bool isOnButtonArea = m_btnArea.Contains(event.m_x,event.m_y); int handlerFlags = isOnButtonArea ? wxCC_MF_ON_BUTTON : 0; // Preprocessing fabricates double-clicks and prevents @@ -288,11 +288,7 @@ void wxGenericComboControl::OnMouseEvent( wxMouseEvent& event ) if ( PreprocessMouseEvent(event,handlerFlags) ) return; -#ifdef __WXMSW__ - const bool ctrlIsButton = true; -#else - const bool ctrlIsButton = false; -#endif + const bool ctrlIsButton = wxPlatformIs(wxOS_WINDOWS); if ( ctrlIsButton && (m_windowStyle & (wxCC_SPECIAL_DCLICK|wxCB_READONLY)) == wxCB_READONLY ) @@ -325,6 +321,28 @@ void wxGenericComboControl::OnMouseEvent( wxMouseEvent& event ) } +bool wxGenericComboControl::IsKeyPopupToggle(const wxKeyEvent& event) const +{ + int keycode = event.GetKeyCode(); + bool isPopupShown = IsPopupShown(); + + // This code is AFAIK appropriate for wxGTK. + + if ( isPopupShown ) + { + if ( keycode == WXK_ESCAPE || + ( keycode == WXK_UP && event.AltDown() ) ) + return true; + } + else + { + if ( keycode == WXK_DOWN && event.AltDown() ) + return true; + } + + return false; +} + #ifdef __WXUNIVERSAL__ bool wxGenericComboControl::PerformAction(const wxControlAction& action,