]>
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_Class
== _T("notebookpage"))
46 wxXmlNode
*n
= GetParamNode(_T("object"));
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."));
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
&& IsOfClass(node
, _T("wxNotebook"))) ||
97 (m_IsInside
&& IsOfClass(node
, _T("notebookpage"))));