]> git.saurik.com Git - wxWidgets.git/blame - samples/checklst/checklst.cpp
wx.aui.AUI_ART_GRADIENT_TYPE --> wx.aui.AUI_DOCKART_GRADIENT_TYPE
[wxWidgets.git] / samples / checklst / checklst.cpp
CommitLineData
457814b5
JS
1///////////////////////////////////////////////////////////////////////////////
2// Name: checklst.cpp
3// Purpose: wxCheckListBox sample
4// Author: Vadim Zeitlin
655822f3 5// Modified by:
457814b5
JS
6// Created: 13.11.97
7// RCS-ID: $Id$
8// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
9// Licence: wxWindows license
10///////////////////////////////////////////////////////////////////////////////
11
457814b5
JS
12// For compilers that support precompilation, includes "wx.h".
13#include "wx/wxprec.h"
14
15#ifdef __BORLANDC__
bbdbfb0e 16 #pragma hdrstop
457814b5
JS
17#endif
18
19#ifndef WX_PRECOMP
bbdbfb0e 20#include "wx/wx.h"
457814b5
JS
21#endif
22
b292e2f5 23#ifdef __WXMSW__
bbdbfb0e 24 #include "wx/ownerdrw.h"
b292e2f5 25#endif
bbdbfb0e
VZ
26
27#include "wx/log.h"
28
d8d474af 29#include "wx/sizer.h"
457814b5 30#include "wx/menuitem.h"
b292e2f5
RR
31#include "wx/checklst.h"
32
f62f1618
MW
33#if !wxUSE_CHECKLISTBOX
34 #error "This sample can't be built without wxUSE_CHECKLISTBOX"
35#endif // wxUSE_CHECKLISTBOX
36
457814b5
JS
37// Define a new application type
38class CheckListBoxApp: public wxApp
39{
40public:
bbdbfb0e 41 bool OnInit();
457814b5
JS
42};
43
44// Define a new frame type
45class CheckListBoxFrame : public wxFrame
46{
47public:
bbdbfb0e 48 // ctor & dtor
1914bb8e 49 CheckListBoxFrame(wxFrame *frame, const wxChar *title);
958d3a7e 50 virtual ~CheckListBoxFrame(){};
bbdbfb0e
VZ
51
52 // notifications
3dabb1e5
VZ
53 void OnQuit(wxCommandEvent& event);
54 void OnAbout(wxCommandEvent& event);
d553ceb2 55
3dabb1e5
VZ
56 void OnCheckFirstItem(wxCommandEvent& event);
57 void OnUncheckFirstItem(wxCommandEvent& event);
58 void OnToggleFirstItem(wxCommandEvent& event);
df7d383f 59 void OnToggleSelection(wxCommandEvent& event);
4a46cbe8
RR
60 void OnToggleSorting(wxCommandEvent& event);
61 void OnToggleExtended(wxCommandEvent& event);
62
63 void OnInsertItemsStart(wxCommandEvent& event);
64 void OnInsertItemsMiddle(wxCommandEvent& event);
65 void OnInsertItemsEnd(wxCommandEvent& event);
66 void OnAppendItems(wxCommandEvent& event);
67 void OnRemoveItems(wxCommandEvent& event);
68
4a46cbe8
RR
69 void OnGetBestSize(wxCommandEvent& event);
70
71 void OnMakeItemFirst(wxCommandEvent& event);
d553ceb2 72
3dabb1e5
VZ
73 void OnListboxSelect(wxCommandEvent& event);
74 void OnCheckboxToggle(wxCommandEvent& event);
bbdbfb0e 75 void OnListboxDblClick(wxCommandEvent& event);
d553ceb2 76
3dabb1e5
VZ
77 void OnButtonUp(wxCommandEvent& event);
78 void OnButtonDown(wxCommandEvent& event);
457814b5 79
bbdbfb0e 80private:
df7d383f
VZ
81 void CreateCheckListbox(long flags = 0);
82
bbdbfb0e 83 void OnButtonMove(bool up);
457814b5 84
f048e32f
VZ
85 void AdjustColour(size_t index);
86
df7d383f
VZ
87 wxPanel *m_panel;
88
bbdbfb0e 89 wxCheckListBox *m_pListBox;
457814b5 90
bbdbfb0e 91 DECLARE_EVENT_TABLE()
457814b5
JS
92};
93
655822f3
VZ
94enum
95{
1914bb8e
WS
96 Menu_About = wxID_ABOUT,
97 Menu_Quit = wxID_EXIT,
3dabb1e5 98
1914bb8e 99 Menu_CheckFirst = wxID_HIGHEST,
3dabb1e5
VZ
100 Menu_UncheckFirst,
101 Menu_ToggleFirst,
df7d383f 102 Menu_Selection,
4a46cbe8
RR
103 Menu_Extended,
104 Menu_Sorting,
105 Menu_InsertItemsStart,
106 Menu_InsertItemsMiddle,
107 Menu_InsertItemsEnd,
108 Menu_AppendItems,
109 Menu_RemoveItems,
4a46cbe8
RR
110 Menu_GetBestSize,
111 Menu_MakeItemFirst,
df7d383f 112
1914bb8e 113 Control_First,
bbdbfb0e 114 Control_Listbox,
1914bb8e
WS
115
116 Btn_Up = wxID_UP,
117 Btn_Down = wxID_DOWN
457814b5
JS
118};
119
120BEGIN_EVENT_TABLE(CheckListBoxFrame, wxFrame)
df7d383f 121 EVT_MENU(Menu_About, CheckListBoxFrame::OnAbout)
bbdbfb0e
VZ
122 EVT_MENU(Menu_Quit, CheckListBoxFrame::OnQuit)
123
3dabb1e5
VZ
124 EVT_MENU(Menu_CheckFirst, CheckListBoxFrame::OnCheckFirstItem)
125 EVT_MENU(Menu_UncheckFirst, CheckListBoxFrame::OnUncheckFirstItem)
126 EVT_MENU(Menu_ToggleFirst, CheckListBoxFrame::OnToggleFirstItem)
df7d383f 127 EVT_MENU(Menu_Selection, CheckListBoxFrame::OnToggleSelection)
4a46cbe8
RR
128 EVT_MENU(Menu_Extended, CheckListBoxFrame::OnToggleExtended)
129 EVT_MENU(Menu_Sorting, CheckListBoxFrame::OnToggleSorting)
c1dcb1a0 130
4a46cbe8
RR
131 EVT_MENU(Menu_InsertItemsStart, CheckListBoxFrame::OnInsertItemsStart)
132 EVT_MENU(Menu_InsertItemsMiddle, CheckListBoxFrame::OnInsertItemsMiddle)
133 EVT_MENU(Menu_InsertItemsEnd, CheckListBoxFrame::OnInsertItemsEnd)
134 EVT_MENU(Menu_AppendItems, CheckListBoxFrame::OnAppendItems)
135 EVT_MENU(Menu_RemoveItems, CheckListBoxFrame::OnRemoveItems)
136
4a46cbe8
RR
137 EVT_MENU(Menu_GetBestSize, CheckListBoxFrame::OnGetBestSize)
138
139 EVT_MENU(Menu_MakeItemFirst, CheckListBoxFrame::OnMakeItemFirst)
df7d383f 140
bbdbfb0e
VZ
141 EVT_LISTBOX(Control_Listbox, CheckListBoxFrame::OnListboxSelect)
142 EVT_CHECKLISTBOX(Control_Listbox, CheckListBoxFrame::OnCheckboxToggle)
143 EVT_LISTBOX_DCLICK(Control_Listbox, CheckListBoxFrame::OnListboxDblClick)
144
145 EVT_BUTTON(Btn_Up, CheckListBoxFrame::OnButtonUp)
146 EVT_BUTTON(Btn_Down, CheckListBoxFrame::OnButtonDown)
457814b5
JS
147END_EVENT_TABLE()
148
004f4002 149IMPLEMENT_APP(CheckListBoxApp)
457814b5
JS
150
151// init our app: create windows
152bool CheckListBoxApp::OnInit(void)
153{
bbdbfb0e
VZ
154 CheckListBoxFrame *pFrame = new CheckListBoxFrame
155 (
156 NULL,
1914bb8e 157 _T("wxWidgets Checklistbox Sample")
bbdbfb0e
VZ
158 );
159 SetTopWindow(pFrame);
160
8ad18dc3 161 return true;
457814b5
JS
162}
163
164// main frame constructor
bbdbfb0e 165CheckListBoxFrame::CheckListBoxFrame(wxFrame *frame,
1914bb8e
WS
166 const wxChar *title)
167 : wxFrame(frame, wxID_ANY, title)
457814b5 168{
8520f137 169#if wxUSE_STATUSBAR
bbdbfb0e
VZ
170 // create the status line
171 const int widths[] = { -1, 60 };
172 CreateStatusBar(2);
173 SetStatusWidths(2, widths);
8520f137 174#endif // wxUSE_STATUSBAR
bbdbfb0e
VZ
175
176 // Make a menubar
df7d383f 177 // --------------
bbdbfb0e 178
df7d383f
VZ
179 // file submenu
180 wxMenu *menuFile = new wxMenu;
181 menuFile->Append(Menu_About, _T("&About...\tF1"));
182 menuFile->AppendSeparator();
183 menuFile->Append(Menu_Quit, _T("E&xit\tAlt-X"));
bbdbfb0e 184
df7d383f
VZ
185 // listbox submenu
186 wxMenu *menuList = new wxMenu;
3dabb1e5
VZ
187 menuList->Append(Menu_CheckFirst, _T("Check the first item\tCtrl-C"));
188 menuList->Append(Menu_UncheckFirst, _T("Uncheck the first item\tCtrl-U"));
189 menuList->Append(Menu_ToggleFirst, _T("Toggle the first item\tCtrl-T"));
190 menuList->AppendSeparator();
4a46cbe8
RR
191 menuList->Append(Menu_InsertItemsStart, _T("Insert some item at the beginning"));
192 menuList->Append(Menu_InsertItemsMiddle, _T("Insert some item at the middle"));
193 menuList->Append(Menu_InsertItemsEnd, _T("Insert some item at the end"));
194 menuList->Append(Menu_AppendItems, _T("Append some items\tCtrl-A"));
195 menuList->Append(Menu_RemoveItems, _T("Remove some items"));
d553ceb2 196 menuList->AppendSeparator();
df7d383f 197 menuList->AppendCheckItem(Menu_Selection, _T("Multiple selection\tCtrl-M"));
4a46cbe8
RR
198 menuList->AppendCheckItem(Menu_Extended, _T("Extended selection"));
199 menuList->AppendCheckItem(Menu_Sorting, _T("Sorting"));
200 menuList->AppendSeparator();
4a46cbe8
RR
201 menuList->Append(Menu_GetBestSize, _T("Get the best size of the checklistbox control"));
202 menuList->AppendSeparator();
203 menuList->Append(Menu_MakeItemFirst, _T("Make selected item the first item"));
204
df7d383f
VZ
205
206 // put it all together
bbdbfb0e 207 wxMenuBar *menu_bar = new wxMenuBar;
df7d383f
VZ
208 menu_bar->Append(menuFile, _T("&File"));
209 menu_bar->Append(menuList, _T("&List"));
bbdbfb0e
VZ
210 SetMenuBar(menu_bar);
211
212 // make a panel with some controls
1914bb8e 213 m_panel = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
df7d383f
VZ
214
215 CreateCheckListbox();
216
217 // create buttons for moving the items around
1914bb8e
WS
218 wxButton *button1 = new wxButton(m_panel, Btn_Up);
219 wxButton *button2 = new wxButton(m_panel, Btn_Down);
df7d383f
VZ
220
221
222 wxBoxSizer *mainsizer = new wxBoxSizer( wxVERTICAL );
223
224 mainsizer->Add( m_pListBox, 1, wxGROW|wxALL, 10 );
bbdbfb0e 225
df7d383f
VZ
226 wxBoxSizer *bottomsizer = new wxBoxSizer( wxHORIZONTAL );
227
228 bottomsizer->Add( button1, 0, wxALL, 10 );
229 bottomsizer->Add( button2, 0, wxALL, 10 );
230
231 mainsizer->Add( bottomsizer, 0, wxCENTER );
232
233 // tell frame to make use of sizer (or constraints, if any)
8ad18dc3 234 m_panel->SetAutoLayout( true );
df7d383f
VZ
235 m_panel->SetSizer( mainsizer );
236
1914bb8e 237#ifndef __WXWINCE__
df7d383f
VZ
238 // don't allow frame to get smaller than what the sizers tell ye
239 mainsizer->SetSizeHints( this );
1914bb8e 240#endif
df7d383f 241
8ad18dc3 242 Show(true);
df7d383f
VZ
243}
244
245void CheckListBoxFrame::CreateCheckListbox(long flags)
246{
bbdbfb0e 247 // check list box
df7d383f 248 static const wxChar *aszChoices[] =
bbdbfb0e 249 {
df7d383f
VZ
250 _T("Zeroth"),
251 _T("First"), _T("Second"), _T("Third"),
252 _T("Fourth"), _T("Fifth"), _T("Sixth"),
253 _T("Seventh"), _T("Eighth"), _T("Nineth")
bbdbfb0e
VZ
254 };
255
256 wxString *astrChoices = new wxString[WXSIZEOF(aszChoices)];
257 unsigned int ui;
258 for ( ui = 0; ui < WXSIZEOF(aszChoices); ui++ )
259 astrChoices[ui] = aszChoices[ui];
260
261 m_pListBox = new wxCheckListBox
262 (
df7d383f 263 m_panel, // parent
bbdbfb0e
VZ
264 Control_Listbox, // control id
265 wxPoint(10, 10), // listbox poistion
8e1d4f96 266 wxSize(400, 100), // listbox size
bbdbfb0e 267 WXSIZEOF(aszChoices), // number of strings
df7d383f
VZ
268 astrChoices, // array of strings
269 flags
bbdbfb0e
VZ
270 );
271
bbdbfb0e
VZ
272 delete [] astrChoices;
273
bbdbfb0e
VZ
274 // set grey background for every second entry
275 for ( ui = 0; ui < WXSIZEOF(aszChoices); ui += 2 ) {
f048e32f 276 AdjustColour(ui);
bbdbfb0e 277 }
457814b5 278
bbdbfb0e 279 m_pListBox->Check(2);
df7d383f 280 m_pListBox->Select(3);
457814b5
JS
281}
282
4f22cf8d 283void CheckListBoxFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
457814b5 284{
8ad18dc3 285 Close(true);
457814b5
JS
286}
287
4f22cf8d 288void CheckListBoxFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
457814b5 289{
749bfe9a 290 wxMessageBox(wxT("Demo of wxCheckListBox control\n(c) Vadim Zeitlin 1998-2002"),
e680a378 291 wxT("About wxCheckListBox"),
bbdbfb0e 292 wxICON_INFORMATION, this);
457814b5
JS
293}
294
87728739 295void CheckListBoxFrame::OnCheckFirstItem(wxCommandEvent& WXUNUSED(event))
3dabb1e5
VZ
296{
297 if ( !m_pListBox->IsEmpty() )
298 m_pListBox->Check(0);
299}
300
87728739 301void CheckListBoxFrame::OnUncheckFirstItem(wxCommandEvent& WXUNUSED(event))
3dabb1e5
VZ
302{
303 if ( !m_pListBox->IsEmpty() )
8ad18dc3 304 m_pListBox->Check(0, false);
3dabb1e5
VZ
305}
306
87728739 307void CheckListBoxFrame::OnToggleFirstItem(wxCommandEvent& WXUNUSED(event))
3dabb1e5
VZ
308{
309 if ( !m_pListBox->IsEmpty() )
310 m_pListBox->Check(0, !m_pListBox->IsChecked(0));
311}
312
4a46cbe8 313void CheckListBoxFrame::OnInsertItemsStart(wxCommandEvent& WXUNUSED(event))
d553ceb2
VZ
314{
315 static size_t s_nItem = 0;
316 wxArrayString items;
317 items.Add(wxString::Format(_T("New item %lu"), (unsigned long)++s_nItem));
318 items.Add(wxString::Format(_T("New item %lu"), (unsigned long)++s_nItem));
319 items.Add(wxString::Format(_T("New item %lu"), (unsigned long)++s_nItem));
320
321 m_pListBox->InsertItems(items, 0);//m_pListBox->GetCount());
322}
323
4a46cbe8
RR
324void CheckListBoxFrame::OnInsertItemsMiddle(wxCommandEvent& WXUNUSED(event))
325{
326 static size_t s_nItem = 0;
327 wxArrayString items;
328 items.Add(wxString::Format(_T("New item %lu"), (unsigned long)++s_nItem));
329 items.Add(wxString::Format(_T("New item %lu"), (unsigned long)++s_nItem));
330 items.Add(wxString::Format(_T("New item %lu"), (unsigned long)++s_nItem));
331
332 m_pListBox->InsertItems(items, m_pListBox->GetCount() ? 1 : 0);
333}
334
335void CheckListBoxFrame::OnInsertItemsEnd(wxCommandEvent& WXUNUSED(event))
336{
337 static size_t s_nItem = 0;
338 wxArrayString items;
339 items.Add(wxString::Format(_T("New item %lu"), (unsigned long)++s_nItem));
340 items.Add(wxString::Format(_T("New item %lu"), (unsigned long)++s_nItem));
341 items.Add(wxString::Format(_T("New item %lu"), (unsigned long)++s_nItem));
342
343 m_pListBox->InsertItems(items, m_pListBox->GetCount() );
344}
345
346void CheckListBoxFrame::OnAppendItems(wxCommandEvent& WXUNUSED(event))
347{
348 static size_t s_nItem = 0;
349 m_pListBox->Append(wxString::Format(_T("New item %lu"), (unsigned long)++s_nItem));
350 m_pListBox->Append(wxString::Format(_T("New item %lu"), (unsigned long)++s_nItem));
351 m_pListBox->Append(wxString::Format(_T("New item %lu"), (unsigned long)++s_nItem));
352}
353
354void CheckListBoxFrame::OnRemoveItems(wxCommandEvent& WXUNUSED(event))
355{
356 if(m_pListBox->GetCount())
357 m_pListBox->Delete(0);
358 if(m_pListBox->GetCount())
359 m_pListBox->Delete(0);
360 if(m_pListBox->GetCount())
361 m_pListBox->Delete(0);
362}
363
4a46cbe8
RR
364void CheckListBoxFrame::OnGetBestSize(wxCommandEvent& WXUNUSED(event))
365{
366 wxSize bestSize = m_pListBox->GetBestSize();
367
368 wxMessageBox(wxString::Format(wxT("Best size of the checklistbox is:[%i,%i]"),
369 bestSize.x, bestSize.y
370 )
371 );
372}
373
374void CheckListBoxFrame::OnMakeItemFirst(wxCommandEvent& WXUNUSED(event))
375{
376 if(m_pListBox->GetSelection() != -1)
377 m_pListBox->SetFirstItem(m_pListBox->GetSelection());
378 else
379 wxMessageBox(wxT("Nothing selected!"));
380}
381
df7d383f
VZ
382void CheckListBoxFrame::OnToggleSelection(wxCommandEvent& event)
383{
384 wxSizer *sizer = m_panel->GetSizer();
385
12a3f227 386 sizer->Detach( m_pListBox );
df7d383f
VZ
387 delete m_pListBox;
388
389 CreateCheckListbox(event.IsChecked() ? wxLB_EXTENDED : 0);
390
391 sizer->Insert(0, m_pListBox, 1, wxGROW | wxALL, 10);
392
393 m_panel->Layout();
394}
395
4a46cbe8
RR
396void CheckListBoxFrame::OnToggleExtended(wxCommandEvent& event)
397{
398 wxSizer *sizer = m_panel->GetSizer();
399
400 sizer->Detach( m_pListBox );
401 delete m_pListBox;
402
403 CreateCheckListbox(event.IsChecked() ? wxLB_EXTENDED : 0);
404
405 sizer->Insert(0, m_pListBox, 1, wxGROW | wxALL, 10);
406
c1dcb1a0 407 m_panel->Layout();
4a46cbe8
RR
408}
409
410void CheckListBoxFrame::OnToggleSorting(wxCommandEvent& event)
411{
412 wxSizer *sizer = m_panel->GetSizer();
413
414 sizer->Detach( m_pListBox );
415 delete m_pListBox;
416
417 CreateCheckListbox(event.IsChecked() ? wxLB_SORT : 0);
418
419 sizer->Insert(0, m_pListBox, 1, wxGROW | wxALL, 10);
420
c1dcb1a0 421 m_panel->Layout();
4a46cbe8
RR
422}
423
457814b5
JS
424void CheckListBoxFrame::OnListboxSelect(wxCommandEvent& event)
425{
bbdbfb0e 426 int nSel = event.GetSelection();
e680a378 427 wxLogStatus(this, wxT("Item %d selected (%schecked)"), nSel,
8ad18dc3 428 m_pListBox->IsChecked(nSel) ? wxT("") : wxT("not "));
457814b5
JS
429}
430
4f22cf8d 431void CheckListBoxFrame::OnListboxDblClick(wxCommandEvent& WXUNUSED(event))
457814b5 432{
8ad18dc3
JS
433 int selection = -1;
434 if(m_pListBox->GetWindowStyle() & wxLB_EXTENDED)
435 {
436 wxArrayInt list;
437 m_pListBox->GetSelections(list);
438 if(list.Count()==1)
439 {
440 selection = list.Item(0);
441 }
442 }
443 else
444 {
445 selection = m_pListBox->GetSelection();
446 }
447
bbdbfb0e 448 wxString strSelection;
8ad18dc3
JS
449 if ( selection != -1 )
450 {
451 strSelection.Printf(wxT("Item %d double clicked"), selection);
452 }
453 else
454 {
455 strSelection = wxT("List double clicked in multiple selection mode");
456 }
e680a378 457 wxMessageDialog dialog(this, strSelection, wxT("wxCheckListBox message"), wxICON_INFORMATION);
bbdbfb0e 458 dialog.ShowModal();
457814b5
JS
459}
460
461void CheckListBoxFrame::OnCheckboxToggle(wxCommandEvent& event)
462{
bbdbfb0e 463 unsigned int nItem = event.GetInt();
655822f3 464
e680a378
RR
465 wxLogStatus(this, wxT("item %d was %schecked"), nItem,
466 m_pListBox->IsChecked(nItem) ? wxT("") : wxT("un"));
bbdbfb0e
VZ
467}
468
469void CheckListBoxFrame::OnButtonUp(wxCommandEvent& WXUNUSED(event))
470{
8ad18dc3 471 OnButtonMove(true);
bbdbfb0e
VZ
472}
473
474void CheckListBoxFrame::OnButtonDown(wxCommandEvent& WXUNUSED(event))
475{
8ad18dc3 476 OnButtonMove(false);
bbdbfb0e
VZ
477}
478
479void CheckListBoxFrame::OnButtonMove(bool up)
480{
8ad18dc3
JS
481 int selection = -1;
482 if(m_pListBox->GetWindowStyle() & wxLB_EXTENDED)
483 {
484 wxArrayInt list;
485 m_pListBox->GetSelections(list);
486 if(list.Count()==1)
487 {
488 selection = list.Item(0);
489 }
490 }
491 else
492 {
493 selection = m_pListBox->GetSelection();
494 }
1914bb8e 495 if ( selection != wxNOT_FOUND )
bbdbfb0e
VZ
496 {
497 wxString label = m_pListBox->GetString(selection);
498
499 int positionNew = up ? selection - 1 : selection + 2;
8228b893 500 if ( positionNew < 0 || positionNew > (int)m_pListBox->GetCount() )
bbdbfb0e 501 {
e680a378 502 wxLogStatus(this, wxT("Can't move this item %s"), up ? wxT("up") : wxT("down"));
bbdbfb0e
VZ
503 }
504 else
505 {
506 bool wasChecked = m_pListBox->IsChecked(selection);
507
508 int positionOld = up ? selection + 1 : selection;
509
510 // insert the item
511 m_pListBox->InsertItems(1, &label, positionNew);
512
513 // and delete the old one
514 m_pListBox->Delete(positionOld);
515
516 int selectionNew = up ? positionNew : positionNew - 1;
517 m_pListBox->Check(selectionNew, wasChecked);
518 m_pListBox->SetSelection(selectionNew);
1914bb8e 519 m_pListBox->SetFocus();
bbdbfb0e 520
f048e32f
VZ
521 AdjustColour(selection);
522 AdjustColour(selectionNew);
523
e680a378 524 wxLogStatus(this, wxT("Item moved %s"), up ? wxT("up") : wxT("down"));
bbdbfb0e
VZ
525 }
526 }
527 else
528 {
8ad18dc3 529 wxLogStatus(this, wxT("Please select single item"));
bbdbfb0e 530 }
655822f3 531}
f048e32f 532
8ad18dc3 533// not implemented in ports other than (native) MSW yet
1914bb8e 534#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) && !defined(__WXWINCE__)
f048e32f
VZ
535void CheckListBoxFrame::AdjustColour(size_t index)
536{
f048e32f
VZ
537 // even items have grey backround, odd ones - white
538 unsigned char c = index % 2 ? 255 : 200;
539 m_pListBox->GetItem(index)->SetBackgroundColour(wxColor(c, c, c));
f048e32f 540}
8ad18dc3
JS
541#else
542void CheckListBoxFrame::AdjustColour(size_t WXUNUSED(index))
543{
544}
545#endif // wxMSW