X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/527343602e91d60c65fb7589a6ddcf4683930c78..4e7b25f056b1c983eb35d3f71ba67da84a15be19:/samples/treectrl/treetest.h?ds=inline diff --git a/samples/treectrl/treetest.h b/samples/treectrl/treetest.h index 14e26e6a13..2d6e989211 100644 --- a/samples/treectrl/treetest.h +++ b/samples/treectrl/treetest.h @@ -157,6 +157,7 @@ public: // menu callbacks void OnQuit(wxCommandEvent& event); void OnAbout(wxCommandEvent& event); + void OnClearLog(wxCommandEvent& event); void OnTogButtons(wxCommandEvent& event) { TogStyle(event.GetId(), wxTR_HAS_BUTTONS); } @@ -224,6 +225,18 @@ public: void OnToggleIcon(wxCommandEvent& event); + void OnShowFirstVisible(wxCommandEvent& WXUNUSED(event)) + { DoShowFirstOrLast(&wxTreeCtrl::GetFirstVisibleItem, "first visible"); } +#ifdef wxHAS_LAST_VISIBLE // we don't have it currently but may add later + void OnShowLastVisible(wxCommandEvent& WXUNUSED(event)) + { DoShowFirstOrLast(&wxTreeCtrl::GetLastVisibleItem, "last visible"); } +#endif // wxHAS_LAST_VISIBLE + + void OnShowNextVisible(wxCommandEvent& WXUNUSED(event)) + { DoShowNextOrPrev(&wxTreeCtrl::GetNextVisible, "next visible"); } + void OnShowPrevVisible(wxCommandEvent& WXUNUSED(event)) + { DoShowNextOrPrev(&wxTreeCtrl::GetPrevVisible, "previous visible"); } + void OnIdle(wxIdleEvent& event); void OnSize(wxSizeEvent& event); @@ -237,6 +250,14 @@ private: void CreateTreeWithDefStyle(); void CreateTree(long style); + // common parts of OnShowFirst/LastVisible() and OnShowNext/PrevVisible() + typedef wxTreeItemId (wxTreeCtrl::*TreeFunc0_t)() 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); + + wxPanel *m_panel; MyTreeCtrl *m_treeCtrl; #if wxUSE_LOG @@ -253,6 +274,7 @@ enum { TreeTest_Quit = wxID_EXIT, TreeTest_About = wxID_ABOUT, + TreeTest_ClearLog = wxID_CLEAR, TreeTest_TogButtons = wxID_HIGHEST, TreeTest_TogTwist, TreeTest_TogLines, @@ -295,5 +317,9 @@ enum TreeTest_Select, TreeTest_Unselect, TreeTest_SelectRoot, + TreeTest_ShowFirstVisible, + TreeTest_ShowLastVisible, + TreeTest_ShowNextVisible, + TreeTest_ShowPrevVisible, TreeTest_Ctrl = 1000 };