1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/cocoa/choice.mm
4 // Author: Stefan Csomor
7 // RCS-ID: $Id: choice.cpp 54129 2008-06-11 19:30:52Z SC $
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/wxprec.h"
16 #include "wx/choice.h"
20 #include "wx/dcclient.h"
23 #include "wx/osx/private.h"
25 @interface wxNSPopUpButton : NSPopUpButton
31 @implementation wxNSPopUpButton
35 static BOOL initialized = NO;
39 wxOSXCocoaClassAddWXMethods( self );
45 return [self indexOfSelectedItem];
48 - (void) setIntValue: (int) v
50 [self selectItemAtIndex:v];
55 wxWidgetImplType* wxWidgetImpl::CreateChoice( wxWindowMac* wxpeer,
56 wxWindowMac* WXUNUSED(parent),
57 wxWindowID WXUNUSED(id),
62 long WXUNUSED(extraStyle))
64 NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
65 wxNSPopUpButton* v = [[wxNSPopUpButton alloc] initWithFrame:r pullsDown:NO];
66 [v setMenu: menu->GetHMenu()];
67 [v setAutoenablesItems:NO];
68 wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
72 #endif // wxUSE_CHOICE