]> git.saurik.com Git - wxWidgets.git/blame - src/xrc/xh_animatctrl.cpp
add wrappers to avoid compiling code which will never be used
[wxWidgets.git] / src / xrc / xh_animatctrl.cpp
CommitLineData
9e29cd0a
RR
1/////////////////////////////////////////////////////////////////////////////
2// Name: src/xrc/xh_animatctrl.cpp
3// Purpose: XML resource handler for wxAnimationCtrl
4// Author: Francesco Montorsi
5// Created: 2006-10-15
6// RCS-ID: $Id$
7// Copyright: (c) 2006 Francesco Montorsi
8// Licence: wxWindows licence
9/////////////////////////////////////////////////////////////////////////////
10
11// For compilers that support precompilation, includes "wx.h".
12#include "wx/wxprec.h"
13
14#ifdef __BORLANDC__
15 #pragma hdrstop
16#endif
17
18#if wxUSE_XRC && wxUSE_ANIMATIONCTRL
19
20#include "wx/xrc/xh_animatctrl.h"
21#include "wx/animate.h"
bdb4b832 22#include "wx/scopedptr.h"
9e29cd0a
RR
23
24IMPLEMENT_DYNAMIC_CLASS(wxAnimationCtrlXmlHandler, wxXmlResourceHandler)
25
26wxAnimationCtrlXmlHandler::wxAnimationCtrlXmlHandler() : wxXmlResourceHandler()
27{
28 XRC_ADD_STYLE(wxAC_NO_AUTORESIZE);
29 XRC_ADD_STYLE(wxAC_DEFAULT_STYLE);
30 AddWindowStyles();
31}
32
33wxObject *wxAnimationCtrlXmlHandler::DoCreateResource()
34{
35 XRC_MAKE_INSTANCE(ctrl, wxAnimationCtrl)
36
bdb4b832
VZ
37 wxScopedPtr<wxAnimation> animation(GetAnimation(wxT("animation")));
38
9e29cd0a
RR
39 ctrl->Create(m_parentAsWindow,
40 GetID(),
bdb4b832 41 animation ? *animation : wxNullAnimation,
9e29cd0a 42 GetPosition(), GetSize(),
9a83f860 43 GetStyle(wxT("style"), wxAC_DEFAULT_STYLE),
9e29cd0a
RR
44 GetName());
45
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")));
49
50 SetupWindow(ctrl);
51
52 return ctrl;
53}
54
55bool wxAnimationCtrlXmlHandler::CanHandle(wxXmlNode *node)
56{
57 return IsOfClass(node, wxT("wxAnimationCtrl"));
58}
59
60#endif // wxUSE_XRC && wxUSE_ANIMATIONCTRL