X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/47793ab85a3fa3efd6039a28cfbef9cee20e7d9d..828621c2ea0c43af4082218ba33b5e4137283db9:/include/wx/xrc/xmlres.h diff --git a/include/wx/xrc/xmlres.h b/include/wx/xrc/xmlres.h index 01f70f294b..fb076250eb 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); @@ -172,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 @@ -199,12 +206,12 @@ private: #endif friend class wxXmlResourceHandler; + + // singleton instance: + static wxXmlResource *ms_instance; }; -// Global instance of resource class. For your convenience. -extern WXXMLDLLEXPORT wxXmlResource *wxTheXmlResource; - // This macro translates string identifier (as used in XML resource, // e.g. ...) to integer id that is needed by // wxWindows event tables. @@ -225,7 +232,7 @@ extern WXXMLDLLEXPORT wxXmlResource *wxTheXmlResource; // controls. // Example: // wxDialog dlg; -// wxTheXmlResource->LoadDialog(&dlg, mainFrame, "my_dialog"); +// wxXmlResource::Get()->LoadDialog(&dlg, mainFrame, "my_dialog"); // XMLCTRL(dlg, "my_textctrl", wxTextCtrl)->SetValue(wxT("default value")); #ifdef __WXDEBUG__ @@ -264,7 +271,6 @@ public: protected: - wxXmlResource *m_resource; wxArrayString m_styleNames; wxArrayInt m_styleValues; @@ -361,7 +367,6 @@ protected: // Programmer-friendly macros for writing XRC handlers: #define XRC_ADD_STYLE(style) AddStyle(wxT(#style), style) -#define ADD_STYLE XRC_ADD_STYLE /* deprecated, don't use!! */ #define XRC_MAKE_INSTANCE(variable, classname) \ classname *variable = NULL; \ @@ -374,4 +379,14 @@ protected: // FIXME -- remove this $%^#$%#$@# as soon as Ron checks his changes in!! void wxXmlInitResourceModule(); + +/* ------------------------------------------------------------------------- + Backward compatibility macros. Do *NOT* use, they may disappear in future + versions of the XRC library! + ------------------------------------------------------------------------- */ +#define ADD_STYLE XRC_ADD_STYLE +#define wxTheXmlResource wxXmlResource::Get() + + + #endif // _WX_XMLRES_H_