+ XRCWidgetData(const wxString& vname,const wxString& vclass)
+ : m_class(vclass), m_name(vname) {}
+ const wxString& GetName() const { return m_name; }
+ const wxString& GetClass() const { return m_class; }
+private:
+ wxString m_class;
+ wxString m_name;
+};
+
+#include "wx/arrimpl.cpp"
+WX_DECLARE_OBJARRAY(XRCWidgetData,ArrayOfXRCWidgetData);
+WX_DEFINE_OBJARRAY(ArrayOfXRCWidgetData)
+
+class XRCWndClassData
+{
+private:
+ wxString m_className;
+ wxString m_parentClassName;
+ StringSet m_ancestorClassNames;
+ ArrayOfXRCWidgetData m_wdata;
+
+ void BrowseXmlNode(wxXmlNode* node)
+ {
+ wxString classValue;
+ wxString nameValue;
+ wxXmlNode* children;
+ while (node)
+ {
+ if (node->GetName() == wxT("object")
+ && node->GetAttribute(wxT("class"),&classValue)
+ && node->GetAttribute(wxT("name"),&nameValue))
+ {
+ m_wdata.Add(XRCWidgetData(nameValue,classValue));
+ }
+ children = node->GetChildren();
+ if (children)
+ BrowseXmlNode(children);
+ node = node->GetNext();
+ }
+ }
+
+public:
+ XRCWndClassData(const wxString& className,
+ const wxString& parentClassName,
+ const wxXmlNode* node) :
+ m_className(className) , m_parentClassName(parentClassName)
+ {
+ if ( className == wxT("wxMenu") )
+ {
+ m_ancestorClassNames.insert(wxT("wxMenu"));
+ m_ancestorClassNames.insert(wxT("wxMenuBar"));
+ }
+ else if ( className == wxT("wxMDIChildFrame") )
+ {
+ m_ancestorClassNames.insert(wxT("wxMDIParentFrame"));
+ }
+ else if( className == wxT("wxMenuBar") ||
+ className == wxT("wxStatusBar") ||
+ className == wxT("wxToolBar") )
+ {
+ m_ancestorClassNames.insert(wxT("wxFrame"));
+ }
+ else
+ {
+ m_ancestorClassNames.insert(wxT("wxWindow"));
+ }
+
+ BrowseXmlNode(node->GetChildren());
+ }
+
+ const ArrayOfXRCWidgetData& GetWidgetData()
+ {
+ return m_wdata;
+ }
+
+ bool CanBeUsedWithXRCCTRL(const wxString& name)
+ {
+ if (name == wxT("tool") ||
+ name == wxT("data") ||
+ name == wxT("unknown") ||
+ name == wxT("notebookpage") ||
+ name == wxT("separator") ||
+ name == wxT("sizeritem") ||
+ name == wxT("wxMenu") ||
+ name == wxT("wxMenuBar") ||
+ name == wxT("wxMenuItem") ||
+ name.EndsWith(wxT("Sizer")) )
+ {
+ return false;
+ }
+ return true;
+ }