]>
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 #if wxUSE_XRC && wxUSE_NOTEBOOK
24 #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_TOP
);
39 XRC_ADD_STYLE(wxNB_BOTTOM
);
43 wxObject
*wxNotebookXmlHandler::DoCreateResource()
45 if (m_class
== wxT("notebookpage"))
47 wxXmlNode
*n
= GetParamNode(wxT("object"));
50 n
= GetParamNode(wxT("object_ref"));
54 bool old_ins
= m_isInside
;
56 wxObject
*item
= CreateResFromNode(n
, m_notebook
, NULL
);
58 wxWindow
*wnd
= wxDynamicCast(item
, wxWindow
);
61 m_notebook
->AddPage(wnd
, GetText(wxT("label")),
62 GetBool(wxT("selected"), 0));
64 wxLogError(wxT("Error in resource."));
69 wxLogError(wxT("Error in resource: no control within notebook's <page> tag."));
76 XRC_MAKE_INSTANCE(nb
, wxNotebook
)
78 nb
->Create(m_parentAsWindow
,
80 GetPosition(), GetSize(),
81 GetStyle(wxT("style")),
84 wxNotebook
*old_par
= m_notebook
;
86 bool old_ins
= m_isInside
;
88 CreateChildren(m_notebook
, true/*only this handler*/);
96 bool wxNotebookXmlHandler::CanHandle(wxXmlNode
*node
)
98 return ((!m_isInside
&& IsOfClass(node
, wxT("wxNotebook"))) ||
99 (m_isInside
&& IsOfClass(node
, wxT("notebookpage"))));
102 #endif // wxUSE_XRC && wxUSE_NOTEBOOK