wxItemContainerImmutable::FindString unified.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35742 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: choice.cpp
|
||||
// Name: src/msw/choice.cpp
|
||||
// Purpose: wxChoice
|
||||
// Author: Julian Smart
|
||||
// Modified by: Vadim Zeitlin to derive from wxChoiceBase
|
||||
@@ -331,7 +331,7 @@ int wxChoice::GetCount() const
|
||||
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.
|
||||
@@ -340,7 +340,7 @@ int wxChoice::FindString(const wxString& s) const
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -350,21 +350,26 @@ int wxChoice::FindString(const wxString& s) const
|
||||
//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;
|
||||
}
|
||||
int count = GetCount();
|
||||
for ( int i = 0; i < count; i++ )
|
||||
{
|
||||
if ( GetString(i).empty() )
|
||||
return i;
|
||||
}
|
||||
|
||||
return wxNOT_FOUND;
|
||||
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
|
||||
}
|
||||
@@ -675,4 +680,3 @@ WXHBRUSH wxChoice::MSWControlColor(WXHDC hDC, WXHWND hWnd)
|
||||
}
|
||||
|
||||
#endif // wxUSE_CHOICE && !(__SMARTPHONE__ && __WXWINCE__)
|
||||
|
||||
|
Reference in New Issue
Block a user