From daa820fd8b376af00d742f39369b27da39c58be6 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Sun, 13 Oct 2002 16:19:15 +0000 Subject: [PATCH] Enable direct access to XML data in XRC. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17514 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- contrib/include/wx/xrc/xmlres.h | 4 ++++ contrib/src/xrc/xmlres.cpp | 10 ++++++++++ include/wx/xrc/xmlres.h | 4 ++++ src/xrc/xmlres.cpp | 10 ++++++++++ 4 files changed, 28 insertions(+) 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) {