Add wxXmlResourceHandler::GetNodeName()

This allows to get the name of the node which is needed for XRC handlers
using specific elements instead of using the object elements with
specific name attribute.
This commit is contained in:
Vadim Zeitlin 2024-02-03 19:47:27 +01:00
parent 9ab62c02fd
commit 921018cfc8
4 changed files with 26 additions and 0 deletions

View file

@ -507,6 +507,10 @@ public:
bool IsOfClass(wxXmlNode *node, const wxString& classname) const override;
bool IsObjectNode(const wxXmlNode *node) const override;
// Returns the name of the node, e.g. "object" or "sizeritem".
wxString GetNodeName(const wxXmlNode *node) const override;
// Gets node content from wxXML_ENTITY_NODE
// The problem is, <tag>content<tag> is represented as
// wxXML_ENTITY_NODE name="tag", content=""

View file

@ -61,6 +61,7 @@ public:
wxObject *instance) = 0;
virtual bool IsOfClass(wxXmlNode *node, const wxString& classname) const = 0;
virtual bool IsObjectNode(const wxXmlNode *node) const = 0;
virtual wxString GetNodeName(const wxXmlNode *node) const = 0;
virtual wxString GetNodeContent(const wxXmlNode *node) const = 0;
virtual wxXmlNode *GetNodeParent(const wxXmlNode *node) const = 0;
virtual wxXmlNode *GetNodeNext(const wxXmlNode *node) const = 0;
@ -240,6 +241,12 @@ protected:
{
return GetImpl()->IsObjectNode(node);
}
wxString GetNodeName(const wxXmlNode *node) const
{
return GetImpl()->GetNodeName(node);
}
wxString GetNodeContent(const wxXmlNode *node) const
{
return GetImpl()->GetNodeContent(node);