- wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self );
- if ( impl )
- {
- wxSearchCtrl* wxpeer = dynamic_cast<wxSearchCtrl*>( impl->GetWXPeer() );
- if ( wxpeer )
- {
- NSString *searchString = [self stringValue];
- if ( searchString == nil )
- {
- wxpeer->HandleSearchFieldCancelHit();
- }
- else
- {
- wxpeer->HandleSearchFieldSearchHit();
- }
- }
- }
+ 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;