improve wxTreeCtrl::ScrollTo() behaviour in the generic version and add a test for it to the sample
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60835 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -340,6 +340,7 @@ All (GUI):
|
|||||||
- wxHTML: add support for table borders width (Laurent Humbertclaude).
|
- wxHTML: add support for table borders width (Laurent Humbertclaude).
|
||||||
- Added wxMouseEventsManager.
|
- Added wxMouseEventsManager.
|
||||||
- Building OpenGL library is now enabled by default.
|
- Building OpenGL library is now enabled by default.
|
||||||
|
- Improve wxTreeCtrl::ScrollTo() in generic version (Raanan Barzel).
|
||||||
|
|
||||||
MSW:
|
MSW:
|
||||||
|
|
||||||
|
@@ -138,6 +138,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
|||||||
MENU_LINK(ShowParent)
|
MENU_LINK(ShowParent)
|
||||||
MENU_LINK(ShowPrevSibling)
|
MENU_LINK(ShowPrevSibling)
|
||||||
MENU_LINK(ShowNextSibling)
|
MENU_LINK(ShowNextSibling)
|
||||||
|
MENU_LINK(ScrollTo)
|
||||||
#undef MENU_LINK
|
#undef MENU_LINK
|
||||||
|
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
@@ -297,6 +298,9 @@ MyFrame::MyFrame(const wxString& title, int x, int y, int w, int h)
|
|||||||
item_menu->Append(TreeTest_ShowParent, "Show pa&rent");
|
item_menu->Append(TreeTest_ShowParent, "Show pa&rent");
|
||||||
item_menu->Append(TreeTest_ShowPrevSibling, "Show &previous sibling");
|
item_menu->Append(TreeTest_ShowPrevSibling, "Show &previous sibling");
|
||||||
item_menu->Append(TreeTest_ShowNextSibling, "Show &next sibling");
|
item_menu->Append(TreeTest_ShowNextSibling, "Show &next sibling");
|
||||||
|
item_menu->AppendSeparator();
|
||||||
|
item_menu->Append(TreeTest_ScrollTo, "Scroll &to item",
|
||||||
|
"Scroll to the last by one top level child");
|
||||||
|
|
||||||
#ifndef NO_MULTIPLE_SELECTION
|
#ifndef NO_MULTIPLE_SELECTION
|
||||||
item_menu->AppendSeparator();
|
item_menu->AppendSeparator();
|
||||||
@@ -821,6 +825,17 @@ void MyFrame::DoShowRelativeItem(TreeFunc1_t pfn, const wxString& label)
|
|||||||
label, m_treeCtrl->GetItemText(new_item));
|
label, m_treeCtrl->GetItemText(new_item));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnScrollTo(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
// scroll to the last but one top level child
|
||||||
|
wxTreeItemId item = m_treeCtrl->GetPrevSibling(
|
||||||
|
m_treeCtrl->GetLastChild(
|
||||||
|
m_treeCtrl->GetRootItem()));
|
||||||
|
CHECK_ITEM( item );
|
||||||
|
|
||||||
|
m_treeCtrl->ScrollTo(item);
|
||||||
|
}
|
||||||
|
|
||||||
void MyFrame::OnSetFgColour(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnSetFgColour(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
wxColour col = wxGetColourFromUser(this, m_treeCtrl->GetForegroundColour());
|
wxColour col = wxGetColourFromUser(this, m_treeCtrl->GetForegroundColour());
|
||||||
|
@@ -268,6 +268,8 @@ public:
|
|||||||
void OnShowNextSibling(wxCommandEvent& WXUNUSED(event))
|
void OnShowNextSibling(wxCommandEvent& WXUNUSED(event))
|
||||||
{ DoShowRelativeItem(&wxTreeCtrl::GetNextSibling, "next sibling"); }
|
{ DoShowRelativeItem(&wxTreeCtrl::GetNextSibling, "next sibling"); }
|
||||||
|
|
||||||
|
void OnScrollTo(wxCommandEvent& event);
|
||||||
|
|
||||||
void OnIdle(wxIdleEvent& event);
|
void OnIdle(wxIdleEvent& event);
|
||||||
void OnSize(wxSizeEvent& event);
|
void OnSize(wxSizeEvent& event);
|
||||||
|
|
||||||
@@ -359,5 +361,6 @@ enum
|
|||||||
TreeTest_ShowParent,
|
TreeTest_ShowParent,
|
||||||
TreeTest_ShowPrevSibling,
|
TreeTest_ShowPrevSibling,
|
||||||
TreeTest_ShowNextSibling,
|
TreeTest_ShowNextSibling,
|
||||||
|
TreeTest_ScrollTo,
|
||||||
TreeTest_Ctrl = 1000
|
TreeTest_Ctrl = 1000
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user