From ea7f86d9f7bb4101535fbb2479b549513cb9fef6 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Wed, 14 Nov 2018 22:37:15 +0100 Subject: [PATCH] Use wxVector instead of wxArrayInt --- include/wx/odcombo.h | 2 +- src/generic/odcombo.cpp | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/wx/odcombo.h b/include/wx/odcombo.h index 622e51a748..7fe4cddd8a 100644 --- a/include/wx/odcombo.h +++ b/include/wx/odcombo.h @@ -192,7 +192,7 @@ protected: private: // Cached item widths (in pixels). - wxArrayInt m_widths; + wxVector m_widths; // Width of currently widest item. int m_widestWidth; diff --git a/src/generic/odcombo.cpp b/src/generic/odcombo.cpp index 7eb5692256..12fb482dec 100644 --- a/src/generic/odcombo.cpp +++ b/src/generic/odcombo.cpp @@ -525,7 +525,7 @@ void wxVListBoxComboPopup::Insert( const wxString& item, int pos ) if ( (int)m_clientDatas.size() >= pos ) m_clientDatas.Insert(NULL, pos); - m_widths.Insert(-1,pos); + m_widths.insert(m_widths.begin()+pos, -1); m_widthsDirty = true; if ( IsCreated() ) @@ -561,7 +561,7 @@ void wxVListBoxComboPopup::Clear() wxASSERT(m_combo); m_strings.Empty(); - m_widths.Empty(); + m_widths.clear(); m_widestWidth = 0; m_widestItem = -1; @@ -618,7 +618,7 @@ void wxVListBoxComboPopup::Delete( unsigned int item ) } m_strings.RemoveAt(item); - m_widths.RemoveAt(item); + m_widths.erase(m_widths.begin()+item); if ( (int)item == m_widestItem ) m_findWidest = true; @@ -712,9 +712,9 @@ void wxVListBoxComboPopup::CalcWidths() // Measure items with dirty width. if ( m_widthsDirty ) { - unsigned int n = m_widths.GetCount(); + unsigned int n = m_widths.size(); int dirtyHandled = 0; - wxArrayInt& widths = m_widths; + wxVector& widths = m_widths; // I think using wxDC::GetTextExtent is faster than // wxWindow::GetTextExtent (assuming same dc is used @@ -772,7 +772,7 @@ void wxVListBoxComboPopup::CalcWidths() if ( doFindWidest ) { - unsigned int n = m_widths.GetCount(); + unsigned int n = m_widths.size(); int bestWidth = -1; int bestIndex = -1; @@ -849,7 +849,7 @@ void wxVListBoxComboPopup::Populate( const wxArrayString& choices ) m_strings.Add(item); } - m_widths.SetCount(n,-1); + m_widths.resize(n,-1); m_widthsDirty = true; if ( IsCreated() )