X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/daa85ee3af64b629eb52b8b9d21fa4b837b5cb78..409d5a58605cfb202774b59c3af078d3be89d7d5:/include/wx/xrc/xmlres.h diff --git a/include/wx/xrc/xmlres.h b/include/wx/xrc/xmlres.h index 62d3093b4c..8566b230f7 100644 --- a/include/wx/xrc/xmlres.h +++ b/include/wx/xrc/xmlres.h @@ -101,7 +101,7 @@ public: wxXmlResource(int flags = wxXRC_USE_LOCALE); wxXmlResource(const wxString& filemask, int flags = wxXRC_USE_LOCALE); ~wxXmlResource(); - + // Loads resources from XML files that match given filemask. // This method understands VFS (see filesys.h). bool Load(const wxString& filemask); @@ -125,7 +125,8 @@ public: wxMenu *LoadMenu(const wxString& name); // Loads menubar from resource. Returns NULL on failure. - wxMenuBar *LoadMenuBar(const wxString& name); + wxMenuBar *LoadMenuBar(wxWindow *parent, const wxString& name); + wxMenuBar *LoadMenuBar(const wxString& name) { return LoadMenuBar(NULL, name); } #if wxUSE_TOOLBAR // Loads toolbar @@ -171,6 +172,13 @@ public: int CompareVersion(int major, int minor, int release, int revision) const { return GetVersion() - (major*256*256*256 + minor*256*256 + release*256 + revision); } + + // Singleton accessors: + + // Gets global resources object or create one if none exists + static wxXmlResource *Get(); + // Sets global resources object and returns pointer to previous one (may be NULL). + static wxXmlResource *Set(wxXmlResource *res); protected: // Scans resources list for unloaded files and loads them. Also reloads @@ -178,7 +186,8 @@ protected: void UpdateResources(); // Finds resource (calls UpdateResources) and returns node containing it - wxXmlNode *FindResource(const wxString& name, const wxString& classname); + wxXmlNode *FindResource(const wxString& name, const wxString& classname, bool recursive = FALSE); + wxXmlNode *DoFindResource(wxXmlNode *parent, const wxString& name, const wxString& classname, bool recursive); // Creates resource from info in given node: wxObject *CreateResFromNode(wxXmlNode *node, wxObject *parent, wxObject *instance = NULL); @@ -197,11 +206,14 @@ private: #endif friend class wxXmlResourceHandler; + + // singleton instance: + static wxXmlResource *ms_instance; }; -// Global instance of resource class. For your convenience. -extern WXXMLDLLEXPORT wxXmlResource *wxTheXmlResource; +// This is here only for backward compatibility. Do NOT use!! +#define wxTheXmlResource wxXmlResource::Get() // This macro translates string identifier (as used in XML resource, // e.g. ...) to integer id that is needed by