Navigation Menu

Skip to content

Commit

Permalink
Resolving #5078 by cleaning up the TreeView class.
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Dec 27, 2019
1 parent eb6b1f0 commit 2508372
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
11 changes: 5 additions & 6 deletions libs/wxutil/TreeView.cpp
Expand Up @@ -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();

Expand All @@ -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)
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -347,7 +346,7 @@ void TreeView::JumpToSearchMatch(const wxDataViewItem& item)
{
TreeModel* model = dynamic_cast<TreeModel*>(GetModel());

if (model == NULL)
if (model == nullptr)
{
return;
}
Expand Down
2 changes: 0 additions & 2 deletions libs/wxutil/TreeView.h
Expand Up @@ -25,10 +25,8 @@ class TreeView :
std::unique_ptr<Search> _search;

class SearchPopupWindow;
SearchPopupWindow* _searchPopup;

std::vector<TreeModel::Column> _colsToSearch;
wxDataViewItem _curSearchMatch;

TreeView(wxWindow* parent, TreeModel::Ptr model, long style);

Expand Down

0 comments on commit 2508372

Please sign in to comment.