]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/odcombo.cpp
add very simple (but already exposing many problems) wxIPC benchmark
[wxWidgets.git] / src / generic / odcombo.cpp
index d04d183089b35f8ad9f9a8b037d6ab84116d682a..618375b221244cbad0aaa1cc08a323e57d31762a 100644 (file)
@@ -477,7 +477,8 @@ void wxVListBoxComboPopup::Insert( const wxString& item, int pos )
     }
 
     m_strings.Insert(item,pos);
-    m_clientDatas.Insert(NULL, pos);
+    if ( (int)m_clientDatas.size() >= pos )
+        m_clientDatas.Insert(NULL, pos);
 
     m_widths.Insert(-1,pos);
     m_widthsDirty = true;
@@ -1027,13 +1028,29 @@ int wxOwnerDrawnComboBox::DoInsertItems(const wxArrayStringsAdapter& items,
     EnsurePopupControl();
 
     const unsigned int count = items.GetCount();
-    for( unsigned int i = 0; i < count; ++i, ++pos )
+
+    if ( HasFlag(wxCB_SORT) )
     {
-        GetVListBoxComboPopup()->Insert(items[i], pos);
-        AssignNewItemClientData(pos, clientData, i, type);
+        int n = pos;
+
+        for ( unsigned int i = 0; i < count; ++i )
+        {
+            int n = GetVListBoxComboPopup()->Append(items[i]);
+            AssignNewItemClientData(n, clientData, i, type);
+        }
+
+        return n;
     }
+    else
+    {
+        for ( unsigned int i = 0; i < count; ++i, ++pos )
+        {
+            GetVListBoxComboPopup()->Insert(items[i], pos);
+            AssignNewItemClientData(pos, clientData, i, type);
+        }
 
-    return pos - 1;
+        return pos - 1;
+    }
 }
 
 void wxOwnerDrawnComboBox::DoSetItemClientData(unsigned int n, void* clientData)