- if (m_parentSizer == NULL) // setup window:
- {
- m_parentAsWindow->SetAutoLayout(TRUE);
- 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() & (wxRESIZE_BOX | wxRESIZE_BORDER))
- sizer->SetSizeHints(m_parentAsWindow);
+ return sizer;
+}
+
+
+wxSizer* wxSizerXmlHandler::Handle_wxBoxSizer()
+{
+ return new wxBoxSizer(GetStyle(wxT("orient"), wxHORIZONTAL));
+}
+
+wxSizer* wxSizerXmlHandler::Handle_wxStaticBoxSizer()
+{
+ return new wxStaticBoxSizer(
+ new wxStaticBox(m_parentAsWindow,
+ GetID(),
+ GetText(wxT("label")),
+ wxDefaultPosition, wxDefaultSize,
+ 0/*style*/,
+ GetName()),
+ GetStyle(wxT("orient"), wxHORIZONTAL));
+}
+
+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;
+}
+
+
+wxSizer* wxSizerXmlHandler::Handle_wxGridBagSizer()
+{
+ wxGridBagSizer *sizer =
+ new wxGridBagSizer(GetDimension(wxT("vgap")), GetDimension(wxT("hgap")));
+ SetGrowables(sizer, wxT("growablerows"), true);
+ SetGrowables(sizer, wxT("growablecols"), false);
+ return sizer;
+}
+
+
+
+
+void wxSizerXmlHandler::SetGrowables(wxFlexGridSizer* sizer,
+ const wxChar* param,
+ bool rows)
+{
+ wxStringTokenizer tkn;
+ unsigned long l;
+ tkn.SetString(GetParamValue(param), wxT(","));
+ while (tkn.HasMoreTokens())
+ {
+ if (!tkn.GetNextToken().ToULong(&l))
+ wxLogError(wxT("growable[rows|cols] must be comma-separated list of row numbers"));
+ else {
+ if (rows)
+ sizer->AddGrowableRow(l);
+ else
+ sizer->AddGrowableCol(l);