X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/aacd14428971b5e199f88597f76a895c68dd298f..9d03b4eee22027451e6e7c4f3cdea88e9420f5a6:/src/mac/carbon/choice.cpp?ds=sidebyside diff --git a/src/mac/carbon/choice.cpp b/src/mac/carbon/choice.cpp index b173ac7d55..852459a9ff 100644 --- a/src/mac/carbon/choice.cpp +++ b/src/mac/carbon/choice.cpp @@ -21,9 +21,7 @@ #include "wx/menu.h" #include "wx/mac/uma.h" -#if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxChoice, wxControl) -#endif extern MenuHandle NewUniqueMenu() ; @@ -80,7 +78,6 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id, m_peer->SetValueAndRange( n > 0 ? 1 : 0 , 0 , 0 ) ; MacPostControlCreate(pos,size) ; - // FIXME: STL version of wxArrayString doesn't have the same args #if !wxUSE_STL if ( style & wxCB_SORT ) { @@ -101,10 +98,22 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id, // ---------------------------------------------------------------------------- int wxChoice::DoAppend(const wxString& item) { - // FIXME: STL version of wxArrayString doesn't have the same args #if wxUSE_STL - size_t index = m_strings.size(); - m_strings.Add( item ); + wxArrayString::iterator insertPoint; + size_t index; + + if (GetWindowStyle() & wxCB_SORT) + { + insertPoint = std::lower_bound( m_strings.begin(), m_strings.end(), item ); + index = insertPoint - m_strings.begin(); + } + else + { + insertPoint = m_strings.end(); + index = m_strings.size(); + } + + m_strings.insert( insertPoint, item ); #else size_t index = m_strings.Add( item ) ; #endif