]>
git.saurik.com Git - wxWidgets.git/blob - contrib/src/xrc/xh_notbk.cpp
fe648dc114d940f4f68e52cc28205a358d88a85f
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/xrc/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
== wxT("notebookpage"))
46 wxXmlNode
*n
= GetParamNode(wxT("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(wxT("label")),
58 GetBool(wxT("selected"), 0));
60 wxLogError(wxT("Error in resource."));
65 wxLogError(wxT("Error in resource: no control within notebook's <page> tag."));
71 wxNotebook
*nb
= new wxNotebook(m_parentAsWindow
,
73 GetPosition(), GetSize(),
74 GetStyle( wxT("style" )),
77 wxNotebook
*old_par
= m_notebook
;
79 bool old_ins
= m_isInside
;
81 CreateChildren(m_notebook
, TRUE
/*only this handler*/);
85 if (GetBool(wxT("usenotebooksizer"), FALSE
))
86 return new wxNotebookSizer(nb
);
94 bool wxNotebookXmlHandler::CanHandle(wxXmlNode
*node
)
96 return ((!m_isInside
&& IsOfClass(node
, wxT("wxNotebook"))) ||
97 (m_isInside
&& IsOfClass(node
, wxT("notebookpage"))));