+ if ( !m_pListBox->IsEmpty() )
+ m_pListBox->Check(0, !m_pListBox->IsChecked(0));
+}
+
+void CheckListBoxFrame::OnInsertItemsStart(wxCommandEvent& WXUNUSED(event))
+{
+ static size_t s_nItem = 0;
+ wxArrayString items;
+ items.Add(wxString::Format(_T("New item %lu"), (unsigned long)++s_nItem));
+ items.Add(wxString::Format(_T("New item %lu"), (unsigned long)++s_nItem));
+ items.Add(wxString::Format(_T("New item %lu"), (unsigned long)++s_nItem));
+
+ m_pListBox->InsertItems(items, 0);//m_pListBox->GetCount());
+}
+
+void CheckListBoxFrame::OnInsertItemsMiddle(wxCommandEvent& WXUNUSED(event))
+{
+ static size_t s_nItem = 0;
+ wxArrayString items;
+ items.Add(wxString::Format(_T("New item %lu"), (unsigned long)++s_nItem));
+ items.Add(wxString::Format(_T("New item %lu"), (unsigned long)++s_nItem));
+ items.Add(wxString::Format(_T("New item %lu"), (unsigned long)++s_nItem));
+
+ m_pListBox->InsertItems(items, m_pListBox->GetCount() ? 1 : 0);
+}
+
+void CheckListBoxFrame::OnInsertItemsEnd(wxCommandEvent& WXUNUSED(event))
+{
+ static size_t s_nItem = 0;
+ wxArrayString items;
+ items.Add(wxString::Format(_T("New item %lu"), (unsigned long)++s_nItem));
+ items.Add(wxString::Format(_T("New item %lu"), (unsigned long)++s_nItem));
+ items.Add(wxString::Format(_T("New item %lu"), (unsigned long)++s_nItem));
+
+ m_pListBox->InsertItems(items, m_pListBox->GetCount() );
+}
+
+void CheckListBoxFrame::OnAppendItems(wxCommandEvent& WXUNUSED(event))
+{
+ static size_t s_nItem = 0;
+ m_pListBox->Append(wxString::Format(_T("New item %lu"), (unsigned long)++s_nItem));
+ m_pListBox->Append(wxString::Format(_T("New item %lu"), (unsigned long)++s_nItem));
+ m_pListBox->Append(wxString::Format(_T("New item %lu"), (unsigned long)++s_nItem));
+}
+
+void CheckListBoxFrame::OnRemoveItems(wxCommandEvent& WXUNUSED(event))
+{
+ if(m_pListBox->GetCount())
+ m_pListBox->Delete(0);
+ if(m_pListBox->GetCount())
+ m_pListBox->Delete(0);
+ if(m_pListBox->GetCount())
+ m_pListBox->Delete(0);
+}
+
+void CheckListBoxFrame::OnGetBestSize(wxCommandEvent& WXUNUSED(event))
+{
+ wxSize bestSize = m_pListBox->GetBestSize();
+
+ wxMessageBox(wxString::Format(wxT("Best size of the checklistbox is:[%i,%i]"),
+ bestSize.x, bestSize.y
+ )
+ );
+}
+
+void CheckListBoxFrame::OnMakeItemFirst(wxCommandEvent& WXUNUSED(event))
+{
+ if(m_pListBox->GetSelection() != -1)
+ m_pListBox->SetFirstItem(m_pListBox->GetSelection());
+ else
+ wxMessageBox(wxT("Nothing selected!"));
+}
+
+void CheckListBoxFrame::OnToggleSelection(wxCommandEvent& event)
+{
+ wxSizer *sizer = m_panel->GetSizer();
+
+ sizer->Detach( m_pListBox );
+ delete m_pListBox;
+
+ CreateCheckListbox(event.IsChecked() ? wxLB_EXTENDED : 0);
+
+ sizer->Insert(0, m_pListBox, 1, wxGROW | wxALL, 10);
+
+ m_panel->Layout();
+}
+
+void CheckListBoxFrame::OnToggleExtended(wxCommandEvent& event)
+{
+ wxSizer *sizer = m_panel->GetSizer();
+
+ sizer->Detach( m_pListBox );
+ delete m_pListBox;
+
+ CreateCheckListbox(event.IsChecked() ? wxLB_EXTENDED : 0);
+
+ sizer->Insert(0, m_pListBox, 1, wxGROW | wxALL, 10);
+
+ m_panel->Layout();
+}
+
+void CheckListBoxFrame::OnToggleSorting(wxCommandEvent& event)
+{
+ wxSizer *sizer = m_panel->GetSizer();
+
+ sizer->Detach( m_pListBox );
+ delete m_pListBox;
+
+ CreateCheckListbox(event.IsChecked() ? wxLB_SORT : 0);
+
+ sizer->Insert(0, m_pListBox, 1, wxGROW | wxALL, 10);
+
+ m_panel->Layout();