]> git.saurik.com Git - wxWidgets.git/blobdiff - contrib/src/xml/xh_toolb.cpp
added 'name' to wxEditableListBox ctor
[wxWidgets.git] / contrib / src / xml / xh_toolb.cpp
index 927642e64155b3cda0f26dc2d9d0bbe042b9b500..9b57f77986929778263f6f94fcf62f6b354022c0 100644 (file)
@@ -26,7 +26,7 @@
 #if wxUSE_TOOLBAR
 
 wxToolBarXmlHandler::wxToolBarXmlHandler() 
-: wxXmlResourceHandler(), m_IsInside(FALSE), m_Toolbar(NULL)
+: wxXmlResourceHandler(), m_isInside(FALSE), m_toolbar(NULL)
 {
     ADD_STYLE(wxTB_FLAT);
     ADD_STYLE(wxTB_DOCKABLE);
@@ -38,78 +38,79 @@ wxToolBarXmlHandler::wxToolBarXmlHandler()
 
 wxObject *wxToolBarXmlHandler::DoCreateResource()
 { 
-    if (m_Node->GetName() == _T("tool"))
+    if (m_class == wxT("tool"))
     {
-        wxCHECK_MSG(m_Toolbar, NULL, _T("Incorrect syntax of XML resource: tool not within a toolbar!"));
-        m_Toolbar->AddTool(GetID(),
-                           GetBitmap(_T("bitmap")),
-                           GetBitmap(_T("bitmap2")),
-                           GetBool(_T("toggle")),
+        wxCHECK_MSG(m_toolbar, NULL, wxT("Incorrect syntax of XML resource: tool not within a toolbar!"));
+        m_toolbar->AddTool(GetID(),
+                           GetBitmap(wxT("bitmap")),
+                           GetBitmap(wxT("bitmap2")),
+                           GetBool(wxT("toggle")),
                            GetPosition().x,
                            GetPosition().y,
                            NULL,
-                           GetText(_T("tooltip")),
-                           GetText(_T("longhelp")));
-        return m_Toolbar; // must return non-NULL
+                           GetText(wxT("tooltip")),
+                           GetText(wxT("longhelp")));
+        return m_toolbar; // must return non-NULL
     }
     
-    else if (m_Node->GetName() == _T("separator"))
+    else if (m_class == wxT("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
+        wxCHECK_MSG(m_toolbar, NULL, wxT("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);
+        int style = GetStyle(wxT("style"), wxNO_BORDER | wxTB_HORIZONTAL);
 #ifdef __WXMSW__
         if (!(style & wxNO_BORDER)) style |= wxNO_BORDER;
 #endif
-        wxToolBar *toolbar = new wxToolBar(m_ParentAsWindow,
+        wxToolBar *toolbar = new wxToolBar(m_parentAsWindow,
                                     GetID(),
                                     GetPosition(),
                                     GetSize(),
                                     style,
                                     GetName());
 
-        wxSize bmpsize = GetSize(_T("bitmapsize"));
+        wxSize bmpsize = GetSize(wxT("bitmapsize"));
         if (!(bmpsize == wxDefaultSize))
             toolbar->SetToolBitmapSize(bmpsize);
-        wxSize margins = GetSize(_T("margins"));
+        wxSize margins = GetSize(wxT("margins"));
         if (!(margins == wxDefaultSize))
             toolbar->SetMargins(margins.x, margins.y);
-        long packing = GetLong(_T("packing"), -1);
+        long packing = GetLong(wxT("packing"), -1);
         if (packing != -1)
             toolbar->SetToolPacking(packing);
-        long separation = GetLong(_T("separation"), -1);
+        long separation = GetLong(wxT("separation"), -1);
         if (separation != -1)
             toolbar->SetToolSeparation(separation);
 
-        wxXmlNode *children_node = GetParamNode(_T("children"));
+        wxXmlNode *children_node = GetParamNode(wxT("object"));
         if (children_node == NULL) return toolbar;
 
-        m_IsInside = TRUE;
-        m_Toolbar = 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() == wxT("object"))
             {
                 wxObject *created = CreateResFromNode(n, toolbar, NULL);
                 wxControl *control = wxDynamicCast(created, wxControl);
-                if (n->GetName() != _T("tool") &&
-                    n->GetName() != _T("separator") &&
+                if (IsOfClass(n, wxT("tool")) &&
+                    IsOfClass(n, wxT("separator")) &&
                     control != NULL)
                     toolbar->AddControl(control);
             }
             n = n->GetNext();
         }
 
-        m_IsInside = FALSE;
-        m_Toolbar = NULL;
+        m_isInside = FALSE;
+        m_toolbar = NULL;
 
         toolbar->Realize();
         return toolbar;
@@ -120,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, wxT("wxToolBar"))) ||
+            (m_isInside && IsOfClass(node, wxT("tool"))) || 
+            (m_isInside && IsOfClass(node, wxT("separator"))));
 }
 
 #endif