]>
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 wxNotebookXmlHandler::wxNotebookXmlHandler()
31 : wxXmlResourceHandler(), m_isInside(FALSE
), m_notebook(NULL
)
33 XRC_ADD_STYLE(wxNB_FIXEDWIDTH
);
34 XRC_ADD_STYLE(wxNB_LEFT
);
35 XRC_ADD_STYLE(wxNB_RIGHT
);
36 XRC_ADD_STYLE(wxNB_BOTTOM
);
40 wxObject
*wxNotebookXmlHandler::DoCreateResource()
42 if (m_class
== wxT("notebookpage"))
44 wxXmlNode
*n
= GetParamNode(wxT("object"));
47 n
= GetParamNode(wxT("object_ref"));
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(wxT("label")),
59 GetBool(wxT("selected"), 0));
61 wxLogError(wxT("Error in resource."));
66 wxLogError(wxT("Error in resource: no control within notebook's <page> tag."));
73 XRC_MAKE_INSTANCE(nb
, wxNotebook
)
75 nb
->Create(m_parentAsWindow
,
77 GetPosition(), GetSize(),
78 GetStyle(wxT("style")),
81 wxNotebook
*old_par
= m_notebook
;
83 bool old_ins
= m_isInside
;
85 CreateChildren(m_notebook
, TRUE
/*only this handler*/);
89 if (GetBool(wxT("usenotebooksizer"), FALSE
))
90 return new wxNotebookSizer(nb
);
96 bool wxNotebookXmlHandler::CanHandle(wxXmlNode
*node
)
98 return ((!m_isInside
&& IsOfClass(node
, wxT("wxNotebook"))) ||
99 (m_isInside
&& IsOfClass(node
, wxT("notebookpage"))));