X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1e181c7a2c32193fc8138cc32ed07984eadd4a21..55410bb4f67febe1ca20654f078ea4fb9a6223ae:/src/osx/cocoa/srchctrl.mm diff --git a/src/osx/cocoa/srchctrl.mm b/src/osx/cocoa/srchctrl.mm index 0c33e98599..0ed85e50f3 100644 --- a/src/osx/cocoa/srchctrl.mm +++ b/src/osx/cocoa/srchctrl.mm @@ -31,45 +31,33 @@ @interface wxNSSearchField : NSSearchField { - wxWidgetImpl* impl; } @end @implementation wxNSSearchField ++ (void)initialize +{ + static BOOL initialized = NO; + if (!initialized) + { + initialized = YES; + wxOSXCocoaClassAddWXMethods( self ); + } +} + - (id)initWithFrame:(NSRect)frame { [super initWithFrame:frame]; - impl = NULL; [self setTarget: self]; [self setAction: @selector(searchAction:)]; return self; } -- (void)setImplementation: (wxWidgetImpl *) theImplementation -{ - impl = theImplementation; -} - -- (wxWidgetImpl*) implementation -{ - return impl; -} - -- (BOOL) isFlipped -{ - return YES; -} - -// use our common calls -- (void) setTitle:(NSString *) title -{ - [self setStringValue: title]; -} - - (void) searchAction: (id) sender { + wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self ); if ( impl ) { wxSearchCtrl* wxpeer = dynamic_cast( impl->GetWXPeer() ); @@ -171,18 +159,17 @@ wxWidgetImplType* wxWidgetImpl::CreateSearchControl( wxTextCtrl* wxpeer, long style, long extraStyle) { - NSView* sv = (wxpeer->GetParent()->GetHandle() ); - NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ; wxNSSearchField* v = [[wxNSSearchField alloc] initWithFrame:r]; - [sv addSubview:v]; [[v cell] setSendsWholeSearchString:YES]; // per wx default cancel is not shown [[v cell] setCancelButtonCell:nil]; + [v setBezeled:NO]; + [v setBordered:NO]; + wxNSSearchFieldControl* c = new wxNSSearchFieldControl( wxpeer, v ); c->SetStringValue( str ); - [v setImplementation:c]; return c; }