+
+
+
+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")));
+ }
+
+ // record the id of the item, if any, for use by XRCSIZERITEM()
+ sitem->SetId(GetID());
+}
+
+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
+ ReportError(n, "expected wxButton");
+
+ return item;
+ }
+ else /*n == NULL*/
+ {
+ ReportError("no button within wxStdDialogButtonSizer");
+ return NULL;
+ }
+ }
+}
+
+bool wxStdDialogButtonSizerXmlHandler::CanHandle(wxXmlNode *node)
+{
+ return (!m_isInside && IsOfClass(node, wxT("wxStdDialogButtonSizer"))) ||
+ (m_isInside && IsOfClass(node, wxT("button")));
+}
+#endif // wxUSE_BUTTON
+
+#endif // wxUSE_XRC