From 366d06847bb3cccd3852c6681e9902ada5029067 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 25 Oct 2023 18:36:39 +0200 Subject: [PATCH] Remove confusing boolean parameter from treectrl sample Don't use CreateStateImageList(true) to delete the image list. No real changes, just make the code more understandable. --- samples/treectrl/treetest.cpp | 12 +++--------- samples/treectrl/treetest.h | 2 +- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/samples/treectrl/treetest.cpp b/samples/treectrl/treetest.cpp index 652b596312..fddda848c3 100644 --- a/samples/treectrl/treetest.cpp +++ b/samples/treectrl/treetest.cpp @@ -703,12 +703,12 @@ void MyFrame::OnToggleStates(wxCommandEvent& WXUNUSED(event)) { if ( wxGetApp().ShowStates() ) { - m_treeCtrl->CreateStateImageList(true); + m_treeCtrl->SetStateImageList(nullptr); wxGetApp().SetShowStates(false); } else { - m_treeCtrl->CreateStateImageList(false); + m_treeCtrl->CreateStateImageList(); wxGetApp().SetShowStates(true); } } @@ -1035,14 +1035,8 @@ void MyTreeCtrl::CreateImages(int size) SetImages(images); } -void MyTreeCtrl::CreateStateImageList(bool del) +void MyTreeCtrl::CreateStateImageList() { - if ( del ) - { - SetStateImageList(nullptr); - return; - } - wxImageList *states; wxBusyCursor wait; diff --git a/samples/treectrl/treetest.h b/samples/treectrl/treetest.h index dc7d190b6a..24a751c34c 100644 --- a/samples/treectrl/treetest.h +++ b/samples/treectrl/treetest.h @@ -113,7 +113,7 @@ public: void CreateImages(int size); void CreateButtonsImageList(int size = 11); - void CreateStateImageList(bool del = false); + void CreateStateImageList(); void AddTestItemsToTree(size_t numChildren, size_t depth);