]>
git.saurik.com Git - wxWidgets.git/blob - src/xrc/xh_notbk.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: XRC 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 IMPLEMENT_DYNAMIC_CLASS(wxNotebookXmlHandler
, wxXmlResourceHandler
)
32 wxNotebookXmlHandler::wxNotebookXmlHandler()
33 : wxXmlResourceHandler(), m_isInside(false), m_notebook(NULL
)
35 XRC_ADD_STYLE(wxNB_FIXEDWIDTH
);
36 XRC_ADD_STYLE(wxNB_LEFT
);
37 XRC_ADD_STYLE(wxNB_RIGHT
);
38 XRC_ADD_STYLE(wxNB_BOTTOM
);
42 wxObject
*wxNotebookXmlHandler::DoCreateResource()
44 if (m_class
== wxT("notebookpage"))
46 wxXmlNode
*n
= GetParamNode(wxT("object"));
49 n
= GetParamNode(wxT("object_ref"));
53 bool old_ins
= m_isInside
;
55 wxObject
*item
= CreateResFromNode(n
, m_notebook
, NULL
);
57 wxWindow
*wnd
= wxDynamicCast(item
, wxWindow
);
60 m_notebook
->AddPage(wnd
, GetText(wxT("label")),
61 GetBool(wxT("selected"), 0));
63 wxLogError(wxT("Error in resource."));
68 wxLogError(wxT("Error in resource: no control within notebook's <page> tag."));
75 XRC_MAKE_INSTANCE(nb
, wxNotebook
)
77 nb
->Create(m_parentAsWindow
,
79 GetPosition(), GetSize(),
80 GetStyle(wxT("style")),
83 wxNotebook
*old_par
= m_notebook
;
85 bool old_ins
= m_isInside
;
87 CreateChildren(m_notebook
, true/*only this handler*/);
95 bool wxNotebookXmlHandler::CanHandle(wxXmlNode
*node
)
97 return ((!m_isInside
&& IsOfClass(node
, wxT("wxNotebook"))) ||
98 (m_isInside
&& IsOfClass(node
, wxT("notebookpage"))));