X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c4825ef73a5f190b8f39c59df098c3f39fa4464b..b5a9b87e1620e52f1f13d2619b4677f2b365c93f:/src/osx/cocoa/choice.mm?ds=sidebyside diff --git a/src/osx/cocoa/choice.mm b/src/osx/cocoa/choice.mm index cf583d5fee..78ebecbbb9 100644 --- a/src/osx/cocoa/choice.mm +++ b/src/osx/cocoa/choice.mm @@ -24,52 +24,22 @@ @interface wxNSPopUpButton : NSPopUpButton { - wxWidgetImpl* impl; } -- (void)setImplementation: (wxWidgetImpl *) theImplementation; -- (wxWidgetImpl*) 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: (wxWidgetImpl *) theImplementation -{ - impl = theImplementation; -} - -- (wxWidgetImpl*) implementation -{ - return impl; -} - -- (BOOL) isFlipped -{ - return YES; -} - - (int) intValue { return [self indexOfSelectedItem]; @@ -83,19 +53,18 @@ @end wxWidgetImplType* wxWidgetImpl::CreateChoice( wxWindowMac* wxpeer, - wxWindowMac* parent, - wxWindowID id, + wxWindowMac* WXUNUSED(parent), + wxWindowID WXUNUSED(id), wxMenu* menu, const wxPoint& pos, const wxSize& size, - long style, - long extraStylew) + long WXUNUSED(style), + long WXUNUSED(extraStyle)) { NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ; wxNSPopUpButton* v = [[wxNSPopUpButton alloc] initWithFrame:r pullsDown:NO]; [v setMenu: menu->GetHMenu()]; wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v ); - [v setImplementation:c]; return c; }