+wxObject* wxSizerXmlHandler::Handle_sizer()
+{
+ wxSizer *sizer = NULL;
+
+ wxXmlNode *parentNode = m_node->GetParent();
+
+ wxCHECK_MSG(m_parentSizer != NULL ||
+ (parentNode && parentNode->GetType() == wxXML_ELEMENT_NODE &&
+ m_parentAsWindow), NULL,
+ wxT("Sizer must have a window parent node"));
+
+ if (m_class == wxT("wxBoxSizer"))
+ sizer = Handle_wxBoxSizer();
+
+#if wxUSE_STATBOX
+ else if (m_class == wxT("wxStaticBoxSizer"))
+ sizer = Handle_wxStaticBoxSizer();
+#endif
+
+ else if (m_class == wxT("wxGridSizer"))
+ sizer = Handle_wxGridSizer();
+
+ else if (m_class == wxT("wxFlexGridSizer"))
+ sizer = Handle_wxFlexGridSizer();
+
+ else if (m_class == wxT("wxGridBagSizer"))
+ sizer = Handle_wxGridBagSizer();
+
+ if ( !sizer )
+ {
+ wxLogError(_T("Failed to create size of class \"%s\""), m_class.c_str());
+ return NULL;
+ }
+
+ wxSize minsize = GetSize(wxT("minsize"));
+ if (!(minsize == wxDefaultSize))
+ sizer->SetMinSize(minsize);
+
+ // save state
+ wxSizer *old_par = m_parentSizer;
+ bool old_ins = m_isInside;
+
+ // set new state
+ m_parentSizer = sizer;
+ m_isInside = true;
+ m_isGBS = (m_class == wxT("wxGridBagSizer"));
+
+ CreateChildren(m_parent, true/*only this handler*/);
+
+ // restore state
+ m_isInside = old_ins;
+ m_parentSizer = old_par;
+
+ if (m_parentSizer == NULL) // setup window:
+ {
+ m_parentAsWindow->SetSizer(sizer);
+
+ wxXmlNode *nd = m_node;
+ m_node = parentNode;
+ if (GetSize() == wxDefaultSize)
+ sizer->Fit(m_parentAsWindow);
+ m_node = nd;
+
+ if (m_parentAsWindow->GetWindowStyle() & (wxMAXIMIZE_BOX | wxRESIZE_BORDER))
+ sizer->SetSizeHints(m_parentAsWindow);
+ }
+
+ return sizer;
+}
+
+
+wxSizer* wxSizerXmlHandler::Handle_wxBoxSizer()
+{
+ return new wxBoxSizer(GetStyle(wxT("orient"), wxHORIZONTAL));
+}
+
+#if wxUSE_STATBOX
+wxSizer* wxSizerXmlHandler::Handle_wxStaticBoxSizer()
+{
+ return new wxStaticBoxSizer(
+ new wxStaticBox(m_parentAsWindow,
+ GetID(),
+ GetText(wxT("label")),
+ wxDefaultPosition, wxDefaultSize,
+ 0/*style*/,
+ GetName()),
+ GetStyle(wxT("orient"), wxHORIZONTAL));
+}
+#endif // wxUSE_STATBOX
+
+wxSizer* wxSizerXmlHandler::Handle_wxGridSizer()
+{
+ return new wxGridSizer(GetLong(wxT("rows")), GetLong(wxT("cols")),
+ GetDimension(wxT("vgap")), GetDimension(wxT("hgap")));
+}
+
+
+wxSizer* wxSizerXmlHandler::Handle_wxFlexGridSizer()
+{
+ wxFlexGridSizer *sizer =
+ new wxFlexGridSizer(GetLong(wxT("rows")), GetLong(wxT("cols")),
+ GetDimension(wxT("vgap")), GetDimension(wxT("hgap")));
+ SetGrowables(sizer, wxT("growablerows"), true);
+ SetGrowables(sizer, wxT("growablecols"), false);
+ return sizer;
+}