X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/18e8e19b946931e18ed45fee2137257212c79fa3..a70ab3b804b6c363f8bcbed0b4fce94b7fb03612:/interface/wx/xrc/xmlres.h diff --git a/interface/wx/xrc/xmlres.h b/interface/wx/xrc/xmlres.h index a178f1a0dc..93c10b126a 100644 --- a/interface/wx/xrc/xmlres.h +++ b/interface/wx/xrc/xmlres.h @@ -31,7 +31,7 @@ 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 + @see @ref overview_xrc, @ref overview_xrcformat @library{wxxrc} @category{xrc} @@ -39,7 +39,6 @@ enum wxXmlResourceFlags class wxXmlResource : public wxObject { public: - //@{ /** Constructor. @@ -55,10 +54,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 +108,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 wxXmlResource::FindXRCIDById(int numId); + /** Gets the global resources object or creates one if none exists. */ @@ -108,7 +131,7 @@ public: Returns the domain (message catalog) that will be used to load translatable strings in the XRC. */ - wxChar* GetDomain(); + const wxString& GetDomain() const; /** Returns flags, which may be a bitlist of ::wxXmlResourceFlags @@ -238,7 +261,7 @@ public: Sets the domain (message catalog) that will be used to load translatable strings in the XRC. */ - wxChar* SetDomain(const wxChar* domain); + void SetDomain(const wxString& domain); /** Sets flags (bitlist of ::wxXmlResourceFlags enumeration values). @@ -281,15 +304,21 @@ public: virtual ~wxXmlResourceHandler(); /** - Add a style flag (e.g. @c wxMB_DOCKABLE) to the list of flags - understood by this handler. + Creates an object (menu, dialog, control, ...) from an XML node. + Should check for validity. @a parent is a higher-level object + (usually window, dialog or panel) that is often necessary to + create the resource. + + If @b instance is non-@NULL it should not create a new instance via + 'new' but should rather use this one, and call its Create method. */ - void AddStyle(const wxString& name, int value); + wxObject* CreateResource(wxXmlNode* node, wxObject* parent, + wxObject* instance); /** - Add styles common to all wxWindow-derived classes. + Called from CreateResource after variables were filled. */ - void AddWindowStyles(); + virtual wxObject* DoCreateResource() = 0; /** Returns @true if it understands this node and can create @@ -301,7 +330,26 @@ public: at the time CanHandle() is called and it is only safe to operate on node directly or to call IsOfClass(). */ - bool CanHandle(wxXmlNode* node); + virtual bool CanHandle(wxXmlNode* node) = 0; + + /** + Sets the parent resource. + */ + void SetParentResource(wxXmlResource* res); + + +protected: + + /** + Add a style flag (e.g. @c wxMB_DOCKABLE) to the list of flags + understood by this handler. + */ + void AddStyle(const wxString& name, int value); + + /** + Add styles common to all wxWindow-derived classes. + */ + void AddWindowStyles(); /** Creates children. @@ -320,23 +368,6 @@ public: wxObject* CreateResFromNode(wxXmlNode* node, wxObject* parent, wxObject* instance = NULL); - /** - Creates an object (menu, dialog, control, ...) from an XML node. - Should check for validity. @a parent is a higher-level object - (usually window, dialog or panel) that is often necessary to - create the resource. - - If @b instance is non-@NULL it should not create a new instance via 'new' - but should rather use this one, and call its Create method. - */ - wxObject* CreateResource(wxXmlNode* node, wxObject* parent, - wxObject* instance); - - /** - Called from CreateResource after variables were filled. - */ - wxObject* DoCreateResource(); - /** Creates an animation (see wxAnimation) from the filename specified in @a param. */ @@ -345,7 +376,9 @@ public: /** Gets a bitmap. */ - wxBitmap GetBitmap(const wxString& param = wxT("bitmap"), wxSize size = wxDefaultSize); + wxBitmap GetBitmap(const wxString& param = "bitmap", + const wxArtClient& defaultArtClient = wxART_OTHER, + wxSize size = wxDefaultSize); /** Gets a bool flag (1, t, yes, on, true are @true, everything else is @false). @@ -361,17 +394,18 @@ public: /** Returns the current file system. */ - wxFileSystem GetCurFileSystem(); + wxFileSystem& GetCurFileSystem(); /** Gets a dimension (may be in dialog units). */ - wxCoord GetDimension(const wxString& param, wxCoord defaultv = 0); + wxCoord GetDimension(const wxString& param, wxCoord defaultv = 0, + wxWindow* windowToUse = 0); /** Gets a font. */ - wxFont GetFont(); + wxFont GetFont(const wxString& param = "font"); /** Returns the XRCID. @@ -381,7 +415,9 @@ public: /** Returns an icon. */ - wxIcon GetIcon(const wxString& param = wxT("icon"), wxSize size = wxDefaultSize); + wxIcon GetIcon(const wxString& param = "icon", + const wxArtClient& defaultArtClient = wxART_OTHER, + wxSize size = wxDefaultSize); /** Gets the integer value from the parameter. @@ -416,7 +452,7 @@ public: /** Gets the size (may be in dialog units). */ - wxSize GetSize(const wxString& param = wxT("size")); + wxSize GetSize(const wxString& param = "size", wxWindow* windowToUse = 0); /** Gets style flags from text in form "flag | flag2| flag3 |..." @@ -431,7 +467,7 @@ public: translation because of XML syntax) - calls wxGetTranslations (unless disabled in wxXmlResource) */ - wxString GetText(const wxString& param); + wxString GetText(const wxString& param, bool translate = true); /** Check to see if a parameter exists. @@ -445,11 +481,6 @@ public: */ bool IsOfClass(wxXmlNode* node, const wxString& classname); - /** - Sets the parent resource. - */ - void SetParentResource(wxXmlResource* res); - /** Sets common window options. */