X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/df6007a555a2c747ff379e3bd83d23ea310ca75d..acd32ffcdb319f162633c20e0202db3f8542998a:/src/common/combocmn.cpp?ds=sidebyside diff --git a/src/common/combocmn.cpp b/src/common/combocmn.cpp index d2c742df65..17b6a37663 100644 --- a/src/common/combocmn.cpp +++ b/src/common/combocmn.cpp @@ -77,8 +77,12 @@ // reflected (or something like that - atleast commenting out ->Hide() // seemed to eliminate the position change). +// NB: Let's not be afraid to use wxGTK's wxPopupTransientWindow as a +// 'perfect' popup, as it can succesfully host child controls even in +// popups that are shown in modal dialogs. + #define USE_TRANSIENT_POPUP 1 // Use wxPopupWindowTransient (preferred, if it works properly on platform) -#define TRANSIENT_POPUPWIN_IS_PERFECT 0 // wxPopupTransientWindow works, its child can have focus, and common +#define TRANSIENT_POPUPWIN_IS_PERFECT 1 // wxPopupTransientWindow works, its child can have focus, and common // native controls work on it like normal. #define POPUPWIN_IS_PERFECT 1 // Same, but for non-transient popup window. #define TEXTCTRL_TEXT_CENTERED 1 // 1 if text in textctrl is vertically centered @@ -495,6 +499,11 @@ void wxComboPopup::OnDismiss() { } +wxComboCtrl* wxComboPopup::GetComboCtrl() const +{ + return wxStaticCast(m_combo, wxComboCtrl); +} + wxSize wxComboPopup::GetAdjustedSize( int minWidth, int prefHeight, int WXUNUSED(maxHeight) ) @@ -584,14 +593,17 @@ void wxComboBoxExtraInputHandler::OnKey(wxKeyEvent& event) { // Let the wxComboCtrl event handler have a go first. wxComboCtrlBase* combo = m_combo; - wxObject* prevObj = event.GetEventObject(); - event.SetId(combo->GetId()); - event.SetEventObject(combo); - combo->GetEventHandler()->ProcessEvent(event); + wxKeyEvent redirectedEvent(event); + redirectedEvent.SetId(combo->GetId()); + redirectedEvent.SetEventObject(combo); - event.SetId(((wxWindow*)prevObj)->GetId()); - event.SetEventObject(prevObj); + if ( !combo->GetEventHandler()->ProcessEvent(redirectedEvent) ) + { + // Don't let TAB through to the text ctrl - looks ugly + if ( event.GetKeyCode() != WXK_TAB ) + event.Skip(); + } } void wxComboBoxExtraInputHandler::OnFocus(wxFocusEvent& event) @@ -1654,7 +1666,8 @@ void wxComboCtrlBase::OnKeyEvent(wxKeyEvent& event) } else // no popup { - if ( HandleAsNavigationKey(event) ) + if ( GetParent()->HasFlag(wxTAB_TRAVERSAL) && + HandleAsNavigationKey(event) ) return; if ( IsKeyPopupToggle(event) )