]> git.saurik.com Git - wxWidgets.git/blame - src/generic/choicdgg.cpp
Don't use wxRendererNative::DrawFocusRect() under Mac.
[wxWidgets.git] / src / generic / choicdgg.cpp
CommitLineData
c801d85f 1/////////////////////////////////////////////////////////////////////////////
7b504551 2// Name: src/generic/choicdgg.cpp
c801d85f
KB
3// Purpose: Choice dialogs
4// Author: Julian Smart
d6c9c1b7 5// Modified by: 03.11.00: VZ to add wxArrayString and multiple sel functions
c801d85f
KB
6// Created: 04/01/98
7// RCS-ID: $Id$
77ffb593 8// Copyright: (c) wxWidgets team
65571936 9// Licence: wxWindows licence
c801d85f
KB
10/////////////////////////////////////////////////////////////////////////////
11
d6c9c1b7
VZ
12// ============================================================================
13// declarations
14// ============================================================================
15
d6c9c1b7
VZ
16// ----------------------------------------------------------------------------
17// headers
18// ----------------------------------------------------------------------------
19
c801d85f
KB
20// For compilers that support precompilation, includes "wx.h".
21#include "wx/wxprec.h"
22
23#ifdef __BORLANDC__
d427503c 24 #pragma hdrstop
c801d85f
KB
25#endif
26
1e6feb95
VZ
27#if wxUSE_CHOICEDLG
28
c801d85f 29#ifndef WX_PRECOMP
257bf510
VZ
30 #include <stdio.h>
31 #include "wx/utils.h"
32 #include "wx/dialog.h"
33 #include "wx/button.h"
34 #include "wx/listbox.h"
63c02113 35 #include "wx/checklst.h"
257bf510
VZ
36 #include "wx/stattext.h"
37 #include "wx/intl.h"
92afa2b1 38 #include "wx/sizer.h"
2da2f941 39 #include "wx/arrstr.h"
dcf924a3
RR
40#endif
41
897b24cf 42#include "wx/statline.h"
6fe7685d 43#include "wx/settings.h"
c801d85f
KB
44#include "wx/generic/choicdgg.h"
45
d6c9c1b7
VZ
46// ----------------------------------------------------------------------------
47// constants
48// ----------------------------------------------------------------------------
49
257bf510 50#define wxID_LISTBOX 3000
dcf924a3 51
d6c9c1b7
VZ
52// ----------------------------------------------------------------------------
53// private functions
54// ----------------------------------------------------------------------------
55
56// convert wxArrayString into a wxString[] which must be delete[]d by caller
57static int ConvertWXArrayToC(const wxArrayString& aChoices, wxString **choices);
58
59// ============================================================================
60// implementation
61// ============================================================================
62
63// ----------------------------------------------------------------------------
64// helpers
65// ----------------------------------------------------------------------------
66
67int ConvertWXArrayToC(const wxArrayString& aChoices, wxString **choices)
68{
69 int n = aChoices.GetCount();
70 *choices = new wxString[n];
54b84891 71
d6c9c1b7
VZ
72 for ( int i = 0; i < n; i++ )
73 {
ea660175 74 (*choices)[i] = aChoices[i];
d6c9c1b7
VZ
75 }
76
77 return n;
78}
79
80// ----------------------------------------------------------------------------
81// wrapper functions
82// ----------------------------------------------------------------------------
83
84wxString wxGetSingleChoice( const wxString& message,
85 const wxString& caption,
86 int n, const wxString *choices,
87 wxWindow *parent,
88 int WXUNUSED(x), int WXUNUSED(y),
89 bool WXUNUSED(centre),
697f4a96
VZ
90 int WXUNUSED(width), int WXUNUSED(height),
91 int initialSelection)
c801d85f 92{
d427503c 93 wxSingleChoiceDialog dialog(parent, message, caption, n, choices);
697f4a96
VZ
94
95 dialog.SetSelection(initialSelection);
96
3ca6a5f0 97 wxString choice;
d427503c 98 if ( dialog.ShowModal() == wxID_OK )
3ca6a5f0
BP
99 choice = dialog.GetStringSelection();
100
101 return choice;
c801d85f
KB
102}
103
d6c9c1b7
VZ
104wxString wxGetSingleChoice( const wxString& message,
105 const wxString& caption,
106 const wxArrayString& aChoices,
107 wxWindow *parent,
108 int x, int y,
109 bool centre,
697f4a96
VZ
110 int width, int height,
111 int initialSelection)
d6c9c1b7
VZ
112{
113 wxString *choices;
114 int n = ConvertWXArrayToC(aChoices, &choices);
115 wxString res = wxGetSingleChoice(message, caption, n, choices, parent,
697f4a96
VZ
116 x, y, centre, width, height,
117 initialSelection);
d6c9c1b7
VZ
118 delete [] choices;
119
120 return res;
121}
122
697f4a96
VZ
123wxString wxGetSingleChoice( const wxString& message,
124 const wxString& caption,
125 const wxArrayString& choices,
126 int initialSelection,
127 wxWindow *parent)
128{
129 return wxGetSingleChoice(message, caption, choices, parent,
130 wxDefaultCoord, wxDefaultCoord,
131 true, wxCHOICE_WIDTH, wxCHOICE_HEIGHT,
132 initialSelection);
133}
134
135wxString wxGetSingleChoice( const wxString& message,
136 const wxString& caption,
137 int n, const wxString *choices,
138 int initialSelection,
139 wxWindow *parent)
140{
141 return wxGetSingleChoice(message, caption, n, choices, parent,
142 wxDefaultCoord, wxDefaultCoord,
143 true, wxCHOICE_WIDTH, wxCHOICE_HEIGHT,
144 initialSelection);
145}
146
d6c9c1b7
VZ
147int wxGetSingleChoiceIndex( const wxString& message,
148 const wxString& caption,
149 int n, const wxString *choices,
150 wxWindow *parent,
151 int WXUNUSED(x), int WXUNUSED(y),
152 bool WXUNUSED(centre),
697f4a96
VZ
153 int WXUNUSED(width), int WXUNUSED(height),
154 int initialSelection)
c801d85f 155{
d427503c 156 wxSingleChoiceDialog dialog(parent, message, caption, n, choices);
697f4a96
VZ
157
158 dialog.SetSelection(initialSelection);
159
3ca6a5f0 160 int choice;
d427503c 161 if ( dialog.ShowModal() == wxID_OK )
3ca6a5f0 162 choice = dialog.GetSelection();
d427503c 163 else
3ca6a5f0
BP
164 choice = -1;
165
166 return choice;
c801d85f
KB
167}
168
2adaf596
VS
169int wxGetSingleChoiceIndex( const wxString& message,
170 const wxString& caption,
171 const wxArrayString& aChoices,
172 wxWindow *parent,
173 int x, int y,
174 bool centre,
697f4a96
VZ
175 int width, int height,
176 int initialSelection)
2adaf596
VS
177{
178 wxString *choices;
179 int n = ConvertWXArrayToC(aChoices, &choices);
180 int res = wxGetSingleChoiceIndex(message, caption, n, choices, parent,
697f4a96
VZ
181 x, y, centre, width, height,
182 initialSelection);
2adaf596
VS
183 delete [] choices;
184
185 return res;
186}
187
697f4a96
VZ
188int wxGetSingleChoiceIndex( const wxString& message,
189 const wxString& caption,
190 const wxArrayString& choices,
191 int initialSelection,
192 wxWindow *parent)
193{
194 return wxGetSingleChoiceIndex(message, caption, choices, parent,
195 wxDefaultCoord, wxDefaultCoord,
196 true, wxCHOICE_WIDTH, wxCHOICE_HEIGHT,
197 initialSelection);
198}
199
200
201int wxGetSingleChoiceIndex( const wxString& message,
202 const wxString& caption,
203 int n, const wxString *choices,
204 int initialSelection,
205 wxWindow *parent)
206{
207 return wxGetSingleChoiceIndex(message, caption, n, choices, parent,
208 wxDefaultCoord, wxDefaultCoord,
209 true, wxCHOICE_WIDTH, wxCHOICE_HEIGHT,
210 initialSelection);
211}
212
213
d6c9c1b7
VZ
214void *wxGetSingleChoiceData( const wxString& message,
215 const wxString& caption,
216 int n, const wxString *choices,
217 void **client_data,
218 wxWindow *parent,
219 int WXUNUSED(x), int WXUNUSED(y),
220 bool WXUNUSED(centre),
697f4a96
VZ
221 int WXUNUSED(width), int WXUNUSED(height),
222 int initialSelection)
c801d85f 223{
b41ec29a
VZ
224 wxSingleChoiceDialog dialog(parent, message, caption, n, choices,
225 (char **)client_data);
697f4a96
VZ
226
227 dialog.SetSelection(initialSelection);
228
3ca6a5f0 229 void *data;
d427503c 230 if ( dialog.ShowModal() == wxID_OK )
3ca6a5f0 231 data = dialog.GetSelectionClientData();
d427503c 232 else
3ca6a5f0
BP
233 data = NULL;
234
235 return data;
c801d85f
KB
236}
237
b41ec29a
VZ
238void *wxGetSingleChoiceData( const wxString& message,
239 const wxString& caption,
240 const wxArrayString& aChoices,
241 void **client_data,
242 wxWindow *parent,
243 int x, int y,
244 bool centre,
697f4a96
VZ
245 int width, int height,
246 int initialSelection)
b41ec29a
VZ
247{
248 wxString *choices;
249 int n = ConvertWXArrayToC(aChoices, &choices);
250 void *res = wxGetSingleChoiceData(message, caption, n, choices,
251 client_data, parent,
697f4a96
VZ
252 x, y, centre, width, height,
253 initialSelection);
b41ec29a
VZ
254 delete [] choices;
255
256 return res;
257}
258
697f4a96
VZ
259void* wxGetSingleChoiceData( const wxString& message,
260 const wxString& caption,
261 const wxArrayString& choices,
262 void **client_data,
263 int initialSelection,
264 wxWindow *parent)
265{
266 return wxGetSingleChoiceData(message, caption, choices,
267 client_data, parent,
268 wxDefaultCoord, wxDefaultCoord,
269 true, wxCHOICE_WIDTH, wxCHOICE_HEIGHT,
270 initialSelection);
271}
272
273void* wxGetSingleChoiceData( const wxString& message,
274 const wxString& caption,
275 int n, const wxString *choices,
276 void **client_data,
277 int initialSelection,
278 wxWindow *parent)
279{
280 return wxGetSingleChoiceData(message, caption, n, choices,
281 client_data, parent,
282 wxDefaultCoord, wxDefaultCoord,
283 true, wxCHOICE_WIDTH, wxCHOICE_HEIGHT,
284 initialSelection);
285}
286
287
e5cfb314 288int wxGetSelectedChoices(wxArrayInt& selections,
d6c9c1b7
VZ
289 const wxString& message,
290 const wxString& caption,
291 int n, const wxString *choices,
292 wxWindow *parent,
293 int WXUNUSED(x), int WXUNUSED(y),
294 bool WXUNUSED(centre),
295 int WXUNUSED(width), int WXUNUSED(height))
296{
297 wxMultiChoiceDialog dialog(parent, message, caption, n, choices);
e93bfe3c 298
b2d739ba
VZ
299 // call this even if selections array is empty and this then (correctly)
300 // deselects the first item which is selected by default
301 dialog.SetSelections(selections);
e93bfe3c 302
e5cfb314
VZ
303 if ( dialog.ShowModal() != wxID_OK )
304 {
305 // NB: intentionally do not clear the selections array here, the caller
306 // might want to preserve its original contents if the dialog was
307 // cancelled
308 return -1;
309 }
c801d85f 310
e5cfb314 311 selections = dialog.GetSelections();
d6c9c1b7
VZ
312 return selections.GetCount();
313}
c801d85f 314
e5cfb314 315int wxGetSelectedChoices(wxArrayInt& selections,
d6c9c1b7
VZ
316 const wxString& message,
317 const wxString& caption,
318 const wxArrayString& aChoices,
319 wxWindow *parent,
320 int x, int y,
321 bool centre,
322 int width, int height)
c801d85f 323{
d6c9c1b7
VZ
324 wxString *choices;
325 int n = ConvertWXArrayToC(aChoices, &choices);
e5cfb314 326 int res = wxGetSelectedChoices(selections, message, caption,
d6c9c1b7
VZ
327 n, choices, parent,
328 x, y, centre, width, height);
329 delete [] choices;
330
331 return res;
c801d85f 332}
c801d85f 333
e5cfb314
VZ
334#if WXWIN_COMPATIBILITY_2_8
335size_t wxGetMultipleChoices(wxArrayInt& selections,
336 const wxString& message,
337 const wxString& caption,
338 int n, const wxString *choices,
339 wxWindow *parent,
340 int x, int y,
341 bool centre,
342 int width, int height)
343{
344 int rc = wxGetSelectedChoices(selections, message, caption,
345 n, choices,
346 parent, x, y, centre, width, height);
347 if ( rc == -1 )
348 {
349 selections.clear();
350 return 0;
351 }
352
353 return rc;
354}
355
356size_t wxGetMultipleChoices(wxArrayInt& selections,
357 const wxString& message,
358 const wxString& caption,
359 const wxArrayString& aChoices,
360 wxWindow *parent,
361 int x, int y,
362 bool centre,
363 int width, int height)
364{
365 int rc = wxGetSelectedChoices(selections, message, caption,
366 aChoices,
367 parent, x, y, centre, width, height);
368 if ( rc == -1 )
369 {
370 selections.clear();
371 return 0;
372 }
373
374 return rc;
375}
376#endif // WXWIN_COMPATIBILITY_2_8
377
d6c9c1b7
VZ
378// ----------------------------------------------------------------------------
379// wxAnyChoiceDialog
380// ----------------------------------------------------------------------------
381
382bool wxAnyChoiceDialog::Create(wxWindow *parent,
383 const wxString& message,
384 const wxString& caption,
385 int n, const wxString *choices,
ea660175 386 long styleDlg,
d6c9c1b7
VZ
387 const wxPoint& pos,
388 long styleLbox)
389{
12a124dd
VZ
390 // extract the buttons styles from the dialog one and remove them from it
391 const long styleBtns = styleDlg & (wxOK | wxCANCEL);
392 styleDlg &= ~styleBtns;
393
ca65c044
WS
394 if ( !wxDialog::Create(parent, wxID_ANY, caption, pos, wxDefaultSize, styleDlg) )
395 return false;
d6c9c1b7
VZ
396
397 wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
398
64c794f6 399 // 1) text message
bd9f3519
VZ
400 topsizer->
401 Add(CreateTextSizer(message), wxSizerFlags().Expand().TripleBorder());
402
64c794f6 403 // 2) list box
bd9f3519 404 m_listbox = CreateList(n, choices, styleLbox);
60104cba 405
64c794f6
WS
406 if ( n > 0 )
407 m_listbox->SetSelection(0);
408
bd9f3519 409 topsizer->
6fe7685d 410 Add(m_listbox, wxSizerFlags().Expand().Proportion(1).TripleBorder(wxLEFT | wxRIGHT));
119727ad 411
897b24cf 412 // 3) buttons if any
bd9f3519 413 wxSizer *
12a124dd 414 buttonSizer = CreateSeparatedButtonSizer(styleBtns);
bd9f3519 415 if ( buttonSizer )
897b24cf 416 {
bd9f3519 417 topsizer->Add(buttonSizer, wxSizerFlags().Expand().DoubleBorder());
897b24cf 418 }
64c794f6 419
d6c9c1b7
VZ
420 SetSizer( topsizer );
421
422 topsizer->SetSizeHints( this );
423 topsizer->Fit( this );
424
8316ff5d
VS
425 if ( styleDlg & wxCENTRE )
426 Centre(wxBOTH);
d6c9c1b7
VZ
427
428 m_listbox->SetFocus();
429
ca65c044 430 return true;
d6c9c1b7
VZ
431}
432
584ad2a3
MB
433bool wxAnyChoiceDialog::Create(wxWindow *parent,
434 const wxString& message,
435 const wxString& caption,
436 const wxArrayString& choices,
437 long styleDlg,
438 const wxPoint& pos,
439 long styleLbox)
440{
441 wxCArrayString chs(choices);
442 return Create(parent, message, caption, chs.GetCount(), chs.GetStrings(),
443 styleDlg, pos, styleLbox);
444}
445
60104cba
WS
446wxListBoxBase *wxAnyChoiceDialog::CreateList(int n, const wxString *choices, long styleLbox)
447{
448 return new wxListBox( this, wxID_LISTBOX,
61a11cd6 449 wxDefaultPosition, wxDefaultSize,
60104cba
WS
450 n, choices,
451 styleLbox );
452}
453
d6c9c1b7 454// ----------------------------------------------------------------------------
c801d85f 455// wxSingleChoiceDialog
d6c9c1b7 456// ----------------------------------------------------------------------------
c801d85f 457
c801d85f 458BEGIN_EVENT_TABLE(wxSingleChoiceDialog, wxDialog)
d427503c 459 EVT_BUTTON(wxID_OK, wxSingleChoiceDialog::OnOK)
7b504551 460#ifndef __SMARTPHONE__
d427503c 461 EVT_LISTBOX_DCLICK(wxID_LISTBOX, wxSingleChoiceDialog::OnListBoxDClick)
7b504551
WS
462#endif
463#ifdef __WXWINCE__
464 EVT_JOY_BUTTON_DOWN(wxSingleChoiceDialog::OnJoystickButtonDown)
465#endif
c801d85f
KB
466END_EVENT_TABLE()
467
d6c9c1b7 468IMPLEMENT_DYNAMIC_CLASS(wxSingleChoiceDialog, wxDialog)
257bf510
VZ
469
470wxSingleChoiceDialog::wxSingleChoiceDialog(wxWindow *parent,
471 const wxString& message,
472 const wxString& caption,
c50f1fb9 473 int n,
257bf510
VZ
474 const wxString *choices,
475 char **clientData,
476 long style,
59bd9598 477 const wxPoint& WXUNUSED(pos))
c801d85f 478{
257bf510 479 Create(parent, message, caption, n, choices, clientData, style);
c801d85f
KB
480}
481
584ad2a3
MB
482wxSingleChoiceDialog::wxSingleChoiceDialog(wxWindow *parent,
483 const wxString& message,
484 const wxString& caption,
485 const wxArrayString& choices,
486 char **clientData,
487 long style,
488 const wxPoint& WXUNUSED(pos))
489{
490 Create(parent, message, caption, choices, clientData, style);
491}
492
d6c9c1b7 493bool wxSingleChoiceDialog::Create( wxWindow *parent,
c50f1fb9 494 const wxString& message,
d6c9c1b7 495 const wxString& caption,
c50f1fb9 496 int n,
257bf510
VZ
497 const wxString *choices,
498 char **clientData,
499 long style,
d6c9c1b7 500 const wxPoint& pos )
c801d85f 501{
d6c9c1b7
VZ
502 if ( !wxAnyChoiceDialog::Create(parent, message, caption,
503 n, choices,
504 style, pos) )
ca65c044 505 return false;
92afa2b1 506
d6c9c1b7 507 m_selection = n > 0 ? 0 : -1;
92afa2b1 508
92afa2b1 509 if (clientData)
d427503c 510 {
257bf510
VZ
511 for (int i = 0; i < n; i++)
512 m_listbox->SetClientData(i, clientData[i]);
d427503c 513 }
c801d85f 514
ca65c044 515 return true;
c801d85f
KB
516}
517
584ad2a3
MB
518bool wxSingleChoiceDialog::Create( wxWindow *parent,
519 const wxString& message,
520 const wxString& caption,
521 const wxArrayString& choices,
522 char **clientData,
523 long style,
524 const wxPoint& pos )
525{
526 wxCArrayString chs(choices);
527 return Create( parent, message, caption, chs.GetCount(), chs.GetStrings(),
528 clientData, style, pos );
529}
530
ef77f91e
JS
531// Set the selection
532void wxSingleChoiceDialog::SetSelection(int sel)
533{
e0856740 534 wxCHECK_RET( sel >= 0 && (unsigned)sel < m_listbox->GetCount(),
697f4a96
VZ
535 "Invalid initial selection" );
536
257bf510 537 m_listbox->SetSelection(sel);
ef77f91e
JS
538 m_selection = sel;
539}
540
c801d85f
KB
541void wxSingleChoiceDialog::OnOK(wxCommandEvent& WXUNUSED(event))
542{
7b504551 543 DoChoice();
c801d85f
KB
544}
545
7b504551 546#ifndef __SMARTPHONE__
debe6624 547void wxSingleChoiceDialog::OnListBoxDClick(wxCommandEvent& WXUNUSED(event))
7b504551
WS
548{
549 DoChoice();
550}
551#endif
552
553#ifdef __WXWINCE__
554void wxSingleChoiceDialog::OnJoystickButtonDown(wxJoystickEvent& WXUNUSED(event))
555{
556 DoChoice();
557}
558#endif
559
560void wxSingleChoiceDialog::DoChoice()
debe6624 561{
257bf510
VZ
562 m_selection = m_listbox->GetSelection();
563 m_stringSelection = m_listbox->GetStringSelection();
25f47127 564
eb553cb2 565 if ( m_listbox->HasClientUntypedData() )
59af5f19 566 SetClientData(m_listbox->GetClientData(m_selection));
d427503c
VZ
567
568 EndModal(wxID_OK);
debe6624
JS
569}
570
d6c9c1b7
VZ
571// ----------------------------------------------------------------------------
572// wxMultiChoiceDialog
573// ----------------------------------------------------------------------------
574
d6c9c1b7
VZ
575IMPLEMENT_DYNAMIC_CLASS(wxMultiChoiceDialog, wxDialog)
576
577bool wxMultiChoiceDialog::Create( wxWindow *parent,
578 const wxString& message,
579 const wxString& caption,
580 int n,
581 const wxString *choices,
582 long style,
583 const wxPoint& pos )
584{
cb5d54ff
RD
585 long styleLbox;
586#if wxUSE_CHECKLISTBOX
587 styleLbox = wxLB_ALWAYS_SB;
588#else
589 styleLbox = wxLB_ALWAYS_SB | wxLB_EXTENDED;
590#endif
6fe7685d 591
d6c9c1b7
VZ
592 if ( !wxAnyChoiceDialog::Create(parent, message, caption,
593 n, choices,
594 style, pos,
cb5d54ff 595 styleLbox) )
ca65c044 596 return false;
d6c9c1b7 597
ca65c044 598 return true;
d6c9c1b7
VZ
599}
600
584ad2a3
MB
601bool wxMultiChoiceDialog::Create( wxWindow *parent,
602 const wxString& message,
603 const wxString& caption,
604 const wxArrayString& choices,
605 long style,
606 const wxPoint& pos )
607{
608 wxCArrayString chs(choices);
609 return Create( parent, message, caption, chs.GetCount(),
610 chs.GetStrings(), style, pos );
611}
612
d6c9c1b7
VZ
613void wxMultiChoiceDialog::SetSelections(const wxArrayInt& selections)
614{
abc2857f
JS
615#if wxUSE_CHECKLISTBOX
616 wxCheckListBox* checkListBox = wxDynamicCast(m_listbox, wxCheckListBox);
617 if (checkListBox)
618 {
619 // first clear all currently selected items
620 size_t n,
621 count = checkListBox->GetCount();
622 for ( n = 0; n < count; ++n )
623 {
624 if (checkListBox->IsChecked(n))
625 checkListBox->Check(n, false);
626 }
627
628 // now select the ones which should be selected
629 count = selections.GetCount();
630 for ( n = 0; n < count; n++ )
631 {
632 checkListBox->Check(selections[n]);
633 }
6fe7685d 634
abc2857f
JS
635 return;
636 }
637#endif
6fe7685d 638
d0cc483d
VZ
639 // first clear all currently selected items
640 size_t n,
641 count = m_listbox->GetCount();
642 for ( n = 0; n < count; ++n )
643 {
644 m_listbox->Deselect(n);
645 }
646
647 // now select the ones which should be selected
648 count = selections.GetCount();
649 for ( n = 0; n < count; n++ )
d6c9c1b7
VZ
650 {
651 m_listbox->Select(selections[n]);
652 }
653}
654
3d49ce44 655bool wxMultiChoiceDialog::TransferDataFromWindow()
d6c9c1b7
VZ
656{
657 m_selections.Empty();
abc2857f
JS
658
659#if wxUSE_CHECKLISTBOX
660 wxCheckListBox* checkListBox = wxDynamicCast(m_listbox, wxCheckListBox);
661 if (checkListBox)
662 {
663 size_t count = checkListBox->GetCount();
664 for ( size_t n = 0; n < count; n++ )
665 {
666 if ( checkListBox->IsChecked(n) )
667 m_selections.Add(n);
668 }
669 return true;
670 }
671#endif
672
d6c9c1b7
VZ
673 size_t count = m_listbox->GetCount();
674 for ( size_t n = 0; n < count; n++ )
675 {
676 if ( m_listbox->IsSelected(n) )
677 m_selections.Add(n);
678 }
679
ca65c044 680 return true;
d6c9c1b7 681}
1e6feb95 682
60104cba
WS
683#if wxUSE_CHECKLISTBOX
684
685wxListBoxBase *wxMultiChoiceDialog::CreateList(int n, const wxString *choices, long styleLbox)
686{
687 return new wxCheckListBox( this, wxID_LISTBOX,
61a11cd6 688 wxDefaultPosition, wxDefaultSize,
60104cba
WS
689 n, choices,
690 styleLbox );
691}
692
693#endif // wxUSE_CHECKLISTBOX
694
1e6feb95 695#endif // wxUSE_CHOICEDLG