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
27 WXCOCOAIMPL_COMMON_MEMBERS
30 WXCOCOAIMPL_COMMON_INTERFACE
32 - (void) clickedAction: (id) sender;
36 @implementation wxNSPopUpButton
38 - (id)initWithFrame:(NSRect)frame pullsDown:(BOOL) pd
40 [super initWithFrame:frame pullsDown:pd];
42 [self setTarget: self];
43 [self setAction: @selector(clickedAction:)];
47 - (void) clickedAction: (id) sender
51 wxWindow* wxpeer = (wxWindow*) impl->GetWXPeer();
53 wxpeer->OSXHandleClicked(0);
57 WXCOCOAIMPL_COMMON_IMPLEMENTATION
61 return [self indexOfSelectedItem];
64 - (void) setIntValue: (int) v
66 [self selectItemAtIndex:v];
71 wxWidgetImplType* wxWidgetImpl::CreateChoice( wxWindowMac* wxpeer,
80 NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
81 wxNSPopUpButton* v = [[wxNSPopUpButton alloc] initWithFrame:r pullsDown:NO];
82 [v setMenu: menu->GetHMenu()];
83 wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
84 [v setImplementation:c];
88 #endif // wxUSE_CHOICE