+public:
+ XRCWndClassData(const wxString& className,const wxString& parentClassName, const wxXmlNode* node) :
+ m_className(className) , m_parentClassName(parentClassName) {
+
+ BrowseXmlNode(node->GetChildren());
+
+ }
+
+ const ArrayOfXRCWidgetData& GetWidgetData(){
+ return m_wdata;
+ }
+ void GenerateHeaderCode(wxFFile& file){
+
+ file.Write(_T("class ") + m_className + _T(" : public ") + m_parentClassName
+ + _T(" {\nprotected:\n"));
+ for(size_t i=0;i<m_wdata.Count();++i){
+ const XRCWidgetData& w = m_wdata.Item(i);
+ file.Write(
+ _T(" ") + w.GetClass() + _T("* ") + w.GetName()
+ + _T(";\n"));
+ }
+ file.Write(_T("\nprivate:\n void InitWidgetsFromXRC(){\n")
+ _T(" wxXmlResource::Get()->LoadObject(this,NULL,\"")
+ + m_className
+ + +_T("\",\"")
+ + m_parentClassName
+ + _T("\");\n"));
+ for(size_t i=0;i<m_wdata.Count();++i){
+ const XRCWidgetData& w = m_wdata.Item(i);
+ file.Write(
+ _T(" ")
+ + w.GetName()
+ + _T(" = XRCCTRL(*this,\"")
+ + w.GetName()
+ + _T("\",")
+ + w.GetClass()
+ + _T(");\n")
+ );
+ }
+file.Write(_T(" }\n"));
+
+file.Write(
+ _T("public:\n")
+ + m_className
+ + _T("::")
+ + m_className
+ + _T("(){\n")
+ + _T(" InitWidgetsFromXRC();\n")
+ _T(" }\n")
+ _T("};\n"));
+ };
+};
+WX_DECLARE_OBJARRAY(XRCWndClassData,ArrayOfXRCWndClassData);
+WX_DEFINE_OBJARRAY(ArrayOfXRCWndClassData);
+
+
+class XmlResApp : public wxAppConsole
+{
+public:
+ // don't use builtin cmd line parsing:
+ virtual bool OnInit() { return true; }
+ virtual int OnRun();
+
+private: