X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/95b4a59e67af301bb6ff061055ac5a9a09b96d6c..d0a6715724f10ef967bd9c3868c433142efab9b1:/interface/wx/xrc/xmlres.h diff --git a/interface/wx/xrc/xmlres.h b/interface/wx/xrc/xmlres.h index 1144d5773e..849b932ea6 100644 --- a/interface/wx/xrc/xmlres.h +++ b/interface/wx/xrc/xmlres.h @@ -31,7 +31,10 @@ enum wxXmlResourceFlags The class holds XML resources from one or more .xml files, binary files or zip archive files. - @see @ref overview_xrc, @ref xrc_format + Note that this is a singleton class and you'll never allocate/deallocate it. + Just use the static wxXmlResource::Get() getter. + + @see @ref overview_xrc, @ref overview_xrcformat @library{wxxrc} @category{xrc} @@ -39,7 +42,6 @@ enum wxXmlResourceFlags class wxXmlResource : public wxObject { public: - //@{ /** Constructor. @@ -55,10 +57,20 @@ public: */ wxXmlResource(const wxString& filemask, int flags = wxXRC_USE_LOCALE, - const wxString domain = wxEmptyString); + const wxString& domain = wxEmptyString); + + /** + Constructor. + + @param flags + One or more value of the ::wxXmlResourceFlags enumeration. + @param domain + The name of the gettext catalog to search for translatable strings. + By default all loaded catalogs will be searched. + This provides a way to allow the strings to only come from a specific catalog. + */ wxXmlResource(int flags = wxXRC_USE_LOCALE, - const wxString domain = wxEmptyString); - //@} + const wxString& domain = wxEmptyString); /** Destructor. @@ -99,6 +111,20 @@ public: */ int CompareVersion(int major, int minor, int release, int revision) const; + /** + Returns a string ID corresponding to the given numeric ID. + + The string returned is such that calling GetXRCID() with it as + parameter yields @a numId. If there is no string identifier + corresponding to the given numeric one, an empty string is returned. + + Notice that, unlike GetXRCID(), this function is slow as it checks all + of the identifiers used in XRC. + + @since 2.9.0 + */ + static wxString FindXRCIDById(int numId); + /** Gets the global resources object or creates one if none exists. */ @@ -143,7 +169,14 @@ public: /** Loads resources from XML files that match given filemask. - This method understands VFS (see filesys.h). + + Example: + @code + if (!wxXmlResource::Get()->Load("rc/*.xrc")) + wxLogError("Couldn't load resources!"); + @endcode + + This method understands VFS (see wxFileSystem::FindFirst). */ bool Load(const wxString& filemask); @@ -166,7 +199,7 @@ public: @code MyDialog dlg; - wxTheXmlResource->LoadDialog(&dlg, mainFrame, "my_dialog"); + wxXmlResource::Get()->LoadDialog(&dlg, mainFrame, "my_dialog"); dlg.ShowModal(); @endcode */ @@ -348,7 +381,7 @@ protected: /** Creates an animation (see wxAnimation) from the filename specified in @a param. */ - wxAnimation GetAnimation(const wxString& param = wxT("animation")); + wxAnimation GetAnimation(const wxString& param = "animation"); /** Gets a bitmap. @@ -424,7 +457,7 @@ protected: /** Gets the position (may be in dialog units). */ - wxPoint GetPosition(const wxString& param = wxT("pos")); + wxPoint GetPosition(const wxString& param = "pos"); /** Gets the size (may be in dialog units). @@ -435,7 +468,7 @@ protected: Gets style flags from text in form "flag | flag2| flag3 |..." Only understands flags added with AddStyle(). */ - int GetStyle(const wxString& param = wxT("style"), int defaults = 0); + int GetStyle(const wxString& param = "style", int defaults = 0); /** Gets text from param and does some conversions: