]> git.saurik.com Git - wxWidgets.git/commitdiff
Corrected FindString
authorJulian Smart <julian@anthemion.co.uk>
Sat, 8 Apr 2006 14:58:08 +0000 (14:58 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Sat, 8 Apr 2006 14:58:08 +0000 (14:58 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38623 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mac/carbon/listbox.cpp

index ca7866655a79d706f76b52ed0607188745779405..9675f1f117998de6b4d6606fbff0d1edd7930616 100644 (file)
@@ -390,46 +390,10 @@ void wxListBox::DoSetItems(const wxArrayString& choices, void** clientData)
 
 int wxListBox::FindString(const wxString& s, bool bCase) const
 {
-    if ( s.Right(1) == wxT("*") )
+    for ( size_t i = 0 ; i < m_noItems ; ++ i )
     {
-        wxString search = s.Left( s.length() - 1 ) ;
-        int len = search.length() ;
-        Str255 s1 , s2 ;
-        wxMacStringToPascal( search , s2 ) ;
-
-        for ( unsigned int i = 0 ; i < m_noItems ; ++ i )
-        {
-            wxMacStringToPascal( m_stringArray[i].Left( len ) , s1 ) ;
-
-            if ( EqualString( s1 , s2 , bCase , false ) )
-                return (int)i;
-        }
-
-        if ( s.Left(1) == wxT("*") && s.length() > 1 )
-        {
-            wxString st = s ;
-            st.MakeLower() ;
-
-            for ( unsigned int i = 0 ; i < m_noItems ; ++i )
-            {
-                if (GetString(i).Lower().Matches(st) )
-                    return (int)i ;
-            }
-        }
-    }
-    else
-    {
-        Str255 s1 , s2 ;
-
-        wxMacStringToPascal( s , s2 ) ;
-
-        for ( unsigned int i = 0 ; i < m_noItems ; ++ i )
-        {
-            wxMacStringToPascal( m_stringArray[i] , s1 ) ;
-
-            if ( EqualString( s1 , s2 , bCase , false ) )
-                return (int)i ;
-        }
+        if (s.IsSameAs(GetString(i), bCase))
+            return (int)i ;
     }
 
     return wxNOT_FOUND;