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}
class wxXmlResource : public wxObject
{
public:
- //@{
/**
Constructor.
*/
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.
*/
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.
*/
/**
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);
@code
MyDialog dlg;
- wxTheXmlResource->LoadDialog(&dlg, mainFrame, "my_dialog");
+ wxXmlResource::Get()->LoadDialog(&dlg, mainFrame, "my_dialog");
dlg.ShowModal();
@endcode
*/
/**
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.
/**
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).
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: