]>
git.saurik.com Git - wxWidgets.git/blob - contrib/src/xml/xh_notbk.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: XML resource for wxBoxSizer
4 // Author: Vaclav Slavik
7 // Copyright: (c) 2000 Vaclav Slavik
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
12 #pragma implementation "xh_notbk.h"
15 // For compilers that support precompilation, includes "wx.h".
16 #include "wx/wxprec.h"
22 #include "wx/xml/xh_notbk.h"
27 #include "wx/notebook.h"
29 wxNotebookXmlHandler::wxNotebookXmlHandler()
30 : wxXmlResourceHandler(), m_IsInside(FALSE
), m_Notebook(NULL
)
32 ADD_STYLE(wxNB_FIXEDWIDTH
);
34 ADD_STYLE(wxNB_RIGHT
);
35 ADD_STYLE(wxNB_BOTTOM
);
40 wxObject
*wxNotebookXmlHandler::DoCreateResource()
42 if (m_Node
->GetName() == _T("page"))
44 wxXmlNode
*n
= GetParamNode(_T("child"))->GetChildren();
47 if (n
->GetType() == wxXML_ELEMENT_NODE
)
49 bool old_ins
= m_IsInside
;
52 wxObject
*item
= CreateResFromNode(n
, m_Notebook
, NULL
);
53 wxWindow
*wnd
= wxDynamicCast(item
, wxWindow
);
56 m_Notebook
->AddPage(wnd
, GetText(_T("label")),
57 GetBool(_T("selected"), 0));
59 wxLogError(_T("Error in resource."));
64 wxLogError(_T("Error in resource: no control within notebook's <page> tag."));
69 wxNotebook
*nb
= new wxNotebook(m_ParentAsWindow
,
71 GetPosition(), GetSize(),
72 GetStyle( _T("style" )),
75 wxNotebook
*old_par
= m_Notebook
;
77 bool old_ins
= m_IsInside
;
79 CreateChildren(m_Notebook
, TRUE
/*only this handler*/);
89 bool wxNotebookXmlHandler::CanHandle(wxXmlNode
*node
)
91 return ((!m_IsInside
&& node
->GetName() == _T("notebook")) ||
92 (m_IsInside
&& node
->GetName() == _T("page")));