1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/xrc/xh_auinotbk.cpp
3 // Purpose: XML resource handler for wxAuiNotebook
4 // Author: Steve Lamerton
6 // Copyright: (c) 2009 Steve Lamerton
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 // For compilers that support precompilation, includes "wx.h".
11 #include "wx/wxprec.h"
17 #if wxUSE_XRC && wxUSE_AUI
19 #include "wx/xrc/xh_auinotbk.h"
20 #include "wx/aui/auibook.h"
22 wxIMPLEMENT_DYNAMIC_CLASS(wxAuiNotebookXmlHandler
, wxXmlResourceHandler
);
24 wxAuiNotebookXmlHandler::wxAuiNotebookXmlHandler()
25 : wxXmlResourceHandler()
27 XRC_ADD_STYLE(wxAUI_NB_DEFAULT_STYLE
);
28 XRC_ADD_STYLE(wxAUI_NB_TAB_SPLIT
);
29 XRC_ADD_STYLE(wxAUI_NB_TAB_MOVE
);
30 XRC_ADD_STYLE(wxAUI_NB_TAB_EXTERNAL_MOVE
);
31 XRC_ADD_STYLE(wxAUI_NB_TAB_FIXED_WIDTH
);
32 XRC_ADD_STYLE(wxAUI_NB_SCROLL_BUTTONS
);
33 XRC_ADD_STYLE(wxAUI_NB_WINDOWLIST_BUTTON
);
34 XRC_ADD_STYLE(wxAUI_NB_CLOSE_BUTTON
);
35 XRC_ADD_STYLE(wxAUI_NB_CLOSE_ON_ACTIVE_TAB
);
36 XRC_ADD_STYLE(wxAUI_NB_CLOSE_ON_ALL_TABS
);
37 XRC_ADD_STYLE(wxAUI_NB_TOP
);
38 XRC_ADD_STYLE(wxAUI_NB_BOTTOM
);
43 wxObject
*wxAuiNotebookXmlHandler::DoCreateResource()
45 if (m_class
== wxT("notebookpage"))
47 wxXmlNode
*anb
= GetParamNode(wxT("object"));
50 anb
= GetParamNode(wxT("object_ref"));
54 bool old_ins
= m_isInside
;
56 wxObject
*item
= CreateResFromNode(anb
, m_notebook
, NULL
);
58 wxWindow
*wnd
= wxDynamicCast(item
, wxWindow
);
62 if ( HasParam(wxT("bitmap")) )
64 m_notebook
->AddPage(wnd
,
65 GetText(wxT("label")),
66 GetBool(wxT("selected")),
67 GetBitmap(wxT("bitmap"), wxART_OTHER
));
71 m_notebook
->AddPage(wnd
,
72 GetText(wxT("label")),
73 GetBool(wxT("selected")));
78 ReportError(anb
, "notebookpage child must be a window");
84 ReportError("notebookpage must have a window child");
90 XRC_MAKE_INSTANCE(anb
, wxAuiNotebook
)
92 anb
->Create(m_parentAsWindow
,
96 GetStyle(wxT("style")));
100 wxAuiNotebook
*old_par
= m_notebook
;
102 bool old_ins
= m_isInside
;
104 CreateChildren(m_notebook
, true/*only this handler*/);
105 m_isInside
= old_ins
;
106 m_notebook
= old_par
;
112 bool wxAuiNotebookXmlHandler::CanHandle(wxXmlNode
*node
)
114 return ((!m_isInside
&& IsOfClass(node
, wxT("wxAuiNotebook"))) ||
115 (m_isInside
&& IsOfClass(node
, wxT("notebookpage"))));
118 #endif // wxUSE_XRC && wxUSE_ANIMATIONCTRL