]> git.saurik.com Git - wxWidgets.git/blobdiff - contrib/src/xml/xh_toolb.cpp
test for bug with new wu-ftpd
[wxWidgets.git] / contrib / src / xml / xh_toolb.cpp
index d4c2887621f29e2b9579488db825ad196fc68f6a..0460be690c07843ea281893c058bd9c257c87592 100644 (file)
@@ -38,10 +38,10 @@ wxToolBarXmlHandler::wxToolBarXmlHandler()
 
 wxObject *wxToolBarXmlHandler::DoCreateResource()
 { 
-    if (m_Node->GetName() == _T("tool"))
+    if (m_Class == _T("tool"))
     {
         wxCHECK_MSG(m_Toolbar, NULL, _T("Incorrect syntax of XML resource: tool not within a toolbar!"));
-        m_Toolbar->AddTool(GetID(), 
+        m_Toolbar->AddTool(GetID(),
                            GetBitmap(_T("bitmap")),
                            GetBitmap(_T("bitmap2")),
                            GetBool(_T("toggle")),
@@ -53,21 +53,25 @@ wxObject *wxToolBarXmlHandler::DoCreateResource()
         return m_Toolbar; // must return non-NULL
     }
     
-    else if (m_Node->GetName() == _T("separator"))
+    else if (m_Class == _T("separator"))
     {
         wxCHECK_MSG(m_Toolbar, NULL, _T("Incorrect syntax of XML resource: separator not within a toolbar!"));
         m_Toolbar->AddSeparator();
         return m_Toolbar; // must return non-NULL
     }
     
-    else /*<toolbar>*/
+    else /*<object class="wxToolBar">*/
     {
+        int style = GetStyle(_T("style"), wxNO_BORDER | wxTB_HORIZONTAL);
+#ifdef __WXMSW__
+        if (!(style & wxNO_BORDER)) style |= wxNO_BORDER;
+#endif
         wxToolBar *toolbar = new wxToolBar(m_ParentAsWindow,
-                                           GetID(),
-                                           GetPosition(),
-                                           GetSize(),
-                                           GetStyle(),
-                                           GetName());
+                                    GetID(),
+                                    GetPosition(),
+                                    GetSize(),
+                                    style,
+                                    GetName());
 
         wxSize bmpsize = GetSize(_T("bitmapsize"));
         if (!(bmpsize == wxDefaultSize))
@@ -82,23 +86,23 @@ wxObject *wxToolBarXmlHandler::DoCreateResource()
         if (separation != -1)
             toolbar->SetToolSeparation(separation);
 
-
-        wxXmlNode *children_node = GetParamNode(_T("children"));
+        wxXmlNode *children_node = GetParamNode(_T("object"));
         if (children_node == NULL) return toolbar;
 
         m_IsInside = TRUE;
         m_Toolbar = toolbar;
 
-        wxXmlNode *n = children_node->GetChildren();
+        wxXmlNode *n = children_node;
 
         while (n)
         {
-            if (n->GetType() == wxXML_ELEMENT_NODE)
+            if (n->GetType() == wxXML_ELEMENT_NODE && 
+                n->GetName() == _T("object"))
             {
                 wxObject *created = CreateResFromNode(n, toolbar, NULL);
                 wxControl *control = wxDynamicCast(created, wxControl);
-                if (n->GetName() != _T("tool") &&
-                    n->GetName() != _T("separator") &&
+                if (IsOfClass(n, _T("tool")) &&
+                    IsOfClass(n, _T("separator")) &&
                     control != NULL)
                     toolbar->AddControl(control);
             }
@@ -117,9 +121,9 @@ wxObject *wxToolBarXmlHandler::DoCreateResource()
 
 bool wxToolBarXmlHandler::CanHandle(wxXmlNode *node)
 {
-    return ((!m_IsInside && node->GetName() == _T("toolbar")) ||
-            (m_IsInside && node->GetName() == _T("tool")) || 
-            (m_IsInside && node->GetName() == _T("separator")));
+    return ((!m_IsInside && IsOfClass(node, _T("wxToolBar"))) ||
+            (m_IsInside && IsOfClass(node, _T("tool"))) || 
+            (m_IsInside && IsOfClass(node, _T("separator"))));
 }
 
 #endif