X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b81abd0d1d0fcde8db54f8c5e736b2b9daaf2ea0..f21b2fd89d02837dfd0d195f8ff0f3f5640af017:/src/mac/carbon/listbox.cpp diff --git a/src/mac/carbon/listbox.cpp b/src/mac/carbon/listbox.cpp index 17efb46fab..05cc0e249a 100644 --- a/src/mac/carbon/listbox.cpp +++ b/src/mac/carbon/listbox.cpp @@ -13,13 +13,18 @@ #pragma implementation "listbox.h" #endif +#include "wx/app.h" #include "wx/listbox.h" #include "wx/settings.h" #include "wx/dynarray.h" #include "wx/log.h" #include "wx/utils.h" -#include "extldef.h" +#ifdef __UNIX__ + #include "ldef/extldef.h" +#else + #include "extldef.h" +#endif #if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl) @@ -62,7 +67,7 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id, MacPreControlCreate( parent , id , "" , pos , size ,style, validator , name , &bounds , title ) ; - m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , kwxMacListWithVerticalScrollbar , 0 , 0, + m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , false , kwxMacListWithVerticalScrollbar , 0 , 0, kControlListBoxProc , (long) this ) ; long result ; @@ -180,6 +185,7 @@ int wxListBox::DoAppend(const wxString& item) m_dataArray.Add( NULL ); } m_noItems ++; + DoSetItemClientData( index , NULL ) ; MacAppend( item ) ; return index ; @@ -245,26 +251,56 @@ int wxListBox::FindString(const wxString& st) const { wxString search = s.Left( s.Length() - 1 ) ; int len = search.Length() ; - Str255 s1 , s2 ; - strcpy( (char*) s2 , search.c_str() ) ; - c2pstr( (char*) s2 ) ; + Str255 s1 , s2 ; + +#if TARGET_CARBON + c2pstrcpy( (StringPtr) s2 , search.c_str() ) ; +#else + strcpy( (char *) s2 , search.c_str() ) ; + c2pstr( (char *) s2 ) ; +#endif + for ( int i = 0 ; i < m_noItems ; ++ i ) { - strcpy( (char*) s1 , m_stringArray[i].Left( len ).c_str() ) ; - c2pstr( (char*) s1 ) ; +#if TARGET_CARBON + c2pstrcpy( (StringPtr) s1 , m_stringArray[i].Left( len ).c_str() ) ; +#else + strcpy( (char *) s1 , m_stringArray[i].Left( len ).c_str() ) ; + c2pstr( (char *) s1 ) ; +#endif if ( EqualString( s1 , s2 , false , false ) ) return i ; } + if ( s.Left(1) = "*" && s.Length() > 1 ) + { + s.MakeLower() ; + for ( int i = 0 ; i < m_noItems ; ++i ) + { + if ( GetString(i).Lower().Matches(s) ) + return i ; + } + } + } else { Str255 s1 , s2 ; - strcpy( (char*) s2 , s.c_str() ) ; - c2pstr( (char*) s2 ) ; + +#if TARGET_CARBON + c2pstrcpy( (StringPtr) s2 , s.c_str() ) ; +#else + strcpy( (char *) s2 , s.c_str() ) ; + c2pstr( (char *) s2 ) ; +#endif + for ( int i = 0 ; i < m_noItems ; ++ i ) { - strcpy( (char*) s1 , m_stringArray[i].c_str() ) ; - c2pstr( (char*) s1 ) ; +#if TARGET_CARBON + c2pstrcpy( (StringPtr) s1 , m_stringArray[i].c_str() ) ; +#else + strcpy( (char *) s1 , m_stringArray[i].c_str() ) ; + c2pstr( (char *) s1 ) ; +#endif if ( EqualString( s1 , s2 , false , false ) ) return i ; } @@ -469,7 +505,6 @@ void wxListBox::MacDelete( int N ) { ListHandle list ; long result ; - Cell cell = { 0 , 0 } ; UMAGetControlData( m_macControl , kControlNoPart , kControlListBoxListHandleTag , sizeof( ListHandle ) , (char*) &list , &result ) ; LDelRow( 1 , N , list ) ; }