const wxValidator& validator,
const wxString& name)
{
+ if ( !wxChoiceBase::Create(parent, id, pos, size, style, validator, name) )
+ return false;
+
Rect bounds ;
Str255 title ;
if ( n > 0 )
SetControl32BitValue( (ControlHandle) m_macControl , 1 ) ;
MacPostControlCreate() ;
+ // TODO wxCB_SORT
for ( int i = 0; i < n; i++ )
{
Append(choices[i]);
delete GetClientObject(n);
}
::DeleteMenuItem( MAC_WXHMENU(m_macPopUpMenuHandle) , n + 1) ;
- m_strings.Remove( n ) ;
+ m_strings.RemoveAt( n ) ;
m_datas.RemoveAt( n ) ;
SetControl32BitMaximum( (ControlHandle) m_macControl , GetCount()) ;
}
wxString wxChoice::GetString(int n) const
{
+ wxCHECK_MSG( n >= 0 && (size_t)n < m_strings.GetCount(), _T(""),
+ _T("wxChoice::GetString(): invalid index") );
+
return m_strings[n] ;
}
+
// ----------------------------------------------------------------------------
// client data
// ----------------------------------------------------------------------------
void *wxChoice::DoGetItemClientData(int n) const
{
- if ( n < 0 || (size_t)n >= m_datas.GetCount() )
- return (void*)NULL;
-
+ wxCHECK_MSG( n >= 0 && (size_t)n < m_datas.GetCount(), NULL,
+ wxT("invalid index in wxChoice::GetClientData") );
return (void *)m_datas[n];
}
return (wxClientData *)DoGetItemClientData(n);
}
-void wxChoice::MacHandleControlClick( WXWidget control , wxInt16 controlpart )
+void wxChoice::MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool WXUNUSED(mouseStillDown))
{
wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, m_windowId );
int n = GetSelection();
&baseline );
wLine = bounds.h ;
#else
- wxCharBuffer text = wxMacStringToCString( str ) ;
- wLine = ::TextWidth( text , 0 , strlen(text) ) ;
+ wLine = ::TextWidth( str.c_str() , 0 , str.Length() ) ;
#endif
lbWidth = wxMax(lbWidth, wLine);
}