From 25083729594c46fc5132e49b460c952b9e2b37ff Mon Sep 17 00:00:00 2001 From: codereader Date: Fri, 27 Dec 2019 11:59:58 +0100 Subject: [PATCH] Resolving #5078 by cleaning up the TreeView class. --- libs/wxutil/TreeView.cpp | 11 +++++------ libs/wxutil/TreeView.h | 2 -- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/libs/wxutil/TreeView.cpp b/libs/wxutil/TreeView.cpp index 8c992a5238..26ae14c7bb 100644 --- a/libs/wxutil/TreeView.cpp +++ b/libs/wxutil/TreeView.cpp @@ -14,8 +14,7 @@ namespace } TreeView::TreeView(wxWindow* parent, TreeModel::Ptr model, long style) : - wxDataViewCtrl(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, style), - _searchPopup(NULL) + wxDataViewCtrl(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, style) { EnableAutoColumnWidthFix(); @@ -24,8 +23,8 @@ TreeView::TreeView(wxWindow* parent, TreeModel::Ptr model, long style) : AssociateModel(model.get()); } - Connect(wxEVT_CHAR, wxKeyEventHandler(TreeView::_onChar), NULL, this); - Connect(wxEVT_DATAVIEW_ITEM_ACTIVATED, wxDataViewEventHandler(TreeView::_onItemActivated), NULL, this); + Bind(wxEVT_CHAR, std::bind(&TreeView::_onChar, this, std::placeholders::_1)); + Bind(wxEVT_DATAVIEW_ITEM_ACTIVATED, std::bind(&TreeView::_onItemActivated, this, std::placeholders::_1)); } TreeView* TreeView::Create(wxWindow* parent, long style) @@ -68,7 +67,7 @@ void TreeView::EnableAutoColumnWidthFix(bool enable) void TreeView::TriggerColumnSizeEvent(const wxDataViewItem& item) { - if (GetModel() == NULL) return; + if (GetModel() == nullptr) return; // Trigger a column size event on the first row wxDataViewItemArray children; @@ -347,7 +346,7 @@ void TreeView::JumpToSearchMatch(const wxDataViewItem& item) { TreeModel* model = dynamic_cast(GetModel()); - if (model == NULL) + if (model == nullptr) { return; } diff --git a/libs/wxutil/TreeView.h b/libs/wxutil/TreeView.h index 07ec72a9fa..07105f53e1 100644 --- a/libs/wxutil/TreeView.h +++ b/libs/wxutil/TreeView.h @@ -25,10 +25,8 @@ class TreeView : std::unique_ptr _search; class SearchPopupWindow; - SearchPopupWindow* _searchPopup; std::vector _colsToSearch; - wxDataViewItem _curSearchMatch; TreeView(wxWindow* parent, TreeModel::Ptr model, long style);