// Flags: wxXRC_USE_LOCALE
// translatable strings will be translated via _()
// wxXRC_NO_SUBCLASSING
// subclass property of object nodes will be ignored
// (useful for previews in XRC editors)
wxXmlResource(int flags = wxXRC_USE_LOCALE);
// Flags: wxXRC_USE_LOCALE
// translatable strings will be translated via _()
// wxXRC_NO_SUBCLASSING
// subclass property of object nodes will be ignored
// (useful for previews in XRC editors)
wxXmlResource(int flags = wxXRC_USE_LOCALE);
+
+ // Constructor.
+ // Flags: wxXRC_USE_LOCALE
+ // translatable strings will be translated via _()
+ // wxXRC_NO_SUBCLASSING
+ // subclass property of object nodes will be ignored
+ // (useful for previews in XRC editors)
// Initialize handlers for all supported controls/windows. This will
// make the executable quite big because it forces linking against
// Initialize handlers for all supported controls/windows. This will
// make the executable quite big because it forces linking against
- // Initialize only specific handler (or custom handler). Convention says
- // that handler name is equal to control's name plus 'XmlHandler', e.g.
- // wxTextCtrlXmlHandler, wxHtmlWindowXmlHandler. XML resource compiler
+ // Initialize only a specific handler (or custom handler). Convention says
+ // that handler name is equal to the control's name plus 'XmlHandler', for example
+ // wxTextCtrlXmlHandler, wxHtmlWindowXmlHandler. The XML resource compiler
// (xmlres) can create include file that contains initialization code for
// all controls used within the resource.
void AddHandler(wxXmlResourceHandler *handler);
// (xmlres) can create include file that contains initialization code for
// all controls used within the resource.
void AddHandler(wxXmlResourceHandler *handler);
// Loads menubar from resource. Returns NULL on failure.
wxMenuBar *LoadMenuBar(wxWindow *parent, const wxString& name);
// Loads menubar from resource. Returns NULL on failure.
wxMenuBar *LoadMenuBar(wxWindow *parent, const wxString& name);
- // Loads dialog. dlg points to parent window (if any). Second form
+ // Loads a dialog. dlg points to parent window (if any).
+ wxDialog *LoadDialog(wxWindow *parent, const wxString& name);
+
+ // Loads a dialog. dlg points to parent window (if any). This form
// is used to finish creation of already existing instance (main reason
// for this is that you may want to use derived class with new event table)
// Example (typical usage):
// MyDialog dlg;
// wxTheXmlResource->LoadDialog(&dlg, mainFrame, "my_dialog");
// dlg->ShowModal();
// is used to finish creation of already existing instance (main reason
// for this is that you may want to use derived class with new event table)
// Example (typical usage):
// MyDialog dlg;
// wxTheXmlResource->LoadDialog(&dlg, mainFrame, "my_dialog");
// dlg->ShowModal();
- // Attaches unknown control into given panel/window/dialog:
- // (unknown controls are used in conjunction with <object class="unknown">)
+ // Attaches an unknown control to the given panel/window/dialog.
+ // Unknown controls are used in conjunction with <object class="unknown">.
bool AttachUnknownControl(const wxString& name, wxWindow *control,
wxWindow *parent = NULL);
bool AttachUnknownControl(const wxString& name, wxWindow *control,
wxWindow *parent = NULL);
- // Returns numeric ID that is equivalent to string id used in XML
- // resource. To be used in event tables
- // Macro XMLID is provided for convenience
- static int GetXMLID(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.
+ // Macro XRCID is provided for convenience
+ static int GetXRCID(const wxChar *str_id);
long GetVersion() const { return m_version; }
// Compares resources version to argument. Returns -1 if resources version
long GetVersion() const { return m_version; }
// Compares resources version to argument. Returns -1 if resources version
wxXmlNode *DoFindResource(wxXmlNode *parent, const wxString& name, const wxString& classname, bool recursive);
wxXmlNode *DoFindResource(wxXmlNode *parent, const wxString& name, const wxString& classname, bool recursive);
// wxWindows event tables.
// Example:
// BEGIN_EVENT_TABLE(MyFrame, wxFrame)
// wxWindows event tables.
// Example:
// BEGIN_EVENT_TABLE(MyFrame, wxFrame)
-// EVT_MENU(XMLID("quit"), MyFrame::OnQuit)
-// EVT_MENU(XMLID("about"), MyFrame::OnAbout)
-// EVT_MENU(XMLID("new"), MyFrame::OnNew)
-// EVT_MENU(XMLID("open"), MyFrame::OnOpen)
+// EVT_MENU(XRCID("quit"), MyFrame::OnQuit)
+// EVT_MENU(XRCID("about"), MyFrame::OnAbout)
+// EVT_MENU(XRCID("new"), MyFrame::OnNew)
+// EVT_MENU(XRCID("open"), MyFrame::OnOpen)
-#define XMLCTRL(window, id, type) \
- (wxDynamicCast((window).FindWindow(XMLID(id)), type))
+#define XRCCTRL(window, id, type) \
+ (wxDynamicCast((window).FindWindow(XRCID(id)), type))
-#define XMLCTRL(window, id, type) \
- ((type*)((window).FindWindow(XMLID(id))))
+#define XRCCTRL(window, id, type) \
+ ((type*)((window).FindWindow(XRCID(id))))
- // Creates object (menu, dialog, control, ...) from XML node.
+ // Creates an object (menu, dialog, control, ...) from an XML node.
- // parent is higher-level object (usually window, dialog or panel)
- // that is often neccessary to create resource
- // if instance != NULL it should not create new instance via 'new' but
- // rather use this one and call its Create method
+ // parent is a higher-level object (usually window, dialog or panel)
+ // that is often neccessary to create the resource.
+ // If 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);
// This one is called from CreateResource after variables
wxObject *CreateResource(wxXmlNode *node, wxObject *parent,
wxObject *instance);
// This one is called from CreateResource after variables
- // Returns true if the node has property class equal to classname,
- // e.g. <object class="wxDialog">
+ // Returns true if the node has a property class equal to classname,
+ // e.g. <object class="wxDialog">.
bool IsOfClass(wxXmlNode *node, const wxString& classname)
{ return node->GetPropVal(wxT("class"), wxEmptyString) == classname; }
// Gets node content from wxXML_ENTITY_NODE
bool IsOfClass(wxXmlNode *node, const wxString& classname)
{ return node->GetPropVal(wxT("class"), wxEmptyString) == classname; }
// Gets node content from wxXML_ENTITY_NODE
// wxXML_ENTITY_NODE name="tag", content=""
// |-- wxXML_TEXT_NODE or
// wxXML_CDATA_SECTION_NODE name="" content="content"
wxString GetNodeContent(wxXmlNode *node);
// wxXML_ENTITY_NODE name="tag", content=""
// |-- wxXML_TEXT_NODE or
// wxXML_CDATA_SECTION_NODE name="" content="content"
wxString GetNodeContent(wxXmlNode *node);
void AddWindowStyles();
// Gets style flags from text in form "flag | flag2| flag3 |..."
// Only understads flags added with AddStyle
int GetStyle(const wxString& param = wxT("style"), int defaults = 0);
void AddWindowStyles();
// Gets style flags from text in form "flag | flag2| flag3 |..."
// Only understads flags added with AddStyle
int GetStyle(const wxString& param = wxT("style"), int defaults = 0);
- // Get bool flag (1,t,yes,on,true are TRUE, everything else is FALSE)
+ // Gets a bool flag (1, t, yes, on, true are TRUE, everything else is FALSE).
wxObject *CreateResFromNode(wxXmlNode *node,
wxObject *parent, wxObject *instance = NULL)
{ return m_resource->CreateResFromNode(node, parent, instance); }
wxObject *CreateResFromNode(wxXmlNode *node,
wxObject *parent, wxObject *instance = NULL)
{ return m_resource->CreateResFromNode(node, parent, instance); }
------------------------------------------------------------------------- */
#define ADD_STYLE XRC_ADD_STYLE
#define wxTheXmlResource wxXmlResource::Get()
------------------------------------------------------------------------- */
#define ADD_STYLE XRC_ADD_STYLE
#define wxTheXmlResource wxXmlResource::Get()