]> git.saurik.com Git - wxWidgets.git/blame - src/qt/listbox.cpp
VTK wrapper of vtkRenderWindow for wxPython. Tested on MSW so far.
[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
KB
21#if !USE_SHARED_LIBRARY
22 IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl)
23#endif
7c78e7c7 24
01b2eeec
KB
25// ============================================================================
26// list box control implementation
27// ============================================================================
7c78e7c7 28
01b2eeec
KB
29// Listbox item
30wxListBox::wxListBox()
7c78e7c7 31{
01b2eeec
KB
32 m_noItems = 0;
33 m_selected = 0;
34}
7c78e7c7 35
01b2eeec
KB
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)
7c78e7c7 43{
01b2eeec
KB
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));
7c78e7c7 54
01b2eeec
KB
55 m_windowId = ( id == -1 ) ? (int)NewControlId() : id;
56
57 // TODO create listbox
58
59 return FALSE;
60}
61
62wxListBox::~wxListBox()
7c78e7c7 63{
01b2eeec 64}
7c78e7c7 65
01b2eeec 66void wxListBox::SetupColours()
7c78e7c7 67{
01b2eeec
KB
68 SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW));
69}
7c78e7c7 70
01b2eeec 71void wxListBox::SetFirstItem(int N)
7c78e7c7 72{
01b2eeec
KB
73 // TODO
74}
7c78e7c7 75
01b2eeec 76void wxListBox::SetFirstItem(const wxString& s)
7c78e7c7 77{
01b2eeec
KB
78 // TODO
79}
7c78e7c7 80
01b2eeec 81void wxListBox::Delete(int N)
7c78e7c7 82{
01b2eeec
KB
83 m_noItems --;
84 // TODO
85}
7c78e7c7 86
01b2eeec 87void wxListBox::Append(const wxString& item)
7c78e7c7 88{
01b2eeec
KB
89 m_noItems ++;
90
91 // TODO
92}
7c78e7c7 93
01b2eeec 94void wxListBox::Append(const wxString& item, char *Client_data)
7c78e7c7 95{
01b2eeec
KB
96 m_noItems ++;
97
98 // TODO
99}
7c78e7c7 100
01b2eeec 101void wxListBox::Set(int n, const wxString *choices, char** clientData)
7c78e7c7 102{
01b2eeec 103 m_noItems = n;
7c78e7c7 104
01b2eeec
KB
105 // TODO
106}
107
108int wxListBox::FindString(const wxString& s) const
7c78e7c7 109{
01b2eeec
KB
110 // TODO
111 return -1;
112}
7c78e7c7 113
01b2eeec 114void wxListBox::Clear()
7c78e7c7 115{
01b2eeec
KB
116 m_noItems = 0;
117 // TODO
118}
7c78e7c7 119
01b2eeec 120void wxListBox::SetSelection(int N, bool select)
7c78e7c7 121{
01b2eeec
KB
122 // TODO
123}
7c78e7c7 124
01b2eeec 125bool wxListBox::Selected(int N) const
7c78e7c7 126{
01b2eeec
KB
127 // TODO
128 return FALSE;
129}
7c78e7c7 130
01b2eeec 131void wxListBox::Deselect(int N)
7c78e7c7 132{
01b2eeec
KB
133 // TODO
134}
7c78e7c7 135
01b2eeec 136char *wxListBox::GetClientData(int N) const
7c78e7c7 137{
01b2eeec
KB
138 // TODO
139 return (char *)NULL;
140}
141
142void wxListBox::SetClientData(int N, char *Client_data)
143{
144 // TODO
145}
146
147// Return number of selections and an array of selected integers
148int wxListBox::GetSelections(wxArrayInt& aSelections) const
149{
150 aSelections.Empty();
7c78e7c7 151
01b2eeec
KB
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
172int wxListBox::GetSelection() const
7c78e7c7 173{
01b2eeec
KB
174 // TODO
175 return -1;
176}
7c78e7c7 177
01b2eeec
KB
178// Find string for position
179wxString wxListBox::GetString(int N) const
7c78e7c7 180{
01b2eeec
KB
181 // TODO
182 return wxString("");
183}
7c78e7c7 184
01b2eeec 185void wxListBox::SetSize(int x, int y, int width, int height, int sizeFlags)
7c78e7c7 186{
01b2eeec
KB
187 // TODO
188}
7c78e7c7 189
01b2eeec 190void wxListBox::InsertItems(int nItems, const wxString items[], int pos)
7c78e7c7 191{
01b2eeec 192 m_noItems += nItems;
7c78e7c7 193
01b2eeec
KB
194 // TODO
195}
196
197void wxListBox::SetString(int N, const wxString& s)
7c78e7c7 198{
01b2eeec
KB
199 // TODO
200}
7c78e7c7 201
01b2eeec 202int wxListBox::Number () const
7c78e7c7 203{
01b2eeec
KB
204 return m_noItems;
205}
7c78e7c7 206
01b2eeec
KB
207// For single selection items only
208wxString wxListBox::GetStringSelection () const
7c78e7c7 209{
01b2eeec
KB
210 int sel = GetSelection ();
211 if (sel > -1)
212 return this->GetString (sel);
213 else
214 return wxString("");
215}
7c78e7c7 216
01b2eeec
KB
217bool 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}
7c78e7c7 228
01b2eeec
KB
229void 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}
7c78e7c7 240