From 75c74ca055aedd9e6f6a8876c940080903f1632c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 29 Dec 1999 10:29:26 +0000 Subject: [PATCH 1/1] 1. added test for wxTreeCtrl::Insert(size_t index) 2. temporary test code for wxCalendarCtrl in controls.cpp git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5136 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/controls/controls.cpp | 8 +++++++- samples/treectrl/treetest.cpp | 11 +++++++++-- samples/treectrl/treetest.h | 4 +++- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/samples/controls/controls.cpp b/samples/controls/controls.cpp index 7dab094d53..a29183cd19 100644 --- a/samples/controls/controls.cpp +++ b/samples/controls/controls.cpp @@ -65,6 +65,8 @@ #include "wx/spinctrl.h" #endif // wxUSE_SPINCTRL +#include "wx/generic/calctrl.h" + //---------------------------------------------------------------------- // class definitions //---------------------------------------------------------------------- @@ -258,7 +260,7 @@ bool MyApp::OnInit() frame->Show(TRUE); frame->SetCursor(wxCursor(wxCURSOR_HAND)); - //frame->GetPanel()->m_notebook->SetSelection(3); + frame->GetPanel()->m_notebook->SetSelection(5); SetTopWindow(frame); @@ -641,6 +643,10 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) m_notebook->AddPage(panel, "wxBitmapXXX"); + panel = new wxPanel(m_notebook); + (void)new wxCalendarCtrl(panel, -1); + m_notebook->AddPage(panel, "wxCalendar"); + // --------------- TEST CODE ---------------------- // layout constraints diff --git a/samples/treectrl/treetest.cpp b/samples/treectrl/treetest.cpp index 4da9681fc0..a29db54296 100644 --- a/samples/treectrl/treetest.cpp +++ b/samples/treectrl/treetest.cpp @@ -85,6 +85,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_MENU(TreeTest_CollapseAndReset, MyFrame::OnCollapseAndReset) EVT_MENU(TreeTest_EnsureVisible, MyFrame::OnEnsureVisible) EVT_MENU(TreeTest_AddItem, MyFrame::OnAddItem) + EVT_MENU(TreeTest_InsertItem, MyFrame::OnInsertItem) EVT_MENU(TreeTest_IncIndent, MyFrame::OnIncIndent) EVT_MENU(TreeTest_DecIndent, MyFrame::OnDecIndent) EVT_MENU(TreeTest_IncSpacing, MyFrame::OnIncSpacing) @@ -153,6 +154,7 @@ MyFrame::MyFrame(const wxString& title, int x, int y, int w, int h) tree_menu->Append(TreeTest_CollapseAndReset, "C&ollapse and reset"); tree_menu->AppendSeparator(); tree_menu->Append(TreeTest_AddItem, "Append a &new item"); + tree_menu->Append(TreeTest_InsertItem, "&Insert a new item"); tree_menu->Append(TreeTest_Delete, "&Delete this item"); tree_menu->Append(TreeTest_DeleteChildren, "Delete &children"); tree_menu->Append(TreeTest_DeleteAll, "Delete &all items"); @@ -284,7 +286,7 @@ void MyFrame::OnCount(wxCommandEvent& WXUNUSED(event)) CHECK_ITEM( item ); int i = m_treeCtrl->GetChildrenCount( item, FALSE ); - + wxLogMessage(wxT("%d children"), i); } @@ -295,7 +297,7 @@ void MyFrame::OnCountRec(wxCommandEvent& WXUNUSED(event)) CHECK_ITEM( item ); int i = m_treeCtrl->GetChildrenCount( item ); - + wxLogMessage(wxT("%d children"), i); } @@ -392,6 +394,11 @@ void MyFrame::OnEnsureVisible(wxCommandEvent& event) m_treeCtrl->DoEnsureVisible(); } +void MyFrame::OnInsertItem(wxCommandEvent& WXUNUSED(event)) +{ + m_treeCtrl->InsertItem(m_treeCtrl->GetRootItem(), 1, "2nd item"); +} + void MyFrame::OnAddItem(wxCommandEvent& WXUNUSED(event)) { static int s_num = 0; diff --git a/samples/treectrl/treetest.h b/samples/treectrl/treetest.h index dc193c2954..0c0cd57395 100644 --- a/samples/treectrl/treetest.h +++ b/samples/treectrl/treetest.h @@ -132,12 +132,13 @@ public: void OnCount(wxCommandEvent& event); void OnCountRec(wxCommandEvent& event); - + void OnRename(wxCommandEvent& event); void OnSort(wxCommandEvent& event) { DoSort(); } void OnSortRev(wxCommandEvent& event) { DoSort(TRUE); } void OnAddItem(wxCommandEvent& event); + void OnInsertItem(wxCommandEvent& event); void OnIncIndent(wxCommandEvent& event); void OnDecIndent(wxCommandEvent& event); @@ -178,6 +179,7 @@ enum TreeTest_CollapseAndReset, TreeTest_EnsureVisible, TreeTest_AddItem, + TreeTest_InsertItem, TreeTest_IncIndent, TreeTest_DecIndent, TreeTest_IncSpacing, -- 2.45.2