wxxmlresourcethis 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> constants
enum wxxmlresourceflags { wxxrc_use_locale = 1, wxxrc_no_subclassing = 2, wxxrc_no_reloading = 4 };members
wxxmlresource::wxxmlresource
wxxmlresource::wxxmlresourcewxxmlresource(const wxstring& filemask, int flags = wxxrc_use_locale, const wxstringdomain = wxemptystring) constructor. filemask
flags
domain
wxxmlresource(int flags = wxxrc_use_locale, const wxstringdomain = wxemptystring) constructor. flags
domain
wxxmlresource::~wxxmlresource~wxxmlresource() destructor.
wxxmlresource::addhandlervoid 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. note that this handler should be allocated on the heap, since it will be delete by clearhandlers later.
wxxmlresource::attachunknowncontrolbool 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">.
wxxmlresource::clearhandlersvoid clearhandlers() removes all handlers and deletes them (this means that any handlers added using addhandler must be allocated on the heap).
wxxmlresource::compareversionint 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.
wxxmlresource::getwxxmlresource* get() gets the global resources object or creates one if none exists.
wxxmlresource::getflagsint getflags() returns flags, which may be a bitlist of wxxrc_use_locale and wxxrc_no_subclassing.
wxxmlresource::getversionlong getversion() const returns version information (a.b.c.d = d+ 256*c + 2562*b + 2563*a).
wxxmlresource::getxrcidint getxrcid(const wxchar* str_id, int value_if_not_found = -2) returns a numeric id that is equivalent to the string id used in an xml resource. if an unknown str_id is requested (i.e. other than wxid_xxx or integer), a new record is created which associates the given string with a number. if value_if_not_found is wxid_none, the number is obtained via wxnewid(). otherwise value_if_not_found is used. macro xrcid(name) is provided for convenient use in event tables.
wxxmlresource::initallhandlersvoid 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.
wxxmlresource::loadbool load(const wxstring& filemask) loads resources from xml files that match given filemask. this method understands vfs (see filesys.h).
wxxmlresource::loadbitmapwxbitmap loadbitmap(const wxstring& name) loads a bitmap resource from a file.
wxxmlresource::loaddialogwxdialog* 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(); wxxmlresource::loadframebool loadframe(wxframe* frame, wxwindow* parent, const wxstring& name) loads a frame.
wxxmlresource::loadiconwxicon loadicon(const wxstring& name) loads an icon resource from a file.
wxxmlresource::loadmenuwxmenu* loadmenu(const wxstring& name) loads menu from resource. returns null on failure.
wxxmlresource::loadmenubarwxmenubar* 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.
wxxmlresource::loadpanelwxpanel* 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.
wxxmlresource::loadtoolbarwxtoolbar* loadtoolbar(wxwindow* parent, const wxstring& name) loads a toolbar.
wxxmlresource::setwxxmlresource* set(wxxmlresource* res) sets the global resources object and returns a pointer to the previous one (may be null).
wxxmlresource::setflagsvoid setflags(int flags) sets flags (bitlist of wxxrc_use_locale and wxxrc_no_subclassing).
wxxmlresource::unloadbool unload(const wxstring& filename) this function unloads a resource previously loaded by load(). returns true if the resource was successfully unloaded and false if it hasn't been found in the list of loaded resources.
wxxmlresource::getdomainwxchar* getdomain() returns the domain (message catalog) that will be used to load translatable strings in the xrc.
wxxmlresource::setdomainwxchar* setdomain(const wxchar* domain) sets the domain (message catalog) that will be used to load translatable strings in the xrc.
|