+
+
+//-----------------------------------------------------------------------------
+// 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
+