Skip to content

Commit

Permalink
#6021: Add explicit interface to select/query decl names when using D…
Browse files Browse the repository at this point in the history
…eclarationTreeView
  • Loading branch information
codereader committed Jul 29, 2022
1 parent d853773 commit 0861893
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
5 changes: 5 additions & 0 deletions libs/wxutil/dataview/DeclarationTreeView.cpp
Expand Up @@ -33,6 +33,11 @@ std::string DeclarationTreeView::GetSelectedDeclName()
return row[_columns.declName];
}

void DeclarationTreeView::SetSelectedDeclName(const std::string& declName)
{
SetSelectedElement(declName, _columns.declName);
}

void DeclarationTreeView::PopulateContextMenu(wxutil::PopupMenu& popupMenu)
{
ResourceTreeView::PopulateContextMenu(popupMenu);
Expand Down
8 changes: 5 additions & 3 deletions libs/wxutil/dataview/DeclarationTreeView.h
Expand Up @@ -33,12 +33,14 @@ class DeclarationTreeView :
DeclarationTreeView(wxWindow* parent, decl::Type declType, const Columns& columns, long style = wxDV_SINGLE);
DeclarationTreeView(wxWindow* parent, decl::Type declType, const TreeModel::Ptr& model, const Columns& columns, long style = wxDV_SINGLE);

protected:
void PopulateContextMenu(wxutil::PopupMenu& popupMenu) override;

// Returns the name of the selected declaration, suitable for lookups in IDeclarationManager
virtual std::string GetSelectedDeclName();

virtual void SetSelectedDeclName(const std::string& declName);

protected:
void PopulateContextMenu(wxutil::PopupMenu& popupMenu) override;

private:
void _onShowDefinition();
bool _showDefinitionEnabled();
Expand Down
4 changes: 2 additions & 2 deletions plugins/dm.editing/AIHeadChooserDialog.cpp
Expand Up @@ -142,12 +142,12 @@ void AIHeadChooserDialog::_onItemActivated(wxDataViewEvent& ev)

void AIHeadChooserDialog::setSelectedHead(const std::string& headDef)
{
_headsView->SetSelectedFullname(headDef);
_headsView->SetSelectedDeclName(headDef);
}

std::string AIHeadChooserDialog::getSelectedHead()
{
return _headsView->GetSelectedFullname();
return _headsView->GetSelectedDeclName();
}

void AIHeadChooserDialog::handleSelectionChanged()
Expand Down

0 comments on commit 0861893

Please sign in to comment.