Added test for wxTreeCtrl::GetChildrenCount()
Fixed Reparent (added heaps of debug code for this) Small mods to glcanvas git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3799 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -133,7 +133,7 @@ bool MyApp::InitToolbar(wxToolBar* toolBar)
|
||||
toolBar->AddTool(wxID_PASTE, *(toolBarBitmaps[5]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Paste");
|
||||
currentX += width + 5;
|
||||
toolBar->AddSeparator();
|
||||
toolBar->AddTool(wxID_PRINT, *(toolBarBitmaps[6]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Print");
|
||||
toolBar->AddTool(wxID_PRINT, *(toolBarBitmaps[6]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Reparent the button");
|
||||
currentX += width + 5;
|
||||
toolBar->AddSeparator();
|
||||
toolBar->AddTool(wxID_HELP, *(toolBarBitmaps[7]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Help");
|
||||
@@ -155,6 +155,7 @@ bool MyApp::InitToolbar(wxToolBar* toolBar)
|
||||
BEGIN_EVENT_TABLE(MyMiniFrame, wxMiniFrame)
|
||||
EVT_CLOSE ( MyMiniFrame::OnCloseWindow)
|
||||
EVT_BUTTON (ID_REPARENT, MyMiniFrame::OnReparent)
|
||||
EVT_MENU (wxID_PRINT, MyMiniFrame::OnReparent)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
MyMiniFrame::MyMiniFrame(wxFrame* parent, wxWindowID id, const wxString& title, const wxPoint& pos,
|
||||
@@ -180,6 +181,7 @@ void MyMiniFrame::OnReparent(wxCommandEvent& WXUNUSED(event))
|
||||
BEGIN_EVENT_TABLE(MyMainFrame, wxFrame)
|
||||
EVT_CLOSE ( MyMainFrame::OnCloseWindow)
|
||||
EVT_BUTTON (ID_REPARENT, MyMainFrame::OnReparent)
|
||||
EVT_MENU (wxID_PRINT, MyMainFrame::OnReparent)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
MyMainFrame::MyMainFrame(wxFrame* parent, wxWindowID id, const wxString& title, const wxPoint& pos,
|
||||
|
@@ -72,6 +72,8 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
EVT_MENU(TreeTest_Unselect, MyFrame::OnUnselect)
|
||||
#endif // NO_MULTIPLE_SELECTION
|
||||
EVT_MENU(TreeTest_Rename, MyFrame::OnRename)
|
||||
EVT_MENU(TreeTest_Count, MyFrame::OnCount)
|
||||
EVT_MENU(TreeTest_CountRec, MyFrame::OnCountRec)
|
||||
EVT_MENU(TreeTest_Sort, MyFrame::OnSort)
|
||||
EVT_MENU(TreeTest_SortRev, MyFrame::OnSortRev)
|
||||
EVT_MENU(TreeTest_Bold, MyFrame::OnSetBold)
|
||||
@@ -155,6 +157,9 @@ MyFrame::MyFrame(const wxString& title, int x, int y, int w, int h)
|
||||
tree_menu->Append(TreeTest_DeleteChildren, "Delete &children");
|
||||
tree_menu->Append(TreeTest_DeleteAll, "Delete &all items");
|
||||
tree_menu->AppendSeparator();
|
||||
tree_menu->Append(TreeTest_Count, "Count children of current item");
|
||||
tree_menu->Append(TreeTest_CountRec, "Recursively count children of current item");
|
||||
tree_menu->AppendSeparator();
|
||||
tree_menu->Append(TreeTest_Sort, "Sort children of current item");
|
||||
tree_menu->Append(TreeTest_SortRev, "Sort in reversed order");
|
||||
tree_menu->AppendSeparator();
|
||||
@@ -272,6 +277,28 @@ void MyFrame::OnRename(wxCommandEvent& WXUNUSED(event))
|
||||
(void)m_treeCtrl->EditLabel(item);
|
||||
}
|
||||
|
||||
void MyFrame::OnCount(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxTreeItemId item = m_treeCtrl->GetSelection();
|
||||
|
||||
CHECK_ITEM( item );
|
||||
|
||||
int i = m_treeCtrl->GetChildrenCount( item, FALSE );
|
||||
|
||||
wxLogMessage(_T("%d children"), i);
|
||||
}
|
||||
|
||||
void MyFrame::OnCountRec(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxTreeItemId item = m_treeCtrl->GetSelection();
|
||||
|
||||
CHECK_ITEM( item );
|
||||
|
||||
int i = m_treeCtrl->GetChildrenCount( item );
|
||||
|
||||
wxLogMessage(_T("%d children"), i);
|
||||
}
|
||||
|
||||
void MyFrame::DoSort(bool reverse)
|
||||
{
|
||||
wxTreeItemId item = m_treeCtrl->GetSelection();
|
||||
|
@@ -130,6 +130,9 @@ public:
|
||||
|
||||
void OnEnsureVisible(wxCommandEvent& event);
|
||||
|
||||
void OnCount(wxCommandEvent& event);
|
||||
void OnCountRec(wxCommandEvent& event);
|
||||
|
||||
void OnRename(wxCommandEvent& event);
|
||||
void OnSort(wxCommandEvent& event) { DoSort(); }
|
||||
void OnSortRev(wxCommandEvent& event) { DoSort(TRUE); }
|
||||
@@ -161,6 +164,8 @@ enum
|
||||
TreeTest_About,
|
||||
TreeTest_Dump,
|
||||
TreeTest_DumpSelected,
|
||||
TreeTest_Count,
|
||||
TreeTest_CountRec,
|
||||
TreeTest_Sort,
|
||||
TreeTest_SortRev,
|
||||
TreeTest_Bold,
|
||||
|
Reference in New Issue
Block a user