1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/xrc/xh_animatctrl.cpp
3 // Purpose: XML resource handler for wxAnimationCtrl
4 // Author: Francesco Montorsi
6 // Copyright: (c) 2006 Francesco Montorsi
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 // For compilers that support precompilation, includes "wx.h".
11 #include "wx/wxprec.h"
17 #if wxUSE_XRC && wxUSE_ANIMATIONCTRL
19 #include "wx/xrc/xh_animatctrl.h"
20 #include "wx/animate.h"
21 #include "wx/scopedptr.h"
23 IMPLEMENT_DYNAMIC_CLASS(wxAnimationCtrlXmlHandler
, wxXmlResourceHandler
)
25 wxAnimationCtrlXmlHandler::wxAnimationCtrlXmlHandler() : wxXmlResourceHandler()
27 XRC_ADD_STYLE(wxAC_NO_AUTORESIZE
);
28 XRC_ADD_STYLE(wxAC_DEFAULT_STYLE
);
32 wxObject
*wxAnimationCtrlXmlHandler::DoCreateResource()
34 XRC_MAKE_INSTANCE(ctrl
, wxAnimationCtrl
)
36 wxScopedPtr
<wxAnimation
> animation(GetAnimation(wxT("animation")));
38 ctrl
->Create(m_parentAsWindow
,
40 animation
? *animation
: wxNullAnimation
,
41 GetPosition(), GetSize(),
42 GetStyle(wxT("style"), wxAC_DEFAULT_STYLE
),
45 // if no inactive-bitmap has been provided, GetBitmap() will return wxNullBitmap
46 // which just tells wxAnimationCtrl to use the default for inactive status
47 ctrl
->SetInactiveBitmap(GetBitmap(wxT("inactive-bitmap")));
54 bool wxAnimationCtrlXmlHandler::CanHandle(wxXmlNode
*node
)
56 return IsOfClass(node
, wxT("wxAnimationCtrl"));
59 #endif // wxUSE_XRC && wxUSE_ANIMATIONCTRL