X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4850cc8b2e1037cd394806db4ddcf73868588a4c..b13d363b87017dbac11e74d11447288f17b62998:/src/osx/cocoa/choice.mm?ds=inline diff --git a/src/osx/cocoa/choice.mm b/src/osx/cocoa/choice.mm index 931a7308d4..197e4d758f 100644 --- a/src/osx/cocoa/choice.mm +++ b/src/osx/cocoa/choice.mm @@ -24,52 +24,22 @@ @interface wxNSPopUpButton : NSPopUpButton { - wxWidgetCocoaImpl* impl; } -- (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation; -- (wxWidgetCocoaImpl*) implementation; -- (BOOL) isFlipped; -- (void) clickedAction: (id) sender; - @end @implementation wxNSPopUpButton -- (id)initWithFrame:(NSRect)frame pullsDown:(BOOL) pd -{ - [super initWithFrame:frame pullsDown:pd]; - impl = NULL; - [self setTarget: self]; - [self setAction: @selector(clickedAction:)]; - return self; -} - -- (void) clickedAction: (id) sender ++ (void)initialize { - if ( impl ) + static BOOL initialized = NO; + if (!initialized) { - wxWindow* wxpeer = (wxWindow*) impl->GetWXPeer(); - if ( wxpeer ) - wxpeer->HandleClicked(0); + initialized = YES; + wxOSXCocoaClassAddWXMethods( self ); } } -- (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation -{ - impl = theImplementation; -} - -- (wxWidgetCocoaImpl*) implementation -{ - return impl; -} - -- (BOOL) isFlipped -{ - return YES; -} - - (int) intValue { return [self indexOfSelectedItem]; @@ -95,7 +65,6 @@ wxWidgetImplType* wxWidgetImpl::CreateChoice( wxWindowMac* wxpeer, wxNSPopUpButton* v = [[wxNSPopUpButton alloc] initWithFrame:r pullsDown:NO]; [v setMenu: menu->GetHMenu()]; wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v ); - [v setImplementation:c]; return c; }