Support inherited attributes in wxPropertyGrid XRC handler

Allow specifying recurse="1" to inherit the attribute, as this is much
nicer than having to specify it for all the children.

Also add support for this to wxPropertyGridPopulator, which is used by
the XRC handler.
This commit is contained in:
Vadim Zeitlin 2024-01-31 02:48:10 +01:00
parent 0ddbf965c9
commit 9550c37e29
5 changed files with 42 additions and 4 deletions

View file

@ -2157,7 +2157,8 @@ public:
// Empty string mean autodetect.
bool AddAttribute( const wxString& name,
const wxString& type,
const wxString& value );
const wxString& value,
wxPGPropertyValuesFlags flags = wxPGPropertyValuesFlags::DontRecurse );
// Called once in AddChildren.
virtual void DoScanForChildren() = 0;
@ -2197,6 +2198,9 @@ protected:
// Tree-hierarchy of added properties (that can have children).
std::vector<wxPGProperty*> m_propHierarchy;
// Recursively set attributes.
std::unordered_map<wxString, wxVariant> m_inheritedAttributes;
// Hashmap for string-id to wxPGChoicesData mapping.
std::unordered_map<wxString, wxPGChoicesData*> m_dictIdChoices;
};