/////////////////////////////////////////////////////////////////////////////
-// Name: choice.cpp
+// Name: src/msw/choice.cpp
// Purpose: wxChoice
// Author: Julian Smart
// Modified by: Vadim Zeitlin to derive from wxChoiceBase
// headers
// ----------------------------------------------------------------------------
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
- #pragma implementation "choice.h"
-#endif
-
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
const wxValidator& validator,
const wxString& name)
{
- Init();
-
// initialize wxControl
if ( !CreateControl(parent, id, pos, size, style, validator, name) )
return false;
return (int)SendMessage(GetHwnd(), CB_GETCOUNT, 0, 0);
}
-int wxChoice::FindString(const wxString& s) const
+int wxChoice::FindString(const wxString& s, bool bCase) const
{
#if defined(__WATCOMC__) && defined(__WIN386__)
// For some reason, Watcom in WIN386 mode crashes in the CB_FINDSTRINGEXACT message.
for ( int i = 0; i < count; i++ )
{
// as CB_FINDSTRINGEXACT is case insensitive, be case insensitive too
- if ( GetString(i).IsSameAs(s, false) )
+ if ( GetString(i).IsSameAs(s, bCase) )
return i;
}
//passed to SendMessage, so we have to do it ourselves in that case
if ( s.empty() )
{
- int count = GetCount();
- for ( int i = 0; i < count; i++ )
- {
- if ( GetString(i).empty() )
- return i;
- }
-
- return wxNOT_FOUND;
+ int count = GetCount();
+ for ( int i = 0; i < count; i++ )
+ {
+ if ( GetString(i).empty() )
+ return i;
+ }
+
+ return wxNOT_FOUND;
+ }
+ else if (bCase)
+ {
+ // back to base class search for not native search type
+ return wxItemContainerImmutable::FindString( s, bCase );
}
else
{
- int pos = (int)SendMessage(GetHwnd(), CB_FINDSTRINGEXACT,
- (WPARAM)-1, (LPARAM)s.c_str());
+ int pos = (int)SendMessage(GetHwnd(), CB_FINDSTRINGEXACT,
+ (WPARAM)-1, (LPARAM)s.c_str());
- return pos == LB_ERR ? wxNOT_FOUND : pos;
+ return pos == LB_ERR ? wxNOT_FOUND : pos;
}
#endif // Watcom/!Watcom
}
}
#endif // wxUSE_CHOICE && !(__SMARTPHONE__ && __WXWINCE__)
-