]> git.saurik.com Git - wxWidgets.git/blob - src/qt/listbox.cpp
Added casts to fix compile problem
[wxWidgets.git] / src / qt / 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
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
30 wxListBox::wxListBox()
31 {
32 m_noItems = 0;
33 m_selected = 0;
34 }
35
36 bool 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
62 wxListBox::~wxListBox()
63 {
64 }
65
66 void wxListBox::SetupColours()
67 {
68 SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW));
69 }
70
71 void wxListBox::SetFirstItem(int N)
72 {
73 // TODO
74 }
75
76 void wxListBox::SetFirstItem(const wxString& s)
77 {
78 // TODO
79 }
80
81 void wxListBox::Delete(int N)
82 {
83 m_noItems --;
84 // TODO
85 }
86
87 void wxListBox::Append(const wxString& item)
88 {
89 m_noItems ++;
90
91 // TODO
92 }
93
94 void wxListBox::Append(const wxString& item, char *Client_data)
95 {
96 m_noItems ++;
97
98 // TODO
99 }
100
101 void wxListBox::Set(int n, const wxString *choices, char** clientData)
102 {
103 m_noItems = n;
104
105 // TODO
106 }
107
108 int wxListBox::FindString(const wxString& s) const
109 {
110 // TODO
111 return -1;
112 }
113
114 void wxListBox::Clear()
115 {
116 m_noItems = 0;
117 // TODO
118 }
119
120 void wxListBox::SetSelection(int N, bool select)
121 {
122 // TODO
123 }
124
125 bool wxListBox::Selected(int N) const
126 {
127 // TODO
128 return FALSE;
129 }
130
131 void wxListBox::Deselect(int N)
132 {
133 // TODO
134 }
135
136 char *wxListBox::GetClientData(int N) const
137 {
138 // TODO
139 return (char *)NULL;
140 }
141
142 void wxListBox::SetClientData(int N, char *Client_data)
143 {
144 // TODO
145 }
146
147 // Return number of selections and an array of selected integers
148 int wxListBox::GetSelections(wxArrayInt& aSelections) const
149 {
150 aSelections.Empty();
151
152 /* TODO
153 if ((m_windowStyle & wxLB_MULTIPLE) || (m_windowStyle & wxLB_EXTENDED))
154 {
155 int no_sel = ??
156 for ( int n = 0; n < no_sel; n++ )
157 aSelections.Add(??);
158
159 return no_sel;
160 }
161 else // single-selection listbox
162 {
163 aSelections.Add(??);
164
165 return 1;
166 }
167 */
168 return 0;
169 }
170
171 // Get single selection, for single choice list items
172 int wxListBox::GetSelection() const
173 {
174 // TODO
175 return -1;
176 }
177
178 // Find string for position
179 wxString wxListBox::GetString(int N) const
180 {
181 // TODO
182 return wxString("");
183 }
184
185 void wxListBox::SetSize(int x, int y, int width, int height, int sizeFlags)
186 {
187 // TODO
188 }
189
190 void wxListBox::InsertItems(int nItems, const wxString items[], int pos)
191 {
192 m_noItems += nItems;
193
194 // TODO
195 }
196
197 void wxListBox::SetString(int N, const wxString& s)
198 {
199 // TODO
200 }
201
202 int wxListBox::Number () const
203 {
204 return m_noItems;
205 }
206
207 // For single selection items only
208 wxString wxListBox::GetStringSelection () const
209 {
210 int sel = GetSelection ();
211 if (sel > -1)
212 return this->GetString (sel);
213 else
214 return wxString("");
215 }
216
217 bool wxListBox::SetStringSelection (const wxString& s, bool flag)
218 {
219 int sel = FindString (s);
220 if (sel > -1)
221 {
222 SetSelection (sel, flag);
223 return TRUE;
224 }
225 else
226 return FALSE;
227 }
228
229 void wxListBox::Command (wxCommandEvent & event)
230 {
231 if (event.m_extraLong)
232 SetSelection (event.m_commandInt);
233 else
234 {
235 Deselect (event.m_commandInt);
236 return;
237 }
238 ProcessCommand (event);
239 }
240