]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/cocoa/choice.mm
wxSplitterWindow mouse capture improvements and cleanup.
[wxWidgets.git] / src / osx / cocoa / choice.mm
index 50d1bac3321a4a0332edeefb52e9afe9c45b4553..78ebecbbb9b015ced2b8651f7505133e188a251a 100644 (file)
 
 @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];
 @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))
 {
-    NSView* sv = (wxpeer->GetParent()->GetHandle() );
-    
     NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
     wxNSPopUpButton* v = [[wxNSPopUpButton alloc] initWithFrame:r pullsDown:NO];
-    [sv addSubview:v];
     [v setMenu: menu->GetHMenu()];
     wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
-    [v setImplementation:c];
     return c;
 }