1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/xrc/xh_animatctrl.cpp
3 // Purpose: XML resource handler for wxAnimationCtrl
4 // Author: Francesco Montorsi
7 // Copyright: (c) 2006 Francesco Montorsi
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 // For compilers that support precompilation, includes "wx.h".
12 #include "wx/wxprec.h"
18 #if wxUSE_XRC && wxUSE_ANIMATIONCTRL
20 #include "wx/xrc/xh_animatctrl.h"
21 #include "wx/animate.h"
22 #include "wx/scopedptr.h"
24 IMPLEMENT_DYNAMIC_CLASS(wxAnimationCtrlXmlHandler
, wxXmlResourceHandler
)
26 wxAnimationCtrlXmlHandler::wxAnimationCtrlXmlHandler() : wxXmlResourceHandler()
28 XRC_ADD_STYLE(wxAC_NO_AUTORESIZE
);
29 XRC_ADD_STYLE(wxAC_DEFAULT_STYLE
);
33 wxObject
*wxAnimationCtrlXmlHandler::DoCreateResource()
35 XRC_MAKE_INSTANCE(ctrl
, wxAnimationCtrl
)
37 wxScopedPtr
<wxAnimation
> animation(GetAnimation(wxT("animation")));
39 ctrl
->Create(m_parentAsWindow
,
41 animation
? *animation
: wxNullAnimation
,
42 GetPosition(), GetSize(),
43 GetStyle(wxT("style"), wxAC_DEFAULT_STYLE
),
46 // if no inactive-bitmap has been provided, GetBitmap() will return wxNullBitmap
47 // which just tells wxAnimationCtrl to use the default for inactive status
48 ctrl
->SetInactiveBitmap(GetBitmap(wxT("inactive-bitmap")));
55 bool wxAnimationCtrlXmlHandler::CanHandle(wxXmlNode
*node
)
57 return IsOfClass(node
, wxT("wxAnimationCtrl"));
60 #endif // wxUSE_XRC && wxUSE_ANIMATIONCTRL