]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/combocmn.cpp
Fix numpad Del not working in wxRTC
[wxWidgets.git] / src / common / combocmn.cpp
index d2c742df65a09927e3afd822638cbf34ebe1d29d..17b6a376639c6a4a1c0dff1728523b20f9aa3180 100644 (file)
 //     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) )