This is the main class for interacting with the XML-based resource system.
The class holds XML resources from one or more .xml files, binary files or zip archive files.
See XML-based resource system overview for details.
Derived from
Include files
<wx/xrc/xmlres.h>
Data structures
enum wxXmlResourceFlags { wxXRC_USE_LOCALE = 1, wxXRC_NO_SUBCLASSING = 2 };Members
wxXmlResource::wxXmlResource
wxXmlResource::~wxXmlResource
wxXmlResource::AddHandler
wxXmlResource::AttachUnknownControl
wxXmlResource::ClearHandlers
wxXmlResource::CompareVersion
wxXmlResource::CreateResFromNode
wxXmlResource::DoFindResource
wxXmlResource::FindResource
wxXmlResource::Get
wxXmlResource::GetFlags
wxXmlResource::GetVersion
wxXmlResource::GetXRCID
wxXmlResource::InitAllHandlers
wxXmlResource::Load
wxXmlResource::LoadBitmap
wxXmlResource::LoadDialog
wxXmlResource::LoadFrame
wxXmlResource::LoadIcon
wxXmlResource::LoadMenu
wxXmlResource::LoadMenuBar
wxXmlResource::LoadPanel
wxXmlResource::LoadToolBar
wxXmlResource::Set
wxXmlResource::SetFlags
wxXmlResource::UpdateResources
wxXmlResource(const wxString& filemask, int flags = wxXRC_USE_LOCALE)
Constructor.
filemask
flags
wxXmlResource(int flags = wxXRC_USE_LOCALE)
Constructor.
flags
~wxXmlResource()
Destructor.
void AddHandler(wxXmlResourceHandler* handler)
Initializes only a specific handler (or custom handler). Convention says that the handler name is equal to the control's name plus 'XmlHandler', for example wxTextCtrlXmlHandler, wxHtmlWindowXmlHandler. The XML resource compiler (wxxrc) can create include file that contains initialization code for all controls used within the resource.
bool AttachUnknownControl(const wxString& name, wxWindow* control, wxWindow* parent = NULL)
Attaches an unknown control to the given panel/window/dialog. Unknown controls are used in conjunction with <object class="unknown">.
void ClearHandlers()
Removes all handlers.
int CompareVersion(int major, int minor, int release, int revision) const
Compares the XRC version to the argument. Returns -1 if the XRC version is less than the argument, +1 if greater, and 0 if they equal.
wxObject* CreateResFromNode(wxXmlNode* node, wxObject* parent, wxObject* instance = NULL)
Creates a resource from information in the given node.
wxXmlNode* DoFindResource(wxXmlNode* parent, const wxString& name, const wxString& classname, bool recursive)
Helper function: finds a resource (calls UpdateResources) and returns a node containing it.
wxXmlNode* FindResource(const wxString& name, const wxString& classname, bool recursive = false)
Finds a resource (calls UpdateResources) and returns a node containing it.
wxXmlResource* Get()
Gets the global resources object or creates one if none exists.
int GetFlags()
Returns flags, which may be a bitlist of wxXRC_USE_LOCALE and wxXRC_NO_SUBCLASSING.
long GetVersion() const
Returns version information (a.b.c.d = d+ 256*c + 2562*b + 2563*a).
int GetXRCID(const wxChar* str_id)
Returns a numeric ID that is equivalent to the string ID used in an XML resource. To be used in event tables. The macro XRCID(name) is provided for convenience.
void InitAllHandlers()
Initializes handlers for all supported controls/windows. This will make the executable quite big because it forces linking against most of the wxWidgets library.
bool Load(const wxString& filemask)
Loads resources from XML files that match given filemask. This method understands VFS (see filesys.h).
wxBitmap LoadBitmap(const wxString& name)
Loads a bitmap resource from a file.
wxDialog* LoadDialog(wxWindow* parent, const wxString& name)
Loads a dialog. dlg points to a parent window (if any).
bool LoadDialog(wxDialog* dlg, wxWindow* parent, const wxString& name)
Loads a dialog. dlg points to parent window (if any).
This form is used to finish creation of an already existing instance (the main reason for this is that you may want to use derived class with a new event table).
Example:
MyDialog dlg; wxTheXmlResource->LoadDialog(&dlg, mainFrame, "my_dialog"); dlg->ShowModal();
bool LoadFrame(wxFrame* frame, wxWindow* parent, const wxString& name)
Loads a frame.
wxIcon LoadIcon(const wxString& name)
Loads an icon resource from a file.
wxMenu* LoadMenu(const wxString& name)
Loads menu from resource. Returns NULL on failure.
wxMenuBar* LoadMenuBar(wxWindow* parent, const wxString& name)
Loads a menubar from resource. Returns NULL on failure.
wxMenuBar* LoadMenuBar(const wxString& name)
Loads a menubar from resource. Returns NULL on failure.
wxPanel* LoadPanel(wxWindow* parent, const wxString& name)
Loads a panel. panel points to parent window (if any).
bool LoadPanel(wxPanel* panel, wxWindow* parent, const wxString& name)
Loads a panel. panel points to parent window (if any). This form is used to finish creation of an already existing instance.
wxToolBar* LoadToolBar(wxWindow* parent, const wxString& name)
Loads a toolbar.
wxXmlResource* Set(wxXmlResource* res)
Sets the global resources object and returns a pointer to the previous one (may be NULL).
int SetFlags()
Sets flags (bitlist of wxXRC_USE_LOCALE and wxXRC_NO_SUBCLASSING).
void UpdateResources()
Scans the resources list for unloaded files and loads them. Also reloads files that have been modified since the last load.