X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/04236b74cd5c82645aff3c99736291ebe2f52cc5..3f30bd1a8de0003b8963ee269eef9b361249828a:/src/osx/cocoa/choice.mm diff --git a/src/osx/cocoa/choice.mm b/src/osx/cocoa/choice.mm index 5ebf6a2445..d08572479a 100644 --- a/src/osx/cocoa/choice.mm +++ b/src/osx/cocoa/choice.mm @@ -24,38 +24,22 @@ @interface wxNSPopUpButton : NSPopUpButton { - WXCOCOAIMPL_COMMON_MEMBERS } -WXCOCOAIMPL_COMMON_INTERFACE - -- (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->OSXHandleClicked(0); + initialized = YES; + wxOSXCocoaClassAddWXMethods( self ); } } -WXCOCOAIMPL_COMMON_IMPLEMENTATION - - (int) intValue { return [self indexOfSelectedItem]; @@ -68,20 +52,20 @@ WXCOCOAIMPL_COMMON_IMPLEMENTATION @end -wxWidgetImplType* wxWidgetImpl::CreateChoice( wxWindowMac* wxpeer, - wxWindowMac* parent, - wxWindowID id, +wxWidgetImplType* wxWidgetImpl::CreateChoice( wxWindowMac* wxpeer, + wxWindowMac* WXUNUSED(parent), + wxWindowID WXUNUSED(id), wxMenu* menu, - const wxPoint& pos, + 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()]; + [v setAutoenablesItems:NO]; wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v ); - [v setImplementation:c]; return c; }