#pragma hdrstop
#endif
+#if wxUSE_CHOICE
+
#ifndef WX_PRECOMP
#include "wx/choice.h"
#include "wx/utils.h"
// A choice/combobox normally has a white background (or other, depending
// on global settings) rather than inheriting the parent's background colour.
- SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW));
+ SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
for ( int i = 0; i < n; i++ )
{
#endif // Watcom/!Watcom
}
-void wxChoice::SetString(int WXUNUSED(n), const wxString& WXUNUSED(s))
+void wxChoice::SetString(int n, const wxString& s)
{
- wxFAIL_MSG(wxT("not implemented"));
-
-#if 0 // should do this, but no Insert() so far
- Delete(n);
- Insert(n + 1, s);
-#endif
+ wxCHECK_RET( (n>=0)&&(n<GetCount()), wxT("invalid item index in wxChoice::SetString") );
+ SendMessage(GetHwnd(), CB_DELETESTRING, n, 0);
+ SendMessage(GetHwnd(), CB_INSERTSTRING, n, (LONG)s.c_str() );
}
wxString wxChoice::GetString(int n) const
wxColour colBack = GetBackgroundColour();
if (!IsEnabled())
- colBack = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
+ colBack = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
::SetBkColor(hdc, wxColourToRGB(colBack));
::SetTextColor(hdc, wxColourToRGB(GetForegroundColour()));
return (WXHBRUSH)brush->GetResourceHandle();
}
-
+#endif // wxUSE_CHOICE