X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c69279ef704784c900954868b2a9b583a408e836..99e8cb505ad94704ec6596d20842ca8fa34e7d9e:/src/mac/choice.cpp diff --git a/src/mac/choice.cpp b/src/mac/choice.cpp index 4342deb27c..c187d9ecc7 100644 --- a/src/mac/choice.cpp +++ b/src/mac/choice.cpp @@ -105,7 +105,7 @@ void wxChoice::Delete(int n) 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()) ; } @@ -177,8 +177,12 @@ void wxChoice::SetString(int n, const wxString& s) 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 // ---------------------------------------------------------------------------- @@ -192,9 +196,8 @@ void wxChoice::DoSetItemClientData( int n, void* clientData ) 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]; } @@ -208,7 +211,7 @@ wxClientData* wxChoice::DoGetItemClientObject( int n ) const 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();