]> git.saurik.com Git - wxWidgets.git/blob - src/stubs/listbox.cpp
Added some casts in hopes of fixing HP compilation problem
[wxWidgets.git] / src / stubs / listbox.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: listbox.cpp
3 // Purpose: wxListBox
4 // Author: AUTHOR
5 // Modified by:
6 // Created: ??/??/98
7 // RCS-ID: $Id$
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #ifdef __GNUG__
13 #pragma implementation "listbox.h"
14 #endif
15
16 #include "wx/listbox.h"
17 #include "wx/settings.h"
18 #include "wx/dynarray.h"
19 #include "wx/log.h"
20
21 IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl)
22
23 // ============================================================================
24 // list box control implementation
25 // ============================================================================
26
27 // Listbox item
28 wxListBox::wxListBox()
29 {
30 m_noItems = 0;
31 m_selected = 0;
32 }
33
34 bool wxListBox::Create(wxWindow *parent, wxWindowID id,
35 const wxPoint& pos,
36 const wxSize& size,
37 int n, const wxString choices[],
38 long style,
39 const wxValidator& validator,
40 const wxString& name)
41 {
42 m_noItems = n;
43 m_selected = 0;
44
45 SetName(name);
46 SetValidator(validator);
47
48 if (parent) parent->AddChild(this);
49
50 wxSystemSettings settings;
51 SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW));
52
53 m_windowId = ( id == -1 ) ? (int)NewControlId() : id;
54
55 // TODO create listbox
56
57 return FALSE;
58 }
59
60 wxListBox::~wxListBox()
61 {
62 }
63
64 void wxListBox::SetFirstItem(int N)
65 {
66 // TODO
67 }
68
69 void wxListBox::SetFirstItem(const wxString& s)
70 {
71 // TODO
72 }
73
74 void wxListBox::Delete(int N)
75 {
76 m_noItems --;
77 // TODO
78 }
79
80 void wxListBox::Append(const wxString& item)
81 {
82 m_noItems ++;
83
84 // TODO
85 }
86
87 void wxListBox::Append(const wxString& item, char *Client_data)
88 {
89 m_noItems ++;
90
91 // TODO
92 }
93
94 void wxListBox::Set(int n, const wxString *choices, char** clientData)
95 {
96 m_noItems = n;
97
98 // TODO
99 }
100
101 int wxListBox::FindString(const wxString& s) const
102 {
103 // TODO
104 return -1;
105 }
106
107 void wxListBox::Clear()
108 {
109 m_noItems = 0;
110 // TODO
111 }
112
113 void wxListBox::SetSelection(int N, bool select)
114 {
115 // TODO
116 }
117
118 bool wxListBox::Selected(int N) const
119 {
120 // TODO
121 return FALSE;
122 }
123
124 void wxListBox::Deselect(int N)
125 {
126 // TODO
127 }
128
129 char *wxListBox::GetClientData(int N) const
130 {
131 // TODO
132 return (char *)NULL;
133 }
134
135 void wxListBox::SetClientData(int N, char *Client_data)
136 {
137 // TODO
138 }
139
140 // Return number of selections and an array of selected integers
141 int wxListBox::GetSelections(wxArrayInt& aSelections) const
142 {
143 aSelections.Empty();
144
145 /* TODO
146 if ((m_windowStyle & wxLB_MULTIPLE) || (m_windowStyle & wxLB_EXTENDED))
147 {
148 int no_sel = ??
149 for ( int n = 0; n < no_sel; n++ )
150 aSelections.Add(??);
151
152 return no_sel;
153 }
154 else // single-selection listbox
155 {
156 aSelections.Add(??);
157
158 return 1;
159 }
160 */
161 return 0;
162 }
163
164 // Get single selection, for single choice list items
165 int wxListBox::GetSelection() const
166 {
167 // TODO
168 return -1;
169 }
170
171 // Find string for position
172 wxString wxListBox::GetString(int N) const
173 {
174 // TODO
175 return wxString("");
176 }
177
178 void wxListBox::SetSize(int x, int y, int width, int height, int sizeFlags)
179 {
180 // TODO
181 }
182
183 void wxListBox::InsertItems(int nItems, const wxString items[], int pos)
184 {
185 m_noItems += nItems;
186
187 // TODO
188 }
189
190 void wxListBox::SetString(int N, const wxString& s)
191 {
192 // TODO
193 }
194
195 int wxListBox::Number () const
196 {
197 return m_noItems;
198 }
199
200 // For single selection items only
201 wxString wxListBox::GetStringSelection () const
202 {
203 int sel = GetSelection ();
204 if (sel > -1)
205 return this->GetString (sel);
206 else
207 return wxString("");
208 }
209
210 bool wxListBox::SetStringSelection (const wxString& s, bool flag)
211 {
212 int sel = FindString (s);
213 if (sel > -1)
214 {
215 SetSelection (sel, flag);
216 return TRUE;
217 }
218 else
219 return FALSE;
220 }
221
222 void wxListBox::Command (wxCommandEvent & event)
223 {
224 if (event.m_extraLong)
225 SetSelection (event.m_commandInt);
226 else
227 {
228 Deselect (event.m_commandInt);
229 return;
230 }
231 ProcessCommand (event);
232 }
233