- wxCHECK_MSG( m_widget != NULL, NULL, "invalid combobox" );
-
- wxNode *node = m_clientDataList.Nth( n );
- if (!node) return NULL;
-
- wxVoidClientData *cd = (wxVoidClientData*) node->Data();
- if (cd)
- return cd->GetData();
- else
- return (void*) NULL;
+ wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid control") );
+
+ wxASSERT_MSG( !IsSorted() || (pos == GetCount()),
+ _T("In a sorted choice data could only be appended"));
+
+ const int count = items.GetCount();
+
+ int n = wxNOT_FOUND;
+
+ for ( int i = 0; i < count; ++i )
+ {
+ n = pos + i;
+ // If sorted, use this wxSortedArrayStrings to determine
+ // the right insertion point
+ if(m_strings)
+ n = m_strings->Add(items[i]);
+
+ GTKInsertComboBoxTextItem( n, items[i] );
+
+ m_clientData.Insert( NULL, n );
+ AssignNewItemClientData(n, clientData, i, type);
+ }
+
+ InvalidateBestSize();
+
+ return n;