]> git.saurik.com Git - wxWidgets.git/blobdiff - contrib/src/xrc/xh_sizer.cpp
Applied patch [ 809066 ] Cleanup for text2rtf
[wxWidgets.git] / contrib / src / xrc / xh_sizer.cpp
index 2420ff04eb59be7184274e98ffa55aa9d576fa43..eaeec961c29237c780a498936d1e5ba01eb35f2b 100644 (file)
 #include "wx/log.h"
 #include "wx/statbox.h"
 #include "wx/notebook.h"
 #include "wx/log.h"
 #include "wx/statbox.h"
 #include "wx/notebook.h"
+#include "wx/panel.h"
 #include "wx/tokenzr.h"
 
 #include "wx/tokenzr.h"
 
+IMPLEMENT_DYNAMIC_CLASS(wxSizerXmlHandler, wxXmlResourceHandler)
+
 bool wxSizerXmlHandler::IsSizerNode(wxXmlNode *node)
 {
     return (IsOfClass(node, wxT("wxBoxSizer"))) ||
 bool wxSizerXmlHandler::IsSizerNode(wxXmlNode *node)
 {
     return (IsOfClass(node, wxT("wxBoxSizer"))) ||
@@ -68,6 +71,8 @@ wxSizerXmlHandler::wxSizerXmlHandler()
     XRC_ADD_STYLE(wxALIGN_CENTRE_HORIZONTAL);
     XRC_ADD_STYLE(wxALIGN_CENTER_VERTICAL);
     XRC_ADD_STYLE(wxALIGN_CENTRE_VERTICAL);
     XRC_ADD_STYLE(wxALIGN_CENTRE_HORIZONTAL);
     XRC_ADD_STYLE(wxALIGN_CENTER_VERTICAL);
     XRC_ADD_STYLE(wxALIGN_CENTRE_VERTICAL);
+    
+    XRC_ADD_STYLE(wxADJUST_MINSIZE);
 }
 
 
 }
 
 
@@ -136,10 +141,12 @@ wxObject *wxSizerXmlHandler::DoCreateResource()
         wxXmlNode *parentNode = m_node->GetParent();
 
         wxCHECK_MSG(m_parentSizer != NULL ||
         wxXmlNode *parentNode = m_node->GetParent();
 
         wxCHECK_MSG(m_parentSizer != NULL ||
-                ((IsOfClass(parentNode, wxT("wxPanel")) ||
-                  IsOfClass(parentNode, wxT("wxFrame")) ||
-                  IsOfClass(parentNode, wxT("wxDialog"))) &&
-                 parentNode->GetType() == wxXML_ELEMENT_NODE), NULL,
+                (parentNode->GetType() == wxXML_ELEMENT_NODE &&
+                    m_parentAsWindow != NULL &&
+                    (m_parentAsWindow->IsKindOf(CLASSINFO(wxPanel)) ||
+                     m_parentAsWindow->IsKindOf(CLASSINFO(wxFrame)) ||
+                     m_parentAsWindow->IsKindOf(CLASSINFO(wxDialog)))
+                ), NULL,
                 wxT("Incorrect use of sizer: parent is not 'wxDialog', 'wxFrame' or 'wxPanel'."));
 
         if (m_class == wxT("wxBoxSizer"))
                 wxT("Incorrect use of sizer: parent is not 'wxDialog', 'wxFrame' or 'wxPanel'."));
 
         if (m_class == wxT("wxBoxSizer"))
@@ -148,7 +155,12 @@ wxObject *wxSizerXmlHandler::DoCreateResource()
         else if (m_class == wxT("wxStaticBoxSizer"))
         {
             sizer = new wxStaticBoxSizer(
         else if (m_class == wxT("wxStaticBoxSizer"))
         {
             sizer = new wxStaticBoxSizer(
-                         new wxStaticBox(m_parentAsWindow, -1, GetText(wxT("label"))),
+                         new wxStaticBox(m_parentAsWindow,
+                                         GetID(),
+                                         GetText(wxT("label")),
+                                         wxDefaultPosition, wxDefaultSize,
+                                         0/*style*/,
+                                         GetName()),
                          GetStyle(wxT("orient"), wxHORIZONTAL));
         }
         
                          GetStyle(wxT("orient"), wxHORIZONTAL));
         }