+
+
+wxChoice::~wxChoice()
+{
+ if ( HasClientObjectData() )
+ {
+ unsigned int i, max = GetCount();
+
+ for ( i = 0; i < max; ++i )
+ delete GetClientObject( i );
+ }
+
+ // DeleteMenu( m_macPopUpMenuId ) ;
+ // DisposeMenu( m_macPopUpMenuHandle ) ;
+}
+
+bool wxChoice::Create(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos,
+ const wxSize& size,
+ const wxArrayString& choices,
+ long style,
+ const wxValidator& validator,
+ const wxString& name )
+{
+ wxCArrayString chs( choices );
+
+ return Create(
+ parent, id, pos, size, chs.GetCount(), chs.GetStrings(),
+ style, validator, name );
+}
+
+bool wxChoice::Create(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos,
+ const wxSize& size,
+ int n,
+ const wxString choices[],
+ long style,
+ const wxValidator& validator,
+ const wxString& name )
+{
+ m_macIsUserPane = false;
+
+ if ( !wxChoiceBase::Create( parent, id, pos, size, style, validator, name ) )
+ return false;
+
+ Rect bounds = wxMacGetBoundsForControl( this , pos , size );
+
+ m_peer = new wxMacControl( this ) ;
+ OSStatus err = CreatePopupButtonControl(
+ MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") ,
+ -12345 , false /* no variable width */ , 0 , 0 , 0 , m_peer->GetControlRefAddr() );
+ verify_noerr( err );
+
+ 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 )
+ // autosort
+ m_strings = wxArrayString( 1 );