]> git.saurik.com Git - wxWidgets.git/blame - src/osx/cocoa/choice.mm
Removed extraneous semicolons and commas (partly fixes #10456).
[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{
b466e85a 27 WXCOCOAIMPL_COMMON_MEMBERS
dbeddfb9
SC
28}
29
b466e85a
SC
30WXCOCOAIMPL_COMMON_INTERFACE
31
dbeddfb9
SC
32- (void) clickedAction: (id) sender;
33
34@end
35
36@implementation wxNSPopUpButton
37
38- (id)initWithFrame:(NSRect)frame pullsDown:(BOOL) pd
39{
40 [super initWithFrame:frame pullsDown:pd];
41 impl = NULL;
42 [self setTarget: self];
43 [self setAction: @selector(clickedAction:)];
44 return self;
45}
46
47- (void) clickedAction: (id) sender
48{
49 if ( impl )
50 {
51 wxWindow* wxpeer = (wxWindow*) impl->GetWXPeer();
52 if ( wxpeer )
04236b74 53 wxpeer->OSXHandleClicked(0);
dbeddfb9
SC
54 }
55}
56
b466e85a 57WXCOCOAIMPL_COMMON_IMPLEMENTATION
dbeddfb9
SC
58
59- (int) intValue
60{
61 return [self indexOfSelectedItem];
62}
63
64- (void) setIntValue: (int) v
65{
66 [self selectItemAtIndex:v];
67}
68
69@end
70
71wxWidgetImplType* wxWidgetImpl::CreateChoice( wxWindowMac* wxpeer,
72 wxWindowMac* parent,
73 wxWindowID id,
74 wxMenu* menu,
75 const wxPoint& pos,
76 const wxSize& size,
77 long style,
78 long extraStylew)
79{
dbeddfb9
SC
80 NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
81 wxNSPopUpButton* v = [[wxNSPopUpButton alloc] initWithFrame:r pullsDown:NO];
dbeddfb9
SC
82 [v setMenu: menu->GetHMenu()];
83 wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
84 [v setImplementation:c];
85 return c;
86}
87
88#endif // wxUSE_CHOICE