added test for selection events

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6658 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2000-03-13 17:20:39 +00:00
parent c6e7d14fa9
commit 58b3bdc933
2 changed files with 9 additions and 0 deletions

View File

@@ -57,6 +57,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(LIST_ICON_TEXT_VIEW, MyFrame::OnIconTextView) EVT_MENU(LIST_ICON_TEXT_VIEW, MyFrame::OnIconTextView)
EVT_MENU(LIST_SMALL_ICON_VIEW, MyFrame::OnSmallIconView) EVT_MENU(LIST_SMALL_ICON_VIEW, MyFrame::OnSmallIconView)
EVT_MENU(LIST_SMALL_ICON_TEXT_VIEW, MyFrame::OnSmallIconTextView) 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_DESELECT_ALL, MyFrame::OnDeselectAll)
EVT_MENU(LIST_SELECT_ALL, MyFrame::OnSelectAll) EVT_MENU(LIST_SELECT_ALL, MyFrame::OnSelectAll)
EVT_MENU(LIST_DELETE_ALL, MyFrame::OnDeleteAll) 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"); menuView->Append(LIST_SMALL_ICON_TEXT_VIEW, "Small icon &view with text\tF6");
wxMenu *menuList = new wxMenu; 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_DESELECT_ALL, "&Deselect All\tCtrl-D");
menuList->Append(LIST_SELECT_ALL, "S&elect All\tCtrl-A"); menuList->Append(LIST_SELECT_ALL, "S&elect All\tCtrl-A");
menuList->AppendSeparator(); menuList->AppendSeparator();
@@ -258,6 +260,11 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
dialog.ShowModal(); dialog.ShowModal();
} }
void MyFrame::OnToggleFirstSel(wxCommandEvent& WXUNUSED(event))
{
m_listCtrl->SetItemState(0, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
}
void MyFrame::OnDeselectAll(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnDeselectAll(wxCommandEvent& WXUNUSED(event))
{ {
int n = m_listCtrl->GetItemCount(); int n = m_listCtrl->GetItemCount();

View File

@@ -66,6 +66,7 @@ public:
void OnIconTextView(wxCommandEvent& event); void OnIconTextView(wxCommandEvent& event);
void OnSmallIconView(wxCommandEvent& event); void OnSmallIconView(wxCommandEvent& event);
void OnSmallIconTextView(wxCommandEvent& event); void OnSmallIconTextView(wxCommandEvent& event);
void OnToggleFirstSel(wxCommandEvent& event);
void OnDeselectAll(wxCommandEvent& event); void OnDeselectAll(wxCommandEvent& event);
void OnSelectAll(wxCommandEvent& event); void OnSelectAll(wxCommandEvent& event);
void OnDeleteAll(wxCommandEvent& event); void OnDeleteAll(wxCommandEvent& event);
@@ -107,6 +108,7 @@ enum
LIST_SET_FG_COL, LIST_SET_FG_COL,
LIST_SET_BG_COL, LIST_SET_BG_COL,
LIST_TOGGLE_MULTI_SEL, LIST_TOGGLE_MULTI_SEL,
LIST_TOGGLE_FIRST,
LIST_CTRL = 1000 LIST_CTRL = 1000
}; };