disable select root menu command when the root is hidden
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45135 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -330,6 +330,9 @@ void MyFrame::CreateTree(long style)
|
|||||||
m_treeCtrl = new MyTreeCtrl(m_panel, TreeTest_Ctrl,
|
m_treeCtrl = new MyTreeCtrl(m_panel, TreeTest_Ctrl,
|
||||||
wxDefaultPosition, wxDefaultSize,
|
wxDefaultPosition, wxDefaultSize,
|
||||||
style);
|
style);
|
||||||
|
|
||||||
|
GetMenuBar()->Enable(TreeTest_SelectRoot, !(style & wxTR_HIDE_ROOT));
|
||||||
|
|
||||||
Resize();
|
Resize();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -522,6 +525,7 @@ void MyFrame::OnSelect(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
void MyFrame::OnSelectRoot(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnSelectRoot(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
|
if ( !m_treeCtrl->HasFlag(wxTR_HIDE_ROOT) )
|
||||||
m_treeCtrl->SelectItem(m_treeCtrl->GetRootItem());
|
m_treeCtrl->SelectItem(m_treeCtrl->GetRootItem());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -865,7 +869,7 @@ void MyTreeCtrl::AddTestItemsToTree(size_t numChildren,
|
|||||||
wxTreeItemId rootId = AddRoot(wxT("Root"),
|
wxTreeItemId rootId = AddRoot(wxT("Root"),
|
||||||
image, image,
|
image, image,
|
||||||
new MyTreeItemData(wxT("Root item")));
|
new MyTreeItemData(wxT("Root item")));
|
||||||
if ( image != -1 )
|
if ( !HasFlag(wxTR_HIDE_ROOT) && image != -1 )
|
||||||
{
|
{
|
||||||
SetItemImage(rootId, TreeCtrlIcon_FolderOpened, wxTreeItemIcon_Expanded);
|
SetItemImage(rootId, TreeCtrlIcon_FolderOpened, wxTreeItemIcon_Expanded);
|
||||||
}
|
}
|
||||||
@@ -873,6 +877,7 @@ void MyTreeCtrl::AddTestItemsToTree(size_t numChildren,
|
|||||||
AddItemsRecursively(rootId, numChildren, depth, 0);
|
AddItemsRecursively(rootId, numChildren, depth, 0);
|
||||||
|
|
||||||
// set some colours/fonts for testing
|
// set some colours/fonts for testing
|
||||||
|
if ( !HasFlag(wxTR_HIDE_ROOT) )
|
||||||
SetItemFont(rootId, *wxITALIC_FONT);
|
SetItemFont(rootId, *wxITALIC_FONT);
|
||||||
|
|
||||||
wxTreeItemIdValue cookie;
|
wxTreeItemIdValue cookie;
|
||||||
|
Reference in New Issue
Block a user