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