]> git.saurik.com Git - wxWidgets.git/blob - src/osx/cocoa/combobox.mm
Support mouse click through as otherwise clicking inside an inactive window causes...
[wxWidgets.git] / src / osx / cocoa / combobox.mm
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/cocoa/combobox.mm
3 // Purpose: wxChoice
4 // Author: Stefan Csomor
5 // Modified by:
6 // Created: 1998-01-01
7 // RCS-ID: $Id: combobox.mm 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_COMBOBOX && defined(wxOSX_USE_NATIVE_COMBOBOX)
15
16 #include "wx/combobox.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 // work in progress
26
27 @interface wxNSComboBox : NSComboBox
28 {
29 }
30
31 @end
32
33 @implementation wxNSComboBox
34
35 + (void)initialize
36 {
37 static BOOL initialized = NO;
38 if (!initialized)
39 {
40 initialized = YES;
41 wxOSXCocoaClassAddWXMethods( self );
42 }
43 }
44
45 - (int) intValue
46 {
47 return [self indexOfSelectedItem];
48 }
49
50 - (void) setIntValue: (int) v
51 {
52 [self selectItemAtIndex:v];
53 }
54
55 @end
56
57 wxWidgetImplType* wxWidgetImpl::CreateComboBox( wxWindowMac* wxpeer,
58 wxWindowMac* WXUNUSED(parent),
59 wxWindowID WXUNUSED(id),
60 wxMenu* menu,
61 const wxPoint& pos,
62 const wxSize& size,
63 long WXUNUSED(style),
64 long WXUNUSED(extraStyle))
65 {
66 NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
67 wxNSComboBox* v = [[wxNSComboBox alloc] initWithFrame:r];
68 wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
69 return c;
70 }
71
72 #endif // wxUSE_COMBOBOX && defined(wxOSX_USE_NATIVE_COMBOBOX)