1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/xrc/xh_collpane.cpp
3 // Purpose: XML resource handler for wxCollapsiblePane
4 // Author: Francesco Montorsi
7 // Copyright: (c) 2006 Francesco Montorsi
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 // For compilers that support precompilation, includes "wx.h".
12 #include "wx/wxprec.h"
18 #if wxUSE_XRC && wxUSE_COLLPANE
24 #include "wx/collpane.h"
25 #include "wx/xrc/xh_collpane.h"
27 IMPLEMENT_DYNAMIC_CLASS(wxCollapsiblePaneXmlHandler
, wxXmlResourceHandler
)
29 wxCollapsiblePaneXmlHandler::wxCollapsiblePaneXmlHandler()
30 : wxXmlResourceHandler(), m_isInside(false)
32 XRC_ADD_STYLE(wxCP_NO_TLW_RESIZE
);
33 XRC_ADD_STYLE(wxCP_DEFAULT_STYLE
);
37 wxObject
*wxCollapsiblePaneXmlHandler::DoCreateResource()
39 if (m_class
== wxT("panewindow")) // read the XRC for the pane window
41 wxXmlNode
*n
= GetParamNode(wxT("object"));
44 n
= GetParamNode(wxT("object_ref"));
48 bool old_ins
= m_isInside
;
50 wxObject
*item
= CreateResFromNode(n
, m_collpane
->GetPane(), NULL
);
57 ReportError("no control within panewindow");
63 XRC_MAKE_INSTANCE(ctrl
, wxCollapsiblePane
)
65 wxString label
= GetParamValue(wxT("label"));
68 ReportParamError("label", "label cannot be empty");
72 ctrl
->Create(m_parentAsWindow
,
75 GetPosition(), GetSize(),
76 GetStyle(_T("style"), wxCP_DEFAULT_STYLE
),
80 ctrl
->Collapse(GetBool(_T("collapsed")));
83 wxCollapsiblePane
*old_par
= m_collpane
;
85 bool old_ins
= m_isInside
;
87 CreateChildren(m_collpane
, true/*only this handler*/);
95 bool wxCollapsiblePaneXmlHandler::CanHandle(wxXmlNode
*node
)
97 return IsOfClass(node
, wxT("wxCollapsiblePane")) ||
98 (m_isInside
&& IsOfClass(node
, wxT("panewindow")));
101 #endif // wxUSE_XRC && wxUSE_COLLPANE