implemented wxChoice::Delete

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15108 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2002-04-12 09:31:12 +00:00
parent fc51b8c37e
commit 645420d872
4 changed files with 59 additions and 4 deletions

View File

@@ -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