// Returns a numeric ID that is equivalent to the string id used in an XML
// resource. To be used in event tables.
- // Macro XMLID is provided for convenience
- static int GetXMLID(const wxChar *str_id);
+ // Macro XRCID is provided for convenience
+ static int GetXRCID(const wxChar *str_id);
// Returns version information (a.b.c.d = d+ 256*c + 256^2*b + 256^3*a).
long GetVersion() const { return m_version; }
// 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)
// END_EVENT_TABLE()
-#define XMLID(str_id) \
- wxXmlResource::GetXMLID(wxT(str_id))
+#define XRCID(str_id) \
+ wxXmlResource::GetXRCID(wxT(str_id))
// This macro returns pointer to particular control in dialog
// Example:
// wxDialog dlg;
// wxXmlResource::Get()->LoadDialog(&dlg, mainFrame, "my_dialog");
-// XMLCTRL(dlg, "my_textctrl", wxTextCtrl)->SetValue(wxT("default value"));
+// XRCCTRL(dlg, "my_textctrl", wxTextCtrl)->SetValue(wxT("default value"));
#ifdef __WXDEBUG__
-#define XMLCTRL(window, id, type) \
- (wxDynamicCast((window).FindWindow(XMLID(id)), type))
+#define XRCCTRL(window, id, type) \
+ (wxDynamicCast((window).FindWindow(XRCID(id)), type))
#else
-#define XMLCTRL(window, id, type) \
- ((type*)((window).FindWindow(XMLID(id))))
+#define XRCCTRL(window, id, type) \
+ ((type*)((window).FindWindow(XRCID(id))))
#endif
// wxXmlResourceHandler is an abstract base class for resource handlers
// - calls wxGetTranslations (unless disabled in wxXmlResource)
wxString GetText(const wxString& param);
- // Returns the XMLID.
+ // Returns the XRCID.
int GetID();
// Returns the resource name.
------------------------------------------------------------------------- */
#define ADD_STYLE XRC_ADD_STYLE
#define wxTheXmlResource wxXmlResource::Get()
-
+#define XMLID XRCID
+#define XMLCTRL XRCCTRL
#endif // _WX_XMLRES_H_
// handlers) which process them. It can be also done at run-time, but for the
// simple menu events like this the static method is much simpler.
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
- EVT_MENU(XMLID("menu_quit"), MyFrame::OnQuit)
- EVT_MENU(XMLID("menu_about"), MyFrame::OnAbout)
- EVT_MENU(XMLID("menu_dlg1"), MyFrame::OnDlg1)
- EVT_MENU(XMLID("menu_dlg2"), MyFrame::OnDlg2)
+ EVT_MENU(XRCID("menu_quit"), MyFrame::OnQuit)
+ EVT_MENU(XRCID("menu_about"), MyFrame::OnAbout)
+ EVT_MENU(XRCID("menu_dlg1"), MyFrame::OnDlg1)
+ EVT_MENU(XRCID("menu_dlg2"), MyFrame::OnDlg2)
END_EVENT_TABLE()
// Create a new application object: this macro will allow wxWindows to create
SetBackgroundColour(m_bg);
child->SetName(m_controlName);
- child->SetId(wxXmlResource::GetXMLID(m_controlName));
+ child->SetId(wxXmlResource::GetXRCID(m_controlName));
m_controlAdded = TRUE;
wxSizer *sizer = new wxBoxSizer(wxHORIZONTAL);
stdID(wxID_DEFAULT); stdID(wxID_MORE); stdID(wxID_SETUP);
stdID(wxID_RESET); stdID(wxID_HELP_CONTEXT);
#undef stdID
- else return wxXmlResource::GetXMLID(sid);
+ else return wxXmlResource::GetXRCID(sid);
}
-// --------------- XMLID implementation -----------------------------
+// --------------- XRCID implementation -----------------------------
-#define XMLID_TABLE_SIZE 1024
+#define XRCID_TABLE_SIZE 1024
-struct XMLID_record
+struct XRCID_record
{
int id;
wxChar *key;
- XMLID_record *next;
+ XRCID_record *next;
};
-static XMLID_record *XMLID_Records[XMLID_TABLE_SIZE] = {NULL};
+static XRCID_record *XRCID_Records[XRCID_TABLE_SIZE] = {NULL};
-/*static*/ int wxXmlResource::GetXMLID(const wxChar *str_id)
+/*static*/ int wxXmlResource::GetXRCID(const wxChar *str_id)
{
- static int XMLID_LastID = wxID_HIGHEST;
+ static int XRCID_LastID = wxID_HIGHEST;
int index = 0;
for (const wxChar *c = str_id; *c != wxT('\0'); c++) index += (int)*c;
- index %= XMLID_TABLE_SIZE;
+ index %= XRCID_TABLE_SIZE;
- XMLID_record *oldrec = NULL;
+ XRCID_record *oldrec = NULL;
int matchcnt = 0;
- for (XMLID_record *rec = XMLID_Records[index]; rec; rec = rec->next)
+ for (XRCID_record *rec = XRCID_Records[index]; rec; rec = rec->next)
{
if (wxStrcmp(rec->key, str_id) == 0)
{
oldrec = rec;
}
- XMLID_record **rec_var = (oldrec == NULL) ?
- &XMLID_Records[index] : &oldrec->next;
- *rec_var = new XMLID_record;
- (*rec_var)->id = ++XMLID_LastID;
+ XRCID_record **rec_var = (oldrec == NULL) ?
+ &XRCID_Records[index] : &oldrec->next;
+ *rec_var = new XRCID_record;
+ (*rec_var)->id = ++XRCID_LastID;
(*rec_var)->key = wxStrdup(str_id);
(*rec_var)->next = NULL;
}
-static void CleanXMLID_Record(XMLID_record *rec)
+static void CleanXRCID_Record(XRCID_record *rec)
{
if (rec)
{
- CleanXMLID_Record(rec->next);
+ CleanXRCID_Record(rec->next);
free(rec->key);
delete rec;
}
}
-static void CleanXMLID_Records()
+static void CleanXRCID_Records()
{
- for (int i = 0; i < XMLID_TABLE_SIZE; i++)
- CleanXMLID_Record(XMLID_Records[i]);
+ for (int i = 0; i < XRCID_TABLE_SIZE; i++)
+ CleanXRCID_Record(XRCID_Records[i]);
}
void OnExit()
{
delete wxXmlResource::Set(NULL);
- CleanXMLID_Records();
+ CleanXRCID_Records();
}
};
-// --------------------- PropEditCtrlXMLID -----------------------------
+// --------------------- PropEditCtrlXRCID -----------------------------
#define REAL_NODE (NodeHandler::Find(GetNode())->GetRealNode(GetNode()))
-void PropEditCtrlXMLID::ReadValue()
+void PropEditCtrlXRCID::ReadValue()
{
m_TextCtrl->SetValue(REAL_NODE->GetPropVal(_T("name"), wxEmptyString));
}
-void PropEditCtrlXMLID::WriteValue()
+void PropEditCtrlXRCID::WriteValue()
{
wxString s =m_TextCtrl->GetValue();
if (s.IsEmpty()) s = _T("-1");
-void PropEditCtrlXMLID::Clear()
+void PropEditCtrlXRCID::Clear()
{
EndEdit();
REAL_NODE->DeleteProperty(_T("name"));
-void PropEditCtrlXMLID::OnDetails()
+void PropEditCtrlXRCID::OnDetails()
{
wxString choices[] = {wxString(_T("-1"))
#define stdID(id) , wxString(#id)
};
wxString s =
- wxGetSingleChoice(_("Choose from predefined IDs:"), _("XMLID"),
+ wxGetSingleChoice(_("Choose from predefined IDs:"), _("XRCID"),
38/*sizeof choices*/, choices);
if (!s) return;
m_TextCtrl->SetValue(s);
-wxString PropEditCtrlXMLID::GetValueAsText(wxTreeItemId ti)
+wxString PropEditCtrlXRCID::GetValueAsText(wxTreeItemId ti)
{
return REAL_NODE->GetPropVal(_T("name"), wxEmptyString);
}
-bool PropEditCtrlXMLID::IsPresent(const PropertyInfo& pinfo)
+bool PropEditCtrlXRCID::IsPresent(const PropertyInfo& pinfo)
{
return REAL_NODE->HasProp(_T("name"));
}
-class PropEditCtrlXMLID : public PropEditCtrlTxt
+class PropEditCtrlXRCID : public PropEditCtrlTxt
{
public:
- PropEditCtrlXMLID(PropertiesFrame *propFrame)
+ PropEditCtrlXRCID(PropertiesFrame *propFrame)
: PropEditCtrlTxt(propFrame) {}
virtual void ReadValue();
m_EditCtrls.Put(_T("integer"), new PropEditCtrlInt(this));
m_EditCtrls.Put(_T("not_implemented"), new PropEditCtrlNull(this));
m_EditCtrls.Put(_T("text"), new PropEditCtrlTxt(this));
- m_EditCtrls.Put(_T("xmlid"), new PropEditCtrlXMLID(this));
+ m_EditCtrls.Put(_T("xmlid"), new PropEditCtrlXRCID(this));
m_EditCtrls.Put(_T("font"), new PropEditCtrlFont(this));
m_EditCtrls.Put(_T("choice"), new PropEditCtrlChoice(this));
m_EditCtrls.Put(_T("file"), new PropEditCtrlFile(this));
m_Node = node;
ClearProps();
- AddSingleProp(PropertyInfo(_T("xmlid"), _T("XMLID"), wxEmptyString));
+ AddSingleProp(PropertyInfo(_T("xmlid"), _T("XRCID"), wxEmptyString));
AddProps(NodeHandler::Find(node)->GetPropsList(node));
m_tree->Expand(m_tree->GetRootItem());
// Returns a numeric ID that is equivalent to the string id used in an XML
// resource. To be used in event tables.
- // Macro XMLID is provided for convenience
- static int GetXMLID(const wxChar *str_id);
+ // Macro XRCID is provided for convenience
+ static int GetXRCID(const wxChar *str_id);
// Returns version information (a.b.c.d = d+ 256*c + 256^2*b + 256^3*a).
long GetVersion() const { return m_version; }
// 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)
// END_EVENT_TABLE()
-#define XMLID(str_id) \
- wxXmlResource::GetXMLID(wxT(str_id))
+#define XRCID(str_id) \
+ wxXmlResource::GetXRCID(wxT(str_id))
// This macro returns pointer to particular control in dialog
// Example:
// wxDialog dlg;
// wxXmlResource::Get()->LoadDialog(&dlg, mainFrame, "my_dialog");
-// XMLCTRL(dlg, "my_textctrl", wxTextCtrl)->SetValue(wxT("default value"));
+// XRCCTRL(dlg, "my_textctrl", wxTextCtrl)->SetValue(wxT("default value"));
#ifdef __WXDEBUG__
-#define XMLCTRL(window, id, type) \
- (wxDynamicCast((window).FindWindow(XMLID(id)), type))
+#define XRCCTRL(window, id, type) \
+ (wxDynamicCast((window).FindWindow(XRCID(id)), type))
#else
-#define XMLCTRL(window, id, type) \
- ((type*)((window).FindWindow(XMLID(id))))
+#define XRCCTRL(window, id, type) \
+ ((type*)((window).FindWindow(XRCID(id))))
#endif
// wxXmlResourceHandler is an abstract base class for resource handlers
// - calls wxGetTranslations (unless disabled in wxXmlResource)
wxString GetText(const wxString& param);
- // Returns the XMLID.
+ // Returns the XRCID.
int GetID();
// Returns the resource name.
------------------------------------------------------------------------- */
#define ADD_STYLE XRC_ADD_STYLE
#define wxTheXmlResource wxXmlResource::Get()
-
+#define XMLID XRCID
+#define XMLCTRL XRCCTRL
#endif // _WX_XMLRES_H_
// handlers) which process them. It can be also done at run-time, but for the
// simple menu events like this the static method is much simpler.
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
- EVT_MENU(XMLID("menu_quit"), MyFrame::OnQuit)
- EVT_MENU(XMLID("menu_about"), MyFrame::OnAbout)
- EVT_MENU(XMLID("menu_dlg1"), MyFrame::OnDlg1)
- EVT_MENU(XMLID("menu_dlg2"), MyFrame::OnDlg2)
+ EVT_MENU(XRCID("menu_quit"), MyFrame::OnQuit)
+ EVT_MENU(XRCID("menu_about"), MyFrame::OnAbout)
+ EVT_MENU(XRCID("menu_dlg1"), MyFrame::OnDlg1)
+ EVT_MENU(XRCID("menu_dlg2"), MyFrame::OnDlg2)
END_EVENT_TABLE()
// Create a new application object: this macro will allow wxWindows to create
SetBackgroundColour(m_bg);
child->SetName(m_controlName);
- child->SetId(wxXmlResource::GetXMLID(m_controlName));
+ child->SetId(wxXmlResource::GetXRCID(m_controlName));
m_controlAdded = TRUE;
wxSizer *sizer = new wxBoxSizer(wxHORIZONTAL);
stdID(wxID_DEFAULT); stdID(wxID_MORE); stdID(wxID_SETUP);
stdID(wxID_RESET); stdID(wxID_HELP_CONTEXT);
#undef stdID
- else return wxXmlResource::GetXMLID(sid);
+ else return wxXmlResource::GetXRCID(sid);
}
-// --------------- XMLID implementation -----------------------------
+// --------------- XRCID implementation -----------------------------
-#define XMLID_TABLE_SIZE 1024
+#define XRCID_TABLE_SIZE 1024
-struct XMLID_record
+struct XRCID_record
{
int id;
wxChar *key;
- XMLID_record *next;
+ XRCID_record *next;
};
-static XMLID_record *XMLID_Records[XMLID_TABLE_SIZE] = {NULL};
+static XRCID_record *XRCID_Records[XRCID_TABLE_SIZE] = {NULL};
-/*static*/ int wxXmlResource::GetXMLID(const wxChar *str_id)
+/*static*/ int wxXmlResource::GetXRCID(const wxChar *str_id)
{
- static int XMLID_LastID = wxID_HIGHEST;
+ static int XRCID_LastID = wxID_HIGHEST;
int index = 0;
for (const wxChar *c = str_id; *c != wxT('\0'); c++) index += (int)*c;
- index %= XMLID_TABLE_SIZE;
+ index %= XRCID_TABLE_SIZE;
- XMLID_record *oldrec = NULL;
+ XRCID_record *oldrec = NULL;
int matchcnt = 0;
- for (XMLID_record *rec = XMLID_Records[index]; rec; rec = rec->next)
+ for (XRCID_record *rec = XRCID_Records[index]; rec; rec = rec->next)
{
if (wxStrcmp(rec->key, str_id) == 0)
{
oldrec = rec;
}
- XMLID_record **rec_var = (oldrec == NULL) ?
- &XMLID_Records[index] : &oldrec->next;
- *rec_var = new XMLID_record;
- (*rec_var)->id = ++XMLID_LastID;
+ XRCID_record **rec_var = (oldrec == NULL) ?
+ &XRCID_Records[index] : &oldrec->next;
+ *rec_var = new XRCID_record;
+ (*rec_var)->id = ++XRCID_LastID;
(*rec_var)->key = wxStrdup(str_id);
(*rec_var)->next = NULL;
}
-static void CleanXMLID_Record(XMLID_record *rec)
+static void CleanXRCID_Record(XRCID_record *rec)
{
if (rec)
{
- CleanXMLID_Record(rec->next);
+ CleanXRCID_Record(rec->next);
free(rec->key);
delete rec;
}
}
-static void CleanXMLID_Records()
+static void CleanXRCID_Records()
{
- for (int i = 0; i < XMLID_TABLE_SIZE; i++)
- CleanXMLID_Record(XMLID_Records[i]);
+ for (int i = 0; i < XRCID_TABLE_SIZE; i++)
+ CleanXRCID_Record(XRCID_Records[i]);
}
void OnExit()
{
delete wxXmlResource::Set(NULL);
- CleanXMLID_Records();
+ CleanXRCID_Records();
}
};