Test wxTreeListCtrl::DeleteAllItems() in the sample

Add a menu command to invoke this method for testing.
This commit is contained in:
Robin Dunn 2018-01-24 17:59:25 +01:00 committed by Vadim Zeitlin
parent 9b51ef82af
commit 3b22d9a56b

View File

@ -65,6 +65,8 @@ enum
Id_CheckboxesUser3State,
Id_Checkboxes_End,
Id_DeleteAllItems,
Id_DumpSelection,
Id_Check_HTMLDocs,
Id_Uncheck_HTMLDocs,
@ -187,6 +189,8 @@ private:
void OnAbout(wxCommandEvent& event);
void OnExit(wxCommandEvent& event);
void OnDeleteAllItems(wxCommandEvent& event);
void OnSelectionChanged(wxTreeListEvent& event);
void OnItemExpanding(wxTreeListEvent& event);
void OnItemExpanded(wxTreeListEvent& event);
@ -272,6 +276,8 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(wxID_ABOUT, MyFrame::OnAbout)
EVT_MENU(wxID_EXIT, MyFrame::OnExit)
EVT_MENU(Id_DeleteAllItems, MyFrame::OnDeleteAllItems)
EVT_TREELIST_SELECTION_CHANGED(wxID_ANY, MyFrame::OnSelectionChanged)
EVT_TREELIST_ITEM_EXPANDING(wxID_ANY, MyFrame::OnItemExpanding)
EVT_TREELIST_ITEM_EXPANDED(wxID_ANY, MyFrame::OnItemExpanded)
@ -314,6 +320,8 @@ MyFrame::MyFrame()
treeOper->Append(Id_Indet_HTMLDocs, "Make Doc/HTML &indeterminate\tCtrl-I");
treeOper->Append(Id_Select_HTMLDocs, "&Select Doc/HTML item\tCtrl-S");
treeOper->Append(Id_DeleteAllItems, "DeleteAllItems");
wxMenu* helpMenu = new wxMenu;
helpMenu->Append(wxID_ABOUT);
@ -577,6 +585,11 @@ void MyFrame::OnExit(wxCommandEvent& WXUNUSED(event))
Close(true);
}
void MyFrame::OnDeleteAllItems(wxCommandEvent& WXUNUSED(event))
{
m_treelist->DeleteAllItems();
}
wxString MyFrame::DumpItem(wxTreeListItem item) const
{
return item.IsOk() ? m_treelist->GetItemText(item) : wxString("NONE");