bool wxGenericComboCtrl::PerformAction(const wxControlAction& action, long numArg, const wxString& strArg) { bool processed = false; if ( action == wxACTION_COMBOBOX_POPUP ) { if ( !IsPopupShown() ) { ShowPopup(); processed = true; } } else if ( action == wxACTION_COMBOBOX_DISMISS ) { if ( IsPopupShown() ) { HidePopup(); processed = true; } } if ( !processed ) { // pass along return wxControl::PerformAction(action, numArg, strArg); } return true; }
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: case WXK_NUMPAD_DOWN: case WXK_NUMPAD_UP: // Arrow keys (and mouse wheel) toggle the popup in the native // combo boxes if ( event.AltDown() ) return true; break; } return false; }
void wxRichTextStyleComboCtrl::OnIdle(wxIdleEvent& event) { event.Skip(); if ( !m_stylePopup ) return; wxRichTextCtrl * const richtext = GetRichTextCtrl(); if ( !richtext ) return; if ( !IsPopupShown() && IsShownOnScreen() && wxWindow::FindFocus() != this ) { wxString styleName = wxRichTextStyleListBox::GetStyleToShowInIdleTime(richtext, m_stylePopup->GetStyleType()); wxString currentValue = GetValue(); if (!styleName.IsEmpty()) { // Don't do the selection if it's already set if (currentValue == styleName) return; SetValue(styleName); } else if (!currentValue.IsEmpty()) SetValue(wxEmptyString); } }
void DropDownBase::OnDropButton( wxCommandEvent &WXUNUSED(event)) { if (m_popupWin && m_popupWin->m_ignore_popup) { m_popupWin->m_ignore_popup = false; return; } if (IsPopupShown()) HidePopup(); else ShowPopup(); }
bool wxGenericComboCtrl::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; }
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) #if wxUSE_UXTHEME && !wxUxThemeEngine::GetIfActive() #endif ) ) { return true; } break; } return false; }