Create an NSPopUpButton and size it appropriately
[wxWidgets.git] / src / cocoa / choice.mm
1 /////////////////////////////////////////////////////////////////////////////
2 // Name:        cocoa/choice.mm
3 // Purpose:     wxChoice
4 // Author:      David Elliott
5 // Modified by:
6 // Created:     2003/03/16
7 // RCS-ID:      $Id: 
8 // Copyright:   (c) 2003 David Elliott
9 // Licence:     wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 #include "wx/app.h"
13 #include "wx/choice.h"
14 #include "wx/log.h"
15
16 #import <AppKit/NSPopUpButton.h>
17
18 IMPLEMENT_DYNAMIC_CLASS(wxChoice, wxControl)
19 BEGIN_EVENT_TABLE(wxChoice, wxChoiceBase)
20 END_EVENT_TABLE()
21 // WX_IMPLEMENT_COCOA_OWNER(wxChoice,NSButton,NSControl,NSView)
22
23 bool wxChoice::Create(wxWindow *parent, wxWindowID winid,
24             const wxPoint& pos,
25             const wxSize& size,
26             int n, const wxString choices[],
27             long style,
28             const wxValidator& validator,
29             const wxString& name)
30 {
31     if(!CreateControl(parent,winid,pos,size,style,validator,name))
32         return false;
33
34     SetNSView([[NSPopUpButton alloc] initWithFrame:MakeDefaultNSRect(size)
35         pullsDown: NO]);
36
37     [m_cocoaNSView sizeToFit];
38     if(m_parent)
39         m_parent->CocoaAddChild(this);
40     SetInitialFrameRect(pos,size);
41
42     return true;
43 }
44
45 wxChoice::~wxChoice()
46 {
47     CocoaRemoveFromParent();
48 }
49
50 void wxChoice::Clear()
51 {
52 }
53
54 void wxChoice::Delete(int)
55 {
56 }
57
58 int wxChoice::GetCount() const
59 {
60     return 0;
61 }
62
63 wxString wxChoice::GetString(int) const
64 {
65     return wxEmptyString;
66 }
67
68 void wxChoice::SetString(int, const wxString&)
69 {
70 }
71
72 int wxChoice::FindString(const wxString&) const
73 {
74     return 0;
75 }
76
77 int wxChoice::GetSelection() const
78 {
79     return 0;
80 }
81
82 int wxChoice::DoAppend(const wxString&)
83 {
84     return 0;
85 }
86
87 int wxChoice::DoInsert(const wxString&, int)
88 {
89     return 0;
90 }
91
92 void wxChoice::DoSetItemClientData(int, void*)
93 {
94 }
95
96 void* wxChoice::DoGetItemClientData(int) const
97 {
98     return NULL;
99 }
100
101 void wxChoice::DoSetItemClientObject(int, wxClientData*)
102 {
103 }
104
105 wxClientData* wxChoice::DoGetItemClientObject(int) const
106 {
107     return NULL;
108 }
109
110 void wxChoice::SetSelection(int)
111 {
112 }
113