+wxGBSpan wxSizerXmlHandler::GetGBSpan(const wxString& param)
+{
+ wxSize sz = GetSize(param);
+ if (sz.x < 1) sz.x = 1;
+ if (sz.y < 1) sz.y = 1;
+ return wxGBSpan(sz.x, sz.y);
+}
+
+
+
+wxSizerItem* wxSizerXmlHandler::MakeSizerItem()
+{
+ if (m_isGBS)
+ return new wxGBSizerItem();
+ else
+ return new wxSizerItem();
+}
+
+void wxSizerXmlHandler::SetSizerItemAttributes(wxSizerItem* sitem)
+{
+ sitem->SetProportion(GetLong(wxT("option"))); // Should this check for "proportion" too?
+ sitem->SetFlag(GetStyle(wxT("flag")));
+ sitem->SetBorder(GetDimension(wxT("border")));
+ wxSize sz = GetSize(wxT("minsize"));
+ if (!(sz == wxDefaultSize))
+ sitem->SetMinSize(sz);
+ sz = GetSize(wxT("ratio"));
+ if (!(sz == wxDefaultSize))
+ sitem->SetRatio(sz);
+
+ if (m_isGBS)
+ {
+ wxGBSizerItem* gbsitem = (wxGBSizerItem*)sitem;
+ gbsitem->SetPos(GetGBPos(wxT("cellpos")));
+ gbsitem->SetSpan(GetGBSpan(wxT("cellspan")));
+ }
+}
+
+void wxSizerXmlHandler::AddSizerItem(wxSizerItem* sitem)
+{
+ if (m_isGBS)
+ ((wxGridBagSizer*)m_parentSizer)->Add((wxGBSizerItem*)sitem);
+ else
+ m_parentSizer->Add(sitem);
+}
+
+
+
+//-----------------------------------------------------------------------------
+// wxStdDialogButtonSizerXmlHandler
+//-----------------------------------------------------------------------------
+#if wxUSE_BUTTON
+
+IMPLEMENT_DYNAMIC_CLASS(wxStdDialogButtonSizerXmlHandler, wxXmlResourceHandler)
+
+wxStdDialogButtonSizerXmlHandler::wxStdDialogButtonSizerXmlHandler()
+ : m_isInside(false), m_parentSizer(NULL)
+{
+}
+
+wxObject *wxStdDialogButtonSizerXmlHandler::DoCreateResource()
+{
+ if (m_class == wxT("wxStdDialogButtonSizer"))
+ {
+ wxASSERT( !m_parentSizer );
+
+ wxSizer *s = m_parentSizer = new wxStdDialogButtonSizer;
+ m_isInside = true;
+
+ CreateChildren(m_parent, true/*only this handler*/);
+
+ m_parentSizer->Realize();
+
+ m_isInside = false;
+ m_parentSizer = NULL;
+
+ return s;
+ }
+ else // m_class == "button"
+ {
+ wxASSERT( m_parentSizer );
+
+ // find the item to be managed by this sizeritem
+ wxXmlNode *n = GetParamNode(wxT("object"));
+ if ( !n )
+ n = GetParamNode(wxT("object_ref"));
+
+ // did we find one?
+ if (n)
+ {
+ wxObject *item = CreateResFromNode(n, m_parent, NULL);
+ wxButton *button = wxDynamicCast(item, wxButton);
+
+ if (button)
+ m_parentSizer->AddButton(button);
+ else
+ wxLogError(wxT("Error in resource - expected button."));
+
+ return item;
+ }
+ else /*n == NULL*/
+ {
+ wxLogError(wxT("Error in resource: no button within wxStdDialogButtonSizer."));
+ return NULL;
+ }
+ }
+}
+
+bool wxStdDialogButtonSizerXmlHandler::CanHandle(wxXmlNode *node)