]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/combocmn.cpp
fix assert when adding an entry to an already full file history (closes #10118)
[wxWidgets.git] / src / common / combocmn.cpp
index c2dab94710eb873bc6fe8391027c1255a7266809..af78618a59a0e7fd81e0f16d7b5d8d9a5a50eea3 100644 (file)
 
 #elif defined(__WXMAC__)
 
-#define USE_TRANSIENT_POPUP           0 // 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 USE_TRANSIENT_POPUP           1 // Use wxPopupWindowTransient (preferred, if it works properly on platform)
+#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           0 // Same, but for non-transient popup window.
+#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
 #define FOCUS_RING                    3 // Reserve room for the textctrl's focus ring to display
 
 // Popupwin is really only supported on wxMSW (not WINCE) and wxGTK, regardless
 // what the wxUSE_POPUPWIN says.
 // FIXME: Why isn't wxUSE_POPUPWIN reliable any longer? (it was in wxW2.6.2)
-#if (!defined(__WXMSW__) && !defined(__WXGTK__)) || defined(__WXWINCE__)
+#if (!defined(__WXMSW__) && !defined(__WXGTK__) && !defined(__WXMAC__)) || defined(__WXWINCE__)
 #undef wxUSE_POPUPWIN
 #define wxUSE_POPUPWIN 0
 #endif
@@ -1177,6 +1177,8 @@ bool wxComboCtrlBase::Enable(bool enable)
         m_btn->Enable(enable);
     if ( m_text )
         m_text->Enable(enable);
+        
+    Refresh();
 
     return true;
 }
@@ -1233,16 +1235,15 @@ void wxComboCtrlBase::SetValidator(const wxValidator& validator)
 
     if ( textCtrl )
         textCtrl->SetValidator( validator );
+    else
+        wxControl::SetValidator( validator );
 }
 
 wxValidator* wxComboCtrlBase::GetValidator()
 {
     wxTextCtrl* textCtrl = GetTextCtrl();
 
-    if ( textCtrl )
-        return textCtrl->GetValidator();
-
-    return wxControl::GetValidator();
+    return textCtrl ? textCtrl->GetValidator() : wxControl::GetValidator();
 }
 #endif // wxUSE_VALIDATORS
 
@@ -1651,22 +1652,8 @@ void wxComboCtrlBase::OnKeyEvent(wxKeyEvent& event)
     }
     else // no popup
     {
-        int keycode = event.GetKeyCode();
-
-        if ( keycode == WXK_TAB )
-        {
-            wxNavigationKeyEvent evt;
-
-            wxWindow* mainCtrl = GetMainWindowOfCompositeControl();
-
-            evt.SetFlags(wxNavigationKeyEvent::FromTab|
-                         (!event.ShiftDown() ? wxNavigationKeyEvent::IsForward
-                                             : wxNavigationKeyEvent::IsBackward));
-            evt.SetEventObject(mainCtrl);
-            evt.SetCurrentFocus(mainCtrl);
-            mainCtrl->GetParent()->GetEventHandler()->AddPendingEvent(evt);
+        if ( HandleAsNavigationKey(event) )
             return;
-        }
 
         if ( IsKeyPopupToggle(event) )
         {
@@ -1683,6 +1670,8 @@ void wxComboCtrlBase::OnKeyEvent(wxKeyEvent& event)
             return;
         }
 
+        int keycode = event.GetKeyCode();
+
         if ( (comboStyle & wxCB_READONLY) ||
              (keycode != WXK_RIGHT && keycode != WXK_LEFT) )
         {