]> git.saurik.com Git - wxWidgets.git/blame - src/osx/cocoa/choice.mm
Since wxDialog::Show(false) only calls wxWindow::Show, we must explicitly hide the...
[wxWidgets.git] / src / osx / cocoa / choice.mm
CommitLineData
dbeddfb9
SC
1/////////////////////////////////////////////////////////////////////////////
2// Name: src/osx/cocoa/choice.mm
3// Purpose: wxChoice
4// Author: Stefan Csomor
5// Modified by:
6// Created: 1998-01-01
7// RCS-ID: $Id: choice.cpp 54129 2008-06-11 19:30:52Z SC $
8// Copyright: (c) Stefan Csomor
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#include "wx/wxprec.h"
13
14#if wxUSE_CHOICE
15
16#include "wx/choice.h"
17
18#ifndef WX_PRECOMP
19 #include "wx/menu.h"
20 #include "wx/dcclient.h"
21#endif
22
23#include "wx/osx/private.h"
24
25@interface wxNSPopUpButton : NSPopUpButton
26{
dbeddfb9
SC
27}
28
dbeddfb9
SC
29@end
30
31@implementation wxNSPopUpButton
32
4dd9fdf8 33+ (void)initialize
dbeddfb9 34{
4dd9fdf8 35 static BOOL initialized = NO;
03647350 36 if (!initialized)
dbeddfb9 37 {
4dd9fdf8
SC
38 initialized = YES;
39 wxOSXCocoaClassAddWXMethods( self );
dbeddfb9
SC
40 }
41}
42
dbeddfb9
SC
43- (int) intValue
44{
45 return [self indexOfSelectedItem];
46}
47
48- (void) setIntValue: (int) v
49{
50 [self selectItemAtIndex:v];
51}
52
53@end
54
03647350
VZ
55wxWidgetImplType* wxWidgetImpl::CreateChoice( wxWindowMac* wxpeer,
56 wxWindowMac* WXUNUSED(parent),
57 wxWindowID WXUNUSED(id),
dbeddfb9 58 wxMenu* menu,
03647350 59 const wxPoint& pos,
dbeddfb9 60 const wxSize& size,
03647350 61 long WXUNUSED(style),
d8207702 62 long WXUNUSED(extraStyle))
dbeddfb9 63{
dbeddfb9
SC
64 NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
65 wxNSPopUpButton* v = [[wxNSPopUpButton alloc] initWithFrame:r pullsDown:NO];
dbeddfb9 66 [v setMenu: menu->GetHMenu()];
cc3fcdff 67 [v setAutoenablesItems:NO];
dbeddfb9 68 wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
dbeddfb9
SC
69 return c;
70}
71
72#endif // wxUSE_CHOICE