]>
git.saurik.com Git - wxWidgets.git/blob - contrib/src/xml/xh_notbk.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: XML resource for wxNotebook
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"
30 wxNotebookXmlHandler::wxNotebookXmlHandler()
31 : wxXmlResourceHandler(), m_IsInside(FALSE
), m_Notebook(NULL
)
33 ADD_STYLE(wxNB_FIXEDWIDTH
);
35 ADD_STYLE(wxNB_RIGHT
);
36 ADD_STYLE(wxNB_BOTTOM
);
41 wxObject
*wxNotebookXmlHandler::DoCreateResource()
43 if (m_Node
->GetName() == _T("notebookpage"))
45 wxXmlNode
*n
= GetParamNode(_T("window"))->GetChildren();
48 if (n
->GetType() == wxXML_ELEMENT_NODE
)
50 bool old_ins
= m_IsInside
;
53 wxObject
*item
= CreateResFromNode(n
, m_Notebook
, NULL
);
54 wxWindow
*wnd
= wxDynamicCast(item
, wxWindow
);
57 m_Notebook
->AddPage(wnd
, GetText(_T("label")),
58 GetBool(_T("selected"), 0));
60 wxLogError(_T("Error in resource."));
65 wxLogError(_T("Error in resource: no control within notebook's <page> tag."));
70 wxNotebook
*nb
= new wxNotebook(m_ParentAsWindow
,
72 GetPosition(), GetSize(),
73 GetStyle( _T("style" )),
76 wxNotebook
*old_par
= m_Notebook
;
78 bool old_ins
= m_IsInside
;
80 CreateChildren(m_Notebook
, TRUE
/*only this handler*/);
84 if (GetBool(_T("usenotebooksizer"), FALSE
))
85 return new wxNotebookSizer(nb
);
93 bool wxNotebookXmlHandler::CanHandle(wxXmlNode
*node
)
95 return ((!m_IsInside
&& node
->GetName() == _T("notebook")) ||
96 (m_IsInside
&& node
->GetName() == _T("notebookpage")));