Skip to content

Commit

Permalink
#5814: Show icons for inherited properties
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Nov 21, 2021
1 parent 6d4157f commit 7184e72
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 24 deletions.
8 changes: 8 additions & 0 deletions libs/wxutil/dataview/TreeViewItemStyle.h
Expand Up @@ -45,6 +45,14 @@ class TreeViewItemStyle
return wxDataViewItemAttr();
}

static wxDataViewItemAttr Inherited()
{
wxDataViewItemAttr italic;
italic.SetItalic(true);

return italic;
}

// Styles used by the merge action visualisation in data views

static void ApplyKeyValueAddedStyle(wxDataViewItemAttr& attr)
Expand Down
49 changes: 25 additions & 24 deletions radiant/ui/einspector/EntityInspector.cpp
Expand Up @@ -1552,36 +1552,37 @@ void EntityInspector::addClassAttribute(const EntityClassAttribute& a)
{
// Only add properties with values, we don't want the optional
// "editor_var xxx" properties here.
if (!a.getValue().empty())
{
wxutil::TreeModel::Row row = _kvStore->AddItem();
if (a.getValue().empty()) return;

wxDataViewItemAttr grey;
grey.SetItalic(true);
auto row = _kvStore->AddItem();

row[_columns.name] = wxVariant(wxDataViewIconText(a.getName(), _emptyIcon));
row[_columns.value] = a.getValue();
auto style = wxutil::TreeViewItemStyle::Inherited();

// Inherited values have an inactive checkbox, so assign a false value and disable
if (a.getType() == "bool")
{
row[_columns.booleanValue] = a.getValue() == "1";
}
else
{
row[_columns.booleanValue] = false;
row[_columns.booleanValue].setEnabled(false);
}
row[_columns.name] = wxVariant(wxDataViewIconText(a.getName(), _emptyIcon));
row[_columns.value] = a.getValue();

row[_columns.name] = grey;
row[_columns.value] = grey;
row[_columns.oldValue] = std::string();
row[_columns.newValue] = std::string();

row[_columns.isInherited] = true;
// Load the correct icon for this key
updateKeyType(row);

row.SendItemAdded();
// Inherited values have an inactive checkbox, so assign a false value and disable
if (a.getType() == "bool")
{
row[_columns.booleanValue] = a.getValue() == "1";
}
else
{
row[_columns.booleanValue] = false;
row[_columns.booleanValue].setEnabled(false);
}

row[_columns.name] = style;
row[_columns.value] = style;
row[_columns.oldValue] = std::string();
row[_columns.newValue] = std::string();

row[_columns.isInherited] = true;

row.SendItemAdded();
}

// Append inherited (entityclass) properties
Expand Down

0 comments on commit 7184e72

Please sign in to comment.