class wxXmlResource : public wxObject
{
public:
- //@{
/**
Constructor.
wxXmlResource(const wxString& filemask,
int flags = wxXRC_USE_LOCALE,
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);
- //@}
/**
Destructor.
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
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).
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
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.
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.
*/
/**
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).
/**
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.
/**
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.
/**
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 |..."
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.
*/
bool IsOfClass(wxXmlNode* node, const wxString& classname);
- /**
- Sets the parent resource.
- */
- void SetParentResource(wxXmlResource* res);
-
/**
Sets common window options.
*/