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
20 #include "wx/xrc/xh_collpane.h"
23 IMPLEMENT_DYNAMIC_CLASS(wxCollapsiblePaneXmlHandler
, wxXmlResourceHandler
)
25 wxCollapsiblePaneXmlHandler
::wxCollapsiblePaneXmlHandler() : wxXmlResourceHandler()
27 XRC_ADD_STYLE(wxCP_NO_TLW_RESIZE
);
28 XRC_ADD_STYLE(wxCP_DEFAULT_STYLE
);
32 wxObject
*wxCollapsiblePaneXmlHandler
::DoCreateResource()
34 if (m_class
== wxT("panewindow")) // read the XRC for the pane window
36 wxXmlNode
*n
= GetParamNode(wxT("object"));
39 n
= GetParamNode(wxT("object_ref"));
43 bool old_ins
= m_isInside
;
45 wxObject
*item
= CreateResFromNode(n
, m_collpane
->GetPane(), NULL
);
52 wxLogError(wxT("Error in resource: no control within collapsible pane's <panewindow> tag."));
58 XRC_MAKE_INSTANCE(ctrl
, wxCollapsiblePane
)
60 wxString label
= GetParamValue(wxT("label"));
63 wxLogError(wxT("Error in resource: empty label for wxCollapsiblePane"));
67 ctrl
->Create(m_parentAsWindow
,
70 GetPosition(), GetSize(),
71 GetStyle(_T("style"), wxCP_DEFAULT_STYLE
),
75 ctrl
->Collapse(GetBool(_T("collapsed")));
78 wxCollapsiblePane
*old_par
= m_collpane
;
80 bool old_ins
= m_isInside
;
82 CreateChildren(m_collpane
, true/*only this handler*/);
90 bool wxCollapsiblePaneXmlHandler
::CanHandle(wxXmlNode
*node
)
92 return IsOfClass(node
, wxT("wxCollapsiblePane")) ||
93 (m_isInside
&& IsOfClass(node
, wxT("panewindow")));
96 #endif // wxUSE_XRC && wxUSE_COLLPANE