]>
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
);
42 wxObject
*wxNotebookXmlHandler::DoCreateResource()
44 if (m_Node
->GetName() == _T("notebookpage"))
46 wxXmlNode
*n
= GetParamNode(_T("window"))->GetChildren();
49 if (n
->GetType() == wxXML_ELEMENT_NODE
)
51 bool old_ins
= m_IsInside
;
54 wxObject
*item
= CreateResFromNode(n
, m_Notebook
, NULL
);
55 wxWindow
*wnd
= wxDynamicCast(item
, wxWindow
);
58 m_Notebook
->AddPage(wnd
, GetText(_T("label")),
59 GetBool(_T("selected"), 0));
61 wxLogError(_T("Error in resource."));
66 wxLogError(_T("Error in resource: no control within notebook's <page> tag."));
71 wxNotebook
*nb
= new wxNotebook(m_ParentAsWindow
,
73 GetPosition(), GetSize(),
74 GetStyle( _T("style" )),
77 wxNotebook
*old_par
= m_Notebook
;
79 bool old_ins
= m_IsInside
;
81 CreateChildren(m_Notebook
, TRUE
/*only this handler*/);
85 if (GetBool(_T("usenotebooksizer"), FALSE
))
86 return new wxNotebookSizer(nb
);
94 bool wxNotebookXmlHandler::CanHandle(wxXmlNode
*node
)
96 return ((!m_IsInside
&& node
->GetName() == _T("notebook")) ||
97 (m_IsInside
&& node
->GetName() == _T("notebookpage")));