Add wxXmlResource::LoadDocument()

This allows loading XRC from anywhere, not just files and URLs.
This commit is contained in:
Vadim Zeitlin
2021-04-14 23:59:39 +01:00
parent db3e54b3dc
commit c16082edfe
3 changed files with 129 additions and 7 deletions

View File

@@ -131,6 +131,13 @@ public:
// Loads all XRC files from a directory.
bool LoadAllFiles(const wxString& dirname);
// Loads resources from the given XML document, taking ownership of it.
//
// The name argument is only used to Unload() the document later here and
// doesn't need to be an existing filename at all (but should be unique if
// specified, otherwise it's just synthesized internally).
bool LoadDocument(wxXmlDocument* doc, const wxString& name = wxString());
// Unload resource from the given XML file (wildcards not allowed)
bool Unload(const wxString& filename);
@@ -320,6 +327,9 @@ protected:
// wxXmlDocument (which will be owned by caller) on success or NULL.
wxXmlDocument *DoLoadFile(const wxString& file);
// Load XRC from the given document and returns true on success.
bool DoLoadDocument(const wxXmlDocument& doc);
// Scans the resources list for unloaded files and loads them. Also reloads
// files that have been modified since last loading.
bool UpdateResources();