From f87a111f9e03a4b8f772419052e638deb730402e Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 10 Apr 2007 23:48:51 +0000 Subject: [PATCH] added a menu command to clear log git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45391 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/treectrl/treetest.cpp | 17 ++++++++++++----- samples/treectrl/treetest.h | 2 ++ 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/samples/treectrl/treetest.cpp b/samples/treectrl/treetest.cpp index 73a7bb62f9..ff909cd97e 100644 --- a/samples/treectrl/treetest.cpp +++ b/samples/treectrl/treetest.cpp @@ -64,6 +64,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame) MENU_LINK(Quit) MENU_LINK(About) + MENU_LINK(ClearLog) MENU_LINK(TogButtons) MENU_LINK(TogTwist) @@ -193,6 +194,8 @@ MyFrame::MyFrame(const wxString& title, int x, int y, int w, int h) *tree_menu = new wxMenu, *item_menu = new wxMenu; + file_menu->Append(TreeTest_ClearLog, wxT("&Clear log\tCtrl-L")); + file_menu->AppendSeparator(); file_menu->Append(TreeTest_About, wxT("&About...")); file_menu->AppendSeparator(); file_menu->Append(TreeTest_Quit, wxT("E&xit\tAlt-X")); @@ -208,7 +211,7 @@ MyFrame::MyFrame(const wxString& title, int x, int y, int w, int h) style_menu->AppendCheckItem(TreeTest_TogFullHighlight, wxT("Toggle &full row highlight")); style_menu->AppendCheckItem(TreeTest_TogEdit, wxT("Toggle &edit mode")); #ifndef NO_MULTIPLE_SELECTION - style_menu->AppendCheckItem(TreeTest_ToggleSel, wxT("Toggle &selection mode")); + style_menu->AppendCheckItem(TreeTest_ToggleSel, wxT("Toggle &selection mode\tCtrl-S")); #endif // NO_MULTIPLE_SELECTION style_menu->AppendCheckItem(TreeTest_ToggleImages, wxT("Toggle show ima&ges")); style_menu->AppendCheckItem(TreeTest_ToggleAlternateImages, wxT("Toggle alternate images")); @@ -400,12 +403,11 @@ void MyFrame::Resize() { wxSize size = GetClientSize(); m_treeCtrl->SetSize(0, 0, size.x, size.y -#if !wxUSE_LOG - ); -#else +#if wxUSE_LOG *2/3); - m_textCtrl->SetSize(0, 2*size.y/3, size.x, size.y/3); + m_textCtrl->SetSize(0, 2*size.y/3, size.x, size.y/3 #endif + ); } void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) @@ -421,6 +423,11 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) wxOK | wxICON_INFORMATION, this); } +void MyFrame::OnClearLog(wxCommandEvent& WXUNUSED(event)) +{ + m_textCtrl->Clear(); +} + void MyFrame::OnRename(wxCommandEvent& WXUNUSED(event)) { wxTreeItemId item = m_treeCtrl->GetSelection(); diff --git a/samples/treectrl/treetest.h b/samples/treectrl/treetest.h index 14e26e6a13..5546561ad2 100644 --- a/samples/treectrl/treetest.h +++ b/samples/treectrl/treetest.h @@ -157,6 +157,7 @@ public: // menu callbacks void OnQuit(wxCommandEvent& event); void OnAbout(wxCommandEvent& event); + void OnClearLog(wxCommandEvent& event); void OnTogButtons(wxCommandEvent& event) { TogStyle(event.GetId(), wxTR_HAS_BUTTONS); } @@ -253,6 +254,7 @@ enum { TreeTest_Quit = wxID_EXIT, TreeTest_About = wxID_ABOUT, + TreeTest_ClearLog = wxID_CLEAR, TreeTest_TogButtons = wxID_HIGHEST, TreeTest_TogTwist, TreeTest_TogLines, -- 2.45.2