1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/xrc/xh_collpane.cpp
3 // Purpose: XML resource handler for wxCollapsiblePane
4 // Author: Francesco Montorsi
6 // Copyright: (c) 2006 Francesco Montorsi
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 // For compilers that support precompilation, includes "wx.h".
11 #include "wx/wxprec.h"
17 #if wxUSE_XRC && wxUSE_COLLPANE
23 #include "wx/collpane.h"
24 #include "wx/xrc/xh_collpane.h"
26 IMPLEMENT_DYNAMIC_CLASS(wxCollapsiblePaneXmlHandler
, wxXmlResourceHandler
)
28 wxCollapsiblePaneXmlHandler::wxCollapsiblePaneXmlHandler()
29 : wxXmlResourceHandler(), m_isInside(false)
31 XRC_ADD_STYLE(wxCP_NO_TLW_RESIZE
);
32 XRC_ADD_STYLE(wxCP_DEFAULT_STYLE
);
36 wxObject
*wxCollapsiblePaneXmlHandler::DoCreateResource()
38 if (m_class
== wxT("panewindow")) // read the XRC for the pane window
40 wxXmlNode
*n
= GetParamNode(wxT("object"));
43 n
= GetParamNode(wxT("object_ref"));
47 bool old_ins
= m_isInside
;
49 wxObject
*item
= CreateResFromNode(n
, m_collpane
->GetPane(), NULL
);
56 ReportError("no control within panewindow");
62 XRC_MAKE_INSTANCE(ctrl
, wxCollapsiblePane
)
64 wxString label
= GetParamValue(wxT("label"));
67 ReportParamError("label", "label cannot be empty");
71 ctrl
->Create(m_parentAsWindow
,
74 GetPosition(), GetSize(),
75 GetStyle(wxT("style"), wxCP_DEFAULT_STYLE
),
79 ctrl
->Collapse(GetBool(wxT("collapsed")));
82 wxCollapsiblePane
*old_par
= m_collpane
;
84 bool old_ins
= m_isInside
;
86 CreateChildren(m_collpane
, true/*only this handler*/);
94 bool wxCollapsiblePaneXmlHandler::CanHandle(wxXmlNode
*node
)
96 return IsOfClass(node
, wxT("wxCollapsiblePane")) ||
97 (m_isInside
&& IsOfClass(node
, wxT("panewindow")));
100 #endif // wxUSE_XRC && wxUSE_COLLPANE