diff --git a/contrib/include/wx/xrc/xmlres.h b/contrib/include/wx/xrc/xmlres.h index f52356bd72..e47520f5a9 100644 --- a/contrib/include/wx/xrc/xmlres.h +++ b/contrib/include/wx/xrc/xmlres.h @@ -115,6 +115,10 @@ public: // Destructor. ~wxXmlResource(); + // Gives access to the first root node for + // direct manipulation or querying + wxXmlNode *GetFirstRoot(); + // Loads resources from XML files that match given filemask. // This method understands VFS (see filesys.h). bool Load(const wxString& filemask); diff --git a/contrib/src/xrc/xmlres.cpp b/contrib/src/xrc/xmlres.cpp index d3aaf6232f..98cb77e1f5 100644 --- a/contrib/src/xrc/xmlres.cpp +++ b/contrib/src/xrc/xmlres.cpp @@ -146,6 +146,16 @@ void wxXmlResource::ClearHandlers() } +wxXmlNode *wxXmlResource::GetFirstRoot() +{ + UpdateResources(); //ensure everything is up-to-date + + if (m_data.GetCount() == 0) return NULL; + + if (m_data[0].Doc == NULL) return NULL; + + return m_data[0].Doc->GetRoot(); +} wxMenu *wxXmlResource::LoadMenu(const wxString& name) { diff --git a/include/wx/xrc/xmlres.h b/include/wx/xrc/xmlres.h index f52356bd72..e47520f5a9 100644 --- a/include/wx/xrc/xmlres.h +++ b/include/wx/xrc/xmlres.h @@ -115,6 +115,10 @@ public: // Destructor. ~wxXmlResource(); + // Gives access to the first root node for + // direct manipulation or querying + wxXmlNode *GetFirstRoot(); + // Loads resources from XML files that match given filemask. // This method understands VFS (see filesys.h). bool Load(const wxString& filemask); diff --git a/src/xrc/xmlres.cpp b/src/xrc/xmlres.cpp index d3aaf6232f..98cb77e1f5 100644 --- a/src/xrc/xmlres.cpp +++ b/src/xrc/xmlres.cpp @@ -146,6 +146,16 @@ void wxXmlResource::ClearHandlers() } +wxXmlNode *wxXmlResource::GetFirstRoot() +{ + UpdateResources(); //ensure everything is up-to-date + + if (m_data.GetCount() == 0) return NULL; + + if (m_data[0].Doc == NULL) return NULL; + + return m_data[0].Doc->GetRoot(); +} wxMenu *wxXmlResource::LoadMenu(const wxString& name) {