git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55445
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
#endif // wxHAS_LAST_VISIBLE
MENU_LINK(ShowNextVisible)
MENU_LINK(ShowPrevVisible)
#endif // wxHAS_LAST_VISIBLE
MENU_LINK(ShowNextVisible)
MENU_LINK(ShowPrevVisible)
+ MENU_LINK(ShowParent)
+ MENU_LINK(ShowPrevSibling)
+ MENU_LINK(ShowNextSibling)
#undef MENU_LINK
END_EVENT_TABLE()
#undef MENU_LINK
END_EVENT_TABLE()
#endif // wxHAS_LAST_VISIBLE
item_menu->Append(TreeTest_ShowNextVisible, wxT("Show &next visible"));
item_menu->Append(TreeTest_ShowPrevVisible, wxT("Show &previous visible"));
#endif // wxHAS_LAST_VISIBLE
item_menu->Append(TreeTest_ShowNextVisible, wxT("Show &next visible"));
item_menu->Append(TreeTest_ShowPrevVisible, wxT("Show &previous visible"));
+ item_menu->AppendSeparator();
+ item_menu->Append(TreeTest_ShowParent, "Show pa&rent");
+ item_menu->Append(TreeTest_ShowPrevSibling, "Show &previous sibling");
+ item_menu->Append(TreeTest_ShowNextSibling, "Show &next sibling");
#ifndef NO_MULTIPLE_SELECTION
item_menu->AppendSeparator();
#ifndef NO_MULTIPLE_SELECTION
item_menu->AppendSeparator();
label, m_treeCtrl->GetItemText(item));
}
label, m_treeCtrl->GetItemText(item));
}
-void MyFrame::DoShowNextOrPrev(TreeFunc1_t pfn, const wxString& label)
+void MyFrame::DoShowRelativeItem(TreeFunc1_t pfn, const wxString& label)
{
wxTreeItemId item = m_treeCtrl->GetSelection();
CHECK_ITEM( item );
{
wxTreeItemId item = m_treeCtrl->GetSelection();
CHECK_ITEM( item );
- if ( !m_treeCtrl->IsVisible(item) )
+ if ((pfn == (TreeFunc1_t) &wxTreeCtrl::GetPrevVisible
+ || pfn == (TreeFunc1_t) &wxTreeCtrl::GetNextVisible)
+ && !m_treeCtrl->IsVisible(item))
{
wxLogMessage("The selected item must be visible.");
return;
}
{
wxLogMessage("The selected item must be visible.");
return;
}
- item = (m_treeCtrl->*pfn)(item);
+ wxTreeItemId new_item = (m_treeCtrl->*pfn)(item);
+ if ( !new_item.IsOk() )
wxLogMessage("There is no %s item", label);
else
wxLogMessage("The %s item is \"%s\"",
wxLogMessage("There is no %s item", label);
else
wxLogMessage("The %s item is \"%s\"",
- label, m_treeCtrl->GetItemText(item));
+ label, m_treeCtrl->GetItemText(new_item));
}
void MyFrame::OnSetFgColour(wxCommandEvent& WXUNUSED(event))
}
void MyFrame::OnSetFgColour(wxCommandEvent& WXUNUSED(event))
#endif // wxHAS_LAST_VISIBLE
void OnShowNextVisible(wxCommandEvent& WXUNUSED(event))
#endif // wxHAS_LAST_VISIBLE
void OnShowNextVisible(wxCommandEvent& WXUNUSED(event))
- { DoShowNextOrPrev(&wxTreeCtrl::GetNextVisible, "next visible"); }
+ { DoShowRelativeItem(&wxTreeCtrl::GetNextVisible, "next visible"); }
void OnShowPrevVisible(wxCommandEvent& WXUNUSED(event))
void OnShowPrevVisible(wxCommandEvent& WXUNUSED(event))
- { DoShowNextOrPrev(&wxTreeCtrl::GetPrevVisible, "previous visible"); }
+ { DoShowRelativeItem(&wxTreeCtrl::GetPrevVisible, "previous visible"); }
+
+ void OnShowParent(wxCommandEvent& WXUNUSED(event))
+ { DoShowRelativeItem(&wxTreeCtrl::GetItemParent, "parent"); }
+ void OnShowPrevSibling(wxCommandEvent& WXUNUSED(event))
+ { DoShowRelativeItem(&wxTreeCtrl::GetPrevSibling, "previous sibling"); }
+ void OnShowNextSibling(wxCommandEvent& WXUNUSED(event))
+ { DoShowRelativeItem(&wxTreeCtrl::GetNextSibling, "next sibling"); }
void OnIdle(wxIdleEvent& event);
void OnSize(wxSizeEvent& event);
void OnIdle(wxIdleEvent& event);
void OnSize(wxSizeEvent& event);
void DoShowFirstOrLast(TreeFunc0_t pfn, const wxString& label);
typedef wxTreeItemId (wxTreeCtrl::*TreeFunc1_t)(const wxTreeItemId&) const;
void DoShowFirstOrLast(TreeFunc0_t pfn, const wxString& label);
typedef wxTreeItemId (wxTreeCtrl::*TreeFunc1_t)(const wxTreeItemId&) const;
- void DoShowNextOrPrev(TreeFunc1_t pfn, const wxString& label);
+ void DoShowRelativeItem(TreeFunc1_t pfn, const wxString& label);
TreeTest_ShowLastVisible,
TreeTest_ShowNextVisible,
TreeTest_ShowPrevVisible,
TreeTest_ShowLastVisible,
TreeTest_ShowNextVisible,
TreeTest_ShowPrevVisible,
+ TreeTest_ShowParent,
+ TreeTest_ShowPrevSibling,
+ TreeTest_ShowNextSibling,