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