- m_datas.Insert( NULL , index );
- UMAInsertMenuItem( MAC_WXHMENU( m_macPopUpMenuHandle ), item, m_font.GetEncoding(), index );
- DoSetItemClientData( index, NULL );
- m_peer->SetMaximum( GetCount() );
-
- return index;
-}
-
-int wxChoice::DoInsert( const wxString& item, unsigned int pos )
-{
- wxCHECK_MSG( !(GetWindowStyle() & wxCB_SORT), -1, wxT("wxChoice::DoInsert: can't insert into sorted list") );
- wxCHECK_MSG( IsValidInsert(pos), -1, wxT("wxChoice::DoInsert: invalid index") );
+#if wxUSE_STL
+ if ( IsSorted() )
+ {
+ wxArrayString::iterator
+ insertPoint = std::lower_bound( m_strings.begin(), m_strings.end(), items[i] );
+ idx = insertPoint - m_strings.begin();
+ m_strings.insert( insertPoint, items[i] );
+ }
+ else
+#endif // wxUSE_STL
+ {
+ idx = pos;
+ m_strings.Insert( items[i], idx );
+ }