+ m_peer = new wxMacControl(this) ;
+ verify_noerr ( CreatePopupButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") ,
+ -12345 , false /* no variable width */ , 0 , 0 , 0 , m_peer->GetControlRefAddr() ) );
+
+
+ m_macPopUpMenuHandle = NewUniqueMenu() ;
+ m_peer->SetData<MenuHandle>( kControlNoPart , kControlPopupButtonMenuHandleTag , (MenuHandle) m_macPopUpMenuHandle ) ;
+ m_peer->SetValueAndRange( n > 0 ? 1 : 0 , 0 , 0 ) ;
+ MacPostControlCreate(pos,size) ;
+
+#if !wxUSE_STL
+ if ( style & wxCB_SORT )
+ {
+ m_strings = wxArrayString(1) ; // autosort
+ }
+#endif
+
+ for ( int i = 0; i < n; i++ )
+ {
+ Append(choices[i]);
+ }
+ SetBestSize(size); // Needed because it is a wxControlWithItems
+ return true;
+}
+
+// ----------------------------------------------------------------------------
+// adding/deleting items to/from the list
+// ----------------------------------------------------------------------------
+int wxChoice::DoAppend(const wxString& item)
+{
+#if wxUSE_STL
+ 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();
+ }