Replace wxArrayPtrVoid with wxVector<void*>

This commit is contained in:
Artur Wieczorek 2019-01-04 21:37:26 +01:00
parent b235987a69
commit 3cfec773c9
2 changed files with 9 additions and 12 deletions

View File

@ -178,7 +178,7 @@ protected:
void StopPartialCompletion();
wxArrayString m_strings;
wxArrayPtrVoid m_clientDatas;
wxVector<void*> m_clientDatas;
wxFont m_useFont;

View File

@ -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<m_clientDatas.GetCount(); i++ )
delete (wxClientData*) m_clientDatas[i];
for ( wxVector<void*>::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);