]> git.saurik.com Git - wxWidgets.git/blame - src/qt/listbox.cpp
Added support for more special characters
[wxWidgets.git] / src / qt / listbox.cpp
CommitLineData
01b2eeec 1///////////////////////////////////////////////////////////////////////////////
7c78e7c7 2// Name: listbox.cpp
01b2eeec
KB
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///////////////////////////////////////////////////////////////////////////////
7c78e7c7
RR
11
12#ifdef __GNUG__
13#pragma implementation "listbox.h"
14#endif
15
7c78e7c7 16#include "wx/listbox.h"
7c78e7c7 17
01b2eeec
KB
18#include "wx/dynarray.h"
19#include "wx/log.h"
7c78e7c7 20
01b2eeec 21 IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl)
7c78e7c7 22
01b2eeec
KB
23// ============================================================================
24// list box control implementation
25// ============================================================================
7c78e7c7 26
01b2eeec
KB
27// Listbox item
28wxListBox::wxListBox()
7c78e7c7 29{
01b2eeec
KB
30 m_noItems = 0;
31 m_selected = 0;
32}
7c78e7c7 33
01b2eeec
KB
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)
7c78e7c7 41{
01b2eeec
KB
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));
7c78e7c7 52
01b2eeec
KB
53 m_windowId = ( id == -1 ) ? (int)NewControlId() : id;
54
55 // TODO create listbox
56
57 return FALSE;
58}
59
60wxListBox::~wxListBox()
7c78e7c7 61{
01b2eeec 62}
7c78e7c7 63
01b2eeec 64void wxListBox::SetupColours()
7c78e7c7 65{
01b2eeec
KB
66 SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW));
67}
7c78e7c7 68
01b2eeec 69void wxListBox::SetFirstItem(int N)
7c78e7c7 70{
01b2eeec
KB
71 // TODO
72}
7c78e7c7 73
01b2eeec 74void wxListBox::SetFirstItem(const wxString& s)
7c78e7c7 75{
01b2eeec
KB
76 // TODO
77}
7c78e7c7 78
01b2eeec 79void wxListBox::Delete(int N)
7c78e7c7 80{
01b2eeec
KB
81 m_noItems --;
82 // TODO
83}
7c78e7c7 84
01b2eeec 85void wxListBox::Append(const wxString& item)
7c78e7c7 86{
01b2eeec
KB
87 m_noItems ++;
88
89 // TODO
90}
7c78e7c7 91
01b2eeec 92void wxListBox::Append(const wxString& item, char *Client_data)
7c78e7c7 93{
01b2eeec
KB
94 m_noItems ++;
95
96 // TODO
97}
7c78e7c7 98
01b2eeec 99void wxListBox::Set(int n, const wxString *choices, char** clientData)
7c78e7c7 100{
01b2eeec 101 m_noItems = n;
7c78e7c7 102
01b2eeec
KB
103 // TODO
104}
105
106int wxListBox::FindString(const wxString& s) const
7c78e7c7 107{
01b2eeec
KB
108 // TODO
109 return -1;
110}
7c78e7c7 111
01b2eeec 112void wxListBox::Clear()
7c78e7c7 113{
01b2eeec
KB
114 m_noItems = 0;
115 // TODO
116}
7c78e7c7 117
01b2eeec 118void wxListBox::SetSelection(int N, bool select)
7c78e7c7 119{
01b2eeec
KB
120 // TODO
121}
7c78e7c7 122
01b2eeec 123bool wxListBox::Selected(int N) const
7c78e7c7 124{
01b2eeec
KB
125 // TODO
126 return FALSE;
127}
7c78e7c7 128
01b2eeec 129void wxListBox::Deselect(int N)
7c78e7c7 130{
01b2eeec
KB
131 // TODO
132}
7c78e7c7 133
01b2eeec 134char *wxListBox::GetClientData(int N) const
7c78e7c7 135{
01b2eeec
KB
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();
7c78e7c7 149
01b2eeec
KB
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
7c78e7c7 171{
01b2eeec
KB
172 // TODO
173 return -1;
174}
7c78e7c7 175
01b2eeec
KB
176// Find string for position
177wxString wxListBox::GetString(int N) const
7c78e7c7 178{
01b2eeec
KB
179 // TODO
180 return wxString("");
181}
7c78e7c7 182
01b2eeec 183void wxListBox::SetSize(int x, int y, int width, int height, int sizeFlags)
7c78e7c7 184{
01b2eeec
KB
185 // TODO
186}
7c78e7c7 187
01b2eeec 188void wxListBox::InsertItems(int nItems, const wxString items[], int pos)
7c78e7c7 189{
01b2eeec 190 m_noItems += nItems;
7c78e7c7 191
01b2eeec
KB
192 // TODO
193}
194
195void wxListBox::SetString(int N, const wxString& s)
7c78e7c7 196{
01b2eeec
KB
197 // TODO
198}
7c78e7c7 199
01b2eeec 200int wxListBox::Number () const
7c78e7c7 201{
01b2eeec
KB
202 return m_noItems;
203}
7c78e7c7 204
01b2eeec
KB
205// For single selection items only
206wxString wxListBox::GetStringSelection () const
7c78e7c7 207{
01b2eeec
KB
208 int sel = GetSelection ();
209 if (sel > -1)
210 return this->GetString (sel);
211 else
212 return wxString("");
213}
7c78e7c7 214
01b2eeec
KB
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}
7c78e7c7 226
01b2eeec
KB
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}
7c78e7c7 238