]> git.saurik.com Git - wxWidgets.git/commitdiff
added test for selection events
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 13 Mar 2000 17:20:39 +0000 (17:20 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 13 Mar 2000 17:20:39 +0000 (17:20 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6658 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/listctrl/listtest.cpp
samples/listctrl/listtest.h

index c90a74ae76654296bde2baaa3d883b942cbff51a..229cad4224a366a4bf935223e0865d309b94e384 100644 (file)
@@ -57,6 +57,7 @@ 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_TOGGLE_FIRST, MyFrame::OnToggleFirstSel)
     EVT_MENU(LIST_DESELECT_ALL, MyFrame::OnDeselectAll)
     EVT_MENU(LIST_SELECT_ALL, MyFrame::OnSelectAll)
     EVT_MENU(LIST_DELETE_ALL, MyFrame::OnDeleteAll)
@@ -165,6 +166,7 @@ MyFrame::MyFrame(const wxChar *title, int x, int y, int w, int h)
     menuView->Append(LIST_SMALL_ICON_TEXT_VIEW,     "Small icon &view with text\tF6");
 
     wxMenu *menuList = new wxMenu;
+    menuList->Append(LIST_TOGGLE_FIRST, "&Toggle first item\tCtrl-T");
     menuList->Append(LIST_DESELECT_ALL, "&Deselect All\tCtrl-D");
     menuList->Append(LIST_SELECT_ALL, "S&elect All\tCtrl-A");
     menuList->AppendSeparator();
@@ -258,6 +260,11 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
     dialog.ShowModal();
 }
 
+void MyFrame::OnToggleFirstSel(wxCommandEvent& WXUNUSED(event))
+{
+    m_listCtrl->SetItemState(0, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
+}
+
 void MyFrame::OnDeselectAll(wxCommandEvent& WXUNUSED(event))
 {
     int n = m_listCtrl->GetItemCount();
index c1bf2d02b597f5a7a736867d571037ca5ba88878..a79c15066c453dea57051cd5cfb2ad02458466c6 100644 (file)
@@ -66,6 +66,7 @@ public:
     void OnIconTextView(wxCommandEvent& event);
     void OnSmallIconView(wxCommandEvent& event);
     void OnSmallIconTextView(wxCommandEvent& event);
+    void OnToggleFirstSel(wxCommandEvent& event);
     void OnDeselectAll(wxCommandEvent& event);
     void OnSelectAll(wxCommandEvent& event);
     void OnDeleteAll(wxCommandEvent& event);
@@ -107,6 +108,7 @@ enum
     LIST_SET_FG_COL,
     LIST_SET_BG_COL,
     LIST_TOGGLE_MULTI_SEL,
+    LIST_TOGGLE_FIRST,
 
     LIST_CTRL                   = 1000
 };