Create an NSView in leiu of a real listbox
[wxWidgets.git] / src / cocoa / listbox.mm
1 /////////////////////////////////////////////////////////////////////////////
2 // Name:        cocoa/listbox.mm
3 // Purpose:     wxListBox
4 // Author:      David Elliott
5 // Modified by:
6 // Created:     2003/03/18
7 // RCS-ID:      $Id: 
8 // Copyright:   (c) 2003 David Elliott
9 // Licence:     wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 #include "wx/app.h"
13 #include "wx/listbox.h"
14 #include "wx/log.h"
15
16 #import <AppKit/NSView.h>
17
18 IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl)
19 BEGIN_EVENT_TABLE(wxListBox, wxListBoxBase)
20 END_EVENT_TABLE()
21 // WX_IMPLEMENT_COCOA_OWNER(wxListBox,NSButton,NSControl,NSView)
22
23 bool wxListBox::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([[NSView alloc] initWithFrame: NSMakeRect(10,10,20,20)]);
35     [m_cocoaNSView release];
36
37     if(m_parent)
38         m_parent->CocoaAddChild(this);
39     return true;
40 }
41
42 wxListBox::~wxListBox()
43 {
44     CocoaRemoveFromParent();
45     SetNSView(NULL);
46 }
47
48 // pure virtuals from wxListBoxBase
49 bool wxListBox::IsSelected(int n) const
50 {
51     return false;
52 }
53
54 void wxListBox::SetSelection(int n, bool select)
55 {
56 }
57
58 int wxListBox::GetSelections(wxArrayInt& aSelections) const
59 {
60     return 0;
61 }
62
63 void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
64 {
65 }
66
67 void wxListBox::DoSetItems(const wxArrayString& items, void **clientData)
68 {
69 }
70
71 void wxListBox::DoSetFirstItem(int n)
72 {
73 }
74
75
76 // pure virtuals from wxItemContainer
77     // deleting items
78 void wxListBox::Clear()
79 {
80 }
81
82 void wxListBox::Delete(int n)
83 {
84 }
85
86     // accessing strings
87 int wxListBox::GetCount() const
88 {
89     return 0;
90 }
91
92 wxString wxListBox::GetString(int n) const
93 {
94     return wxEmptyString;
95 }
96
97 void wxListBox::SetString(int n, const wxString& s)
98 {
99 }
100
101 int wxListBox::FindString(const wxString& s) const
102 {
103     return 0;
104 }
105
106     // selection
107 void wxListBox::Select(int n)
108 {
109 }
110
111 int wxListBox::GetSelection() const
112 {
113     return 0;
114 }
115
116 int wxListBox::DoAppend(const wxString& item)
117 {
118     return 0;
119 }
120
121 void wxListBox::DoSetItemClientData(int n, void* clientData)
122 {
123 }
124
125 void* wxListBox::DoGetItemClientData(int n) const
126 {
127     return NULL;
128 }
129
130 void wxListBox::DoSetItemClientObject(int n, wxClientData* clientData)
131 {
132 }
133
134 wxClientData* wxListBox::DoGetItemClientObject(int n) const
135 {
136     return NULL;
137 }
138