wxObject* wxSizerXmlHandler::Handle_sizer()
{
wxSizer *sizer = NULL;
+ wxFlexGridSizer *flexsizer = NULL;
wxXmlNode *parentNode = m_node->GetParent();
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();
-
+ {
+ flexsizer = Handle_wxFlexGridSizer();
+ sizer = flexsizer;
+ }
else if (m_class == wxT("wxGridBagSizer"))
- sizer = Handle_wxGridBagSizer();
-
+ {
+ flexsizer = Handle_wxGridBagSizer();
+ sizer = flexsizer;
+ }
else if (m_class == wxT("wxWrapSizer"))
sizer = Handle_wxWrapSizer();
CreateChildren(m_parent, true/*only this handler*/);
+ // set growable rows and cols for sizers which support this
+ if ( flexsizer )
+ {
+ SetGrowables(flexsizer, wxT("growablerows"), true);
+ SetGrowables(flexsizer, wxT("growablecols"), false);
+ }
+
// restore state
m_isInside = old_ins;
m_parentSizer = old_par;
}
-wxSizer* wxSizerXmlHandler::Handle_wxFlexGridSizer()
+wxFlexGridSizer* 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;
+ return new wxFlexGridSizer(GetLong(wxT("rows")), GetLong(wxT("cols")),
+ GetDimension(wxT("vgap")), GetDimension(wxT("hgap")));
}
-wxSizer* wxSizerXmlHandler::Handle_wxGridBagSizer()
+wxGridBagSizer* 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;
+ return new wxGridBagSizer(GetDimension(wxT("vgap")), GetDimension(wxT("hgap")));
}
wxSizer* wxSizerXmlHandler::Handle_wxWrapSizer()
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);
+ break;
}
+
+ if (rows)
+ sizer->AddGrowableRow(l);
+ else
+ sizer->AddGrowableCol(l);
}
}