]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/listctrl/listtest.cpp
New configure
[wxWidgets.git] / samples / listctrl / listtest.cpp
index b6a9885b5b2c20eb1f078e9efcaa052a6c435b95..6e4b55f5eef2540f9cbff34baab66230ce8fedd4 100644 (file)
@@ -37,6 +37,8 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
        EVT_MENU(LIST_ICON_TEXT_VIEW, MyFrame::OnIconTextView)
        EVT_MENU(LIST_SMALL_ICON_VIEW, MyFrame::OnSmallIconView)
        EVT_MENU(LIST_SMALL_ICON_TEXT_VIEW, MyFrame::OnSmallIconTextView)
+       EVT_MENU(LIST_DESELECT_ALL, MyFrame::OnDeselectAll)
+       EVT_MENU(LIST_SELECT_ALL, MyFrame::OnSelectAll)
 END_EVENT_TABLE()
 
 BEGIN_EVENT_TABLE(MyListCtrl, wxListCtrl)
@@ -125,6 +127,8 @@ bool MyApp::OnInit(void)
   file_menu->Append(LIST_ICON_TEXT_VIEW,       "Icon view with &text");
   file_menu->Append(LIST_SMALL_ICON_VIEW,      "&Small icon view");
   file_menu->Append(LIST_SMALL_ICON_TEXT_VIEW,         "Small icon &view with text");
+  file_menu->Append(LIST_DESELECT_ALL, "&Deselect All");
+  file_menu->Append(LIST_SELECT_ALL, "S&elect All");
   file_menu->AppendSeparator();
   file_menu->Append(LIST_ABOUT, "&About");
   file_menu->Append(LIST_QUIT, "E&xit");
@@ -198,6 +202,22 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
   dialog.ShowModal();
 }
 
+void MyFrame::OnDeselectAll(wxCommandEvent& WXUNUSED(event))
+{
+   int n = m_listCtrl->GetItemCount();
+   int i;
+   for(i = 0; i < n; i++)
+      m_listCtrl->SetItemState(i,0,wxLIST_STATE_SELECTED);
+}
+
+void MyFrame::OnSelectAll(wxCommandEvent& WXUNUSED(event))
+{
+   int n = m_listCtrl->GetItemCount();
+   int i;
+   for(i = 0; i < n; i++)
+      m_listCtrl->SetItemState(i,wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
+}
+
 void MyFrame::OnListView(wxCommandEvent& WXUNUSED(event))
 {
        m_logWindow->Clear();