X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9e691f46b2ec1b5dbbff2e51131e3c532e688a89..7391216edcb95b4e125c310120cf4b877c89073b:/src/gtk/choice.cpp diff --git a/src/gtk/choice.cpp b/src/gtk/choice.cpp index 103ebf3901..f62387d9b5 100644 --- a/src/gtk/choice.cpp +++ b/src/gtk/choice.cpp @@ -209,9 +209,31 @@ void wxChoice::Clear() m_strings->Clear(); } -void wxChoice::Delete( int WXUNUSED(n) ) +void wxChoice::Delete( int n ) { - wxFAIL_MSG( wxT("wxChoice:Delete not implemented") ); + wxCHECK_RET( m_widget != NULL, wxT("invalid choice") ); + + // VZ: apparently GTK+ doesn't have a built-in function to do it (not even + // in 2.0), hence this dump implementation - still better than nothing + int i, + count = GetCount(); + + wxCHECK_RET( n >= 0 && n < count, _T("invalid index in wxChoice::Delete") ); + + wxArrayString items; + items.Alloc(count); + for ( i = 0; i < count; i++ ) + { + if ( i != n ) + items.Add(GetString(i)); + } + + Clear(); + + for ( i = 0; i < count - 1; i++ ) + { + Append(items[i]); + } } int wxChoice::FindString( const wxString &string ) const