X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/11f87a381bd9d0fe195ff1a3802ae141413d7c2e..bbfd45484113ff0bafcd0007a4b6faecc7909561:/src/osx/cocoa/srchctrl.mm?ds=sidebyside diff --git a/src/osx/cocoa/srchctrl.mm b/src/osx/cocoa/srchctrl.mm index 6e74612d73..e665167688 100644 --- a/src/osx/cocoa/srchctrl.mm +++ b/src/osx/cocoa/srchctrl.mm @@ -1,9 +1,9 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/srchctrl.cpp +// Name: src/osx/cocoa/srchctrl.mm // Purpose: implements mac carbon wxSearchCtrl // Author: Vince Harron // Created: 2006-02-19 -// RCS-ID: $Id: srchctrl.cpp 54820 2008-07-29 20:04:11Z SC $ +// RCS-ID: $Id$ // Copyright: Vince Harron // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -61,6 +61,30 @@ impl->controlTextDidChange(); } +- (NSArray *)control:(NSControl *)control textView:(NSTextView *)textView completions:(NSArray *)words + forPartialWordRange:(NSRange)charRange indexOfSelectedItem:(int*)index +{ + NSMutableArray* matches = NULL; + NSString* partialString; + + partialString = [[textView string] substringWithRange:charRange]; + matches = [NSMutableArray array]; + + wxTextWidgetImpl* impl = (wxTextWidgetImpl* ) wxWidgetImpl::FindFromWXWidget( self ); + wxArrayString completions; + + // adapt to whatever strategy we have for getting the strings + // impl->GetTextEntry()->GetCompletions(wxCFStringRef::AsString(partialString), completions); + + for (size_t i = 0; i < completions.GetCount(); ++i ) + [matches addObject: wxCFStringRef(completions[i]).AsNSString()]; + + // [matches sortUsingSelector:@selector(compare:)]; + + + return matches; +} + @end // ============================================================================