]> git.saurik.com Git - wxWidgets.git/blame - src/stubs/listbox.cpp
conditional compilation for Universal Interfaces (3.4 or later)
[wxWidgets.git] / src / stubs / listbox.cpp
CommitLineData
93cf77c0
JS
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"
34138703 17#include "wx/settings.h"
93cf77c0
JS
18#include "wx/dynarray.h"
19#include "wx/log.h"
20
93cf77c0 21 IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl)
93cf77c0
JS
22
23// ============================================================================
24// list box control implementation
25// ============================================================================
26
27// Listbox item
28wxListBox::wxListBox()
29{
30 m_noItems = 0;
31 m_selected = 0;
32}
33
34bool 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
60wxListBox::~wxListBox()
61{
62}
63
93cf77c0
JS
64void wxListBox::SetFirstItem(int N)
65{
66 // TODO
67}
68
69void wxListBox::SetFirstItem(const wxString& s)
70{
71 // TODO
72}
73
74void wxListBox::Delete(int N)
75{
76 m_noItems --;
77 // TODO
78}
79
80void wxListBox::Append(const wxString& item)
81{
82 m_noItems ++;
83
84 // TODO
85}
86
87void wxListBox::Append(const wxString& item, char *Client_data)
88{
89 m_noItems ++;
90
91 // TODO
92}
93
94void wxListBox::Set(int n, const wxString *choices, char** clientData)
95{
96 m_noItems = n;
97
98 // TODO
99}
100
101int wxListBox::FindString(const wxString& s) const
102{
103 // TODO
104 return -1;
105}
106
107void wxListBox::Clear()
108{
109 m_noItems = 0;
110 // TODO
111}
112
113void wxListBox::SetSelection(int N, bool select)
114{
115 // TODO
116}
117
118bool wxListBox::Selected(int N) const
119{
120 // TODO
121 return FALSE;
122}
123
124void wxListBox::Deselect(int N)
125{
126 // TODO
127}
128
129char *wxListBox::GetClientData(int N) const
130{
131 // TODO
132 return (char *)NULL;
133}
134
135void wxListBox::SetClientData(int N, char *Client_data)
136{
137 // TODO
138}
139
140// Return number of selections and an array of selected integers
141int 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
165int wxListBox::GetSelection() const
166{
167 // TODO
168 return -1;
169}
170
171// Find string for position
172wxString wxListBox::GetString(int N) const
173{
174 // TODO
175 return wxString("");
176}
177
178void wxListBox::SetSize(int x, int y, int width, int height, int sizeFlags)
179{
180 // TODO
181}
182
183void wxListBox::InsertItems(int nItems, const wxString items[], int pos)
184{
185 m_noItems += nItems;
186
187 // TODO
188}
189
190void wxListBox::SetString(int N, const wxString& s)
191{
192 // TODO
193}
194
195int wxListBox::Number () const
196{
197 return m_noItems;
198}
199
200// For single selection items only
201wxString wxListBox::GetStringSelection () const
202{
203 int sel = GetSelection ();
204 if (sel > -1)
205 return this->GetString (sel);
206 else
207 return wxString("");
208}
209
210bool 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
222void 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