diff --git a/include/wx/odcombo.h b/include/wx/odcombo.h index 7fe4cddd8a..11755fe356 100644 --- a/include/wx/odcombo.h +++ b/include/wx/odcombo.h @@ -178,7 +178,7 @@ protected: void StopPartialCompletion(); wxArrayString m_strings; - wxArrayPtrVoid m_clientDatas; + wxVector m_clientDatas; wxFont m_useFont; diff --git a/src/generic/odcombo.cpp b/src/generic/odcombo.cpp index 12fb482dec..404ed62ed0 100644 --- a/src/generic/odcombo.cpp +++ b/src/generic/odcombo.cpp @@ -240,7 +240,7 @@ void wxVListBoxComboPopup::SendComboBoxEvent( int selection ) evt.SetInt(selection); // Set client data, if any - if ( selection >= 0 && (int)m_clientDatas.GetCount() > selection ) + if ( selection >= 0 && (int)m_clientDatas.size() > selection ) { void* clientData = m_clientDatas[selection]; if ( m_clientDataItemsType == wxClientData_Object ) @@ -523,7 +523,7 @@ void wxVListBoxComboPopup::Insert( const wxString& item, int pos ) m_strings.Insert(item,pos); if ( (int)m_clientDatas.size() >= pos ) - m_clientDatas.Insert(NULL, pos); + m_clientDatas.insert(m_clientDatas.begin()+pos, NULL); m_widths.insert(m_widths.begin()+pos, -1); m_widthsDirty = true; @@ -578,11 +578,11 @@ void wxVListBoxComboPopup::ClearClientDatas() { if ( m_clientDataItemsType == wxClientData_Object ) { - for ( size_t i=0; i::iterator it = m_clientDatas.begin(); it != m_clientDatas.end(); ++it ) + delete (wxClientData*) *it; } - m_clientDatas.Empty(); + m_clientDatas.clear(); m_clientDataItemsType = wxClientData_None; } @@ -600,21 +600,18 @@ void wxVListBoxComboPopup::SetItemClientData( unsigned int n, void* wxVListBoxComboPopup::GetItemClientData(unsigned int n) const { - if ( m_clientDatas.GetCount() > n ) - return m_clientDatas[n]; - - return NULL; + return n < m_clientDatas.size() ? m_clientDatas[n] : NULL; } void wxVListBoxComboPopup::Delete( unsigned int item ) { // Remove client data, if set - if ( m_clientDatas.GetCount() ) + if ( !m_clientDatas.empty() ) { if ( m_clientDataItemsType == wxClientData_Object ) delete (wxClientData*) m_clientDatas[item]; - m_clientDatas.RemoveAt(item); + m_clientDatas.erase(m_clientDatas.begin()+item); } m_strings.RemoveAt(item);