]>
Commit | Line | Data |
---|---|---|
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 | |
9e29cd0a RR |
6 | // Copyright: (c) 2006 Francesco Montorsi |
7 | // Licence: wxWindows licence | |
8 | ///////////////////////////////////////////////////////////////////////////// | |
9 | ||
10 | // For compilers that support precompilation, includes "wx.h". | |
11 | #include "wx/wxprec.h" | |
12 | ||
13 | #ifdef __BORLANDC__ | |
14 | #pragma hdrstop | |
15 | #endif | |
16 | ||
17 | #if wxUSE_XRC && wxUSE_ANIMATIONCTRL | |
18 | ||
19 | #include "wx/xrc/xh_animatctrl.h" | |
20 | #include "wx/animate.h" | |
bdb4b832 | 21 | #include "wx/scopedptr.h" |
9e29cd0a RR |
22 | |
23 | IMPLEMENT_DYNAMIC_CLASS(wxAnimationCtrlXmlHandler, wxXmlResourceHandler) | |
24 | ||
25 | wxAnimationCtrlXmlHandler::wxAnimationCtrlXmlHandler() : wxXmlResourceHandler() | |
26 | { | |
27 | XRC_ADD_STYLE(wxAC_NO_AUTORESIZE); | |
28 | XRC_ADD_STYLE(wxAC_DEFAULT_STYLE); | |
29 | AddWindowStyles(); | |
30 | } | |
31 | ||
32 | wxObject *wxAnimationCtrlXmlHandler::DoCreateResource() | |
33 | { | |
34 | XRC_MAKE_INSTANCE(ctrl, wxAnimationCtrl) | |
35 | ||
bdb4b832 VZ |
36 | wxScopedPtr<wxAnimation> animation(GetAnimation(wxT("animation"))); |
37 | ||
9e29cd0a RR |
38 | ctrl->Create(m_parentAsWindow, |
39 | GetID(), | |
bdb4b832 | 40 | animation ? *animation : wxNullAnimation, |
9e29cd0a | 41 | GetPosition(), GetSize(), |
9a83f860 | 42 | GetStyle(wxT("style"), wxAC_DEFAULT_STYLE), |
9e29cd0a RR |
43 | GetName()); |
44 | ||
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"))); | |
48 | ||
49 | SetupWindow(ctrl); | |
50 | ||
51 | return ctrl; | |
52 | } | |
53 | ||
54 | bool wxAnimationCtrlXmlHandler::CanHandle(wxXmlNode *node) | |
55 | { | |
56 | return IsOfClass(node, wxT("wxAnimationCtrl")); | |
57 | } | |
58 | ||
59 | #endif // wxUSE_XRC && wxUSE_ANIMATIONCTRL |