X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d8c736e563cbf50bc5825c1a52878403ee48f513..33754c4d83c59b7523a6da0c4fb21079cb60301c:/src/mac/carbon/choice.cpp?ds=sidebyside diff --git a/src/mac/carbon/choice.cpp b/src/mac/carbon/choice.cpp index ec6a728102..9f05a58372 100644 --- a/src/mac/carbon/choice.cpp +++ b/src/mac/carbon/choice.cpp @@ -23,7 +23,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxChoice, wxControl) #endif -short nextMenuId = 100 ; // wxMenu takes the lower ids +extern MenuHandle NewUniqueMenu() ; wxChoice::~wxChoice() { @@ -45,10 +45,10 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id, MacPreControlCreate( parent , id , "" , pos , size ,style, validator , name , &bounds , title ) ; - m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , false , 0 , -12345 , 0 , + m_macControl = ::NewControl( parent->GetMacRootWindow() , &bounds , title , false , 0 , -12345 , 0 , kControlPopupButtonProc + kControlPopupFixedWidthVariant , (long) this ) ; - m_macPopUpMenuHandle = NewMenu( 1 , "\pPopUp Menu" ) ; + m_macPopUpMenuHandle = NewUniqueMenu() ; SetControlData( m_macControl , kControlNoPart , kControlPopupButtonMenuHandleTag , sizeof( MenuHandle ) , (char*) &m_macPopUpMenuHandle) ; SetControlMinimum( m_macControl , 0 ) ; SetControlMaximum( m_macControl , 0) ; @@ -77,7 +77,7 @@ int wxChoice::DoAppend(const wxString& item) m_datas.Add( NULL ) ; int index = m_strings.GetCount() - 1 ; DoSetItemClientData( index , NULL ) ; - SetControlMaximum( m_macControl , Number()) ; + SetControlMaximum( m_macControl , GetCount()) ; return index ; } @@ -92,8 +92,8 @@ void wxChoice::Delete(int n) ::DeleteMenuItem( m_macPopUpMenuHandle , n + 1) ; m_strings.Remove( n ) ; - m_datas.Remove( n ) ; - SetControlMaximum( m_macControl , Number()) ; + m_datas.RemoveAt( n ) ; + SetControlMaximum( m_macControl , GetCount()) ; } void wxChoice::Clear() @@ -216,6 +216,13 @@ void wxChoice::MacHandleControlClick( ControlHandle control , SInt16 controlpart event.SetString(GetStringSelection()); ProcessCommand(event); } + +wxSize wxChoice::DoGetBestSize() const +{ + // TODO should modify this to take into account string length ala wxGTK + return wxSize(100,20); +} + /* void wxChoice::Command(wxCommandEvent & event) {