1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/xrc/xh_auinotbk.cpp
3 // Purpose: XML resource handler for wxAuiNotebook
4 // Author: Steve Lamerton
7 // Copyright: (c) 2009 Steve Lamerton
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 // For compilers that support precompilation, includes "wx.h".
12 #include "wx/wxprec.h"
18 #if wxUSE_XRC && wxUSE_AUI
20 #include "wx/xrc/xh_auinotbk.h"
21 #include "wx/aui/auibook.h"
23 wxIMPLEMENT_DYNAMIC_CLASS(wxAuiNotebookXmlHandler
, wxXmlResourceHandler
);
25 wxAuiNotebookXmlHandler::wxAuiNotebookXmlHandler()
26 : wxXmlResourceHandler()
28 XRC_ADD_STYLE(wxAUI_NB_DEFAULT_STYLE
);
29 XRC_ADD_STYLE(wxAUI_NB_TAB_SPLIT
);
30 XRC_ADD_STYLE(wxAUI_NB_TAB_MOVE
);
31 XRC_ADD_STYLE(wxAUI_NB_TAB_EXTERNAL_MOVE
);
32 XRC_ADD_STYLE(wxAUI_NB_TAB_FIXED_WIDTH
);
33 XRC_ADD_STYLE(wxAUI_NB_SCROLL_BUTTONS
);
34 XRC_ADD_STYLE(wxAUI_NB_WINDOWLIST_BUTTON
);
35 XRC_ADD_STYLE(wxAUI_NB_CLOSE_BUTTON
);
36 XRC_ADD_STYLE(wxAUI_NB_CLOSE_ON_ACTIVE_TAB
);
37 XRC_ADD_STYLE(wxAUI_NB_CLOSE_ON_ALL_TABS
);
38 XRC_ADD_STYLE(wxAUI_NB_TOP
);
39 XRC_ADD_STYLE(wxAUI_NB_BOTTOM
);
44 wxObject
*wxAuiNotebookXmlHandler::DoCreateResource()
46 if (m_class
== wxT("notebookpage"))
48 wxXmlNode
*anb
= GetParamNode(wxT("object"));
51 anb
= GetParamNode(wxT("object_ref"));
55 bool old_ins
= m_isInside
;
57 wxObject
*item
= CreateResFromNode(anb
, m_notebook
, NULL
);
59 wxWindow
*wnd
= wxDynamicCast(item
, wxWindow
);
63 if ( HasParam(wxT("bitmap")) )
65 m_notebook
->AddPage(wnd
,
66 GetText(wxT("label")),
67 GetBool(wxT("selected")),
68 GetBitmap(wxT("bitmap"), wxART_OTHER
));
72 m_notebook
->AddPage(wnd
,
73 GetText(wxT("label")),
74 GetBool(wxT("selected")));
79 ReportError(anb
, "notebookpage child must be a window");
85 ReportError("notebookpage must have a window child");
91 XRC_MAKE_INSTANCE(anb
, wxAuiNotebook
)
93 anb
->Create(m_parentAsWindow
,
97 GetStyle(wxT("style")));
101 wxAuiNotebook
*old_par
= m_notebook
;
103 bool old_ins
= m_isInside
;
105 CreateChildren(m_notebook
, true/*only this handler*/);
106 m_isInside
= old_ins
;
107 m_notebook
= old_par
;
113 bool wxAuiNotebookXmlHandler::CanHandle(wxXmlNode
*node
)
115 return ((!m_isInside
&& IsOfClass(node
, wxT("wxAuiNotebook"))) ||
116 (m_isInside
&& IsOfClass(node
, wxT("notebookpage"))));
119 #endif // wxUSE_XRC && wxUSE_ANIMATIONCTRL