<!-- ====================================================================== -->
<set var="XRC_SRC" hints="files">
+ src/xrc/xh_animatctrl.cpp
src/xrc/xh_bmp.cpp
src/xrc/xh_bmpcbox.cpp
src/xrc/xh_bmpbt.cpp
</set>
<set var="XRC_HDR" hints="files">
wx/xrc/xh_all.h
+ wx/xrc/xh_animatctrl.h
wx/xrc/xh_bmpbt.h
wx/xrc/xh_bmp.h
wx/xrc/xh_bmpcbox.h
#include "wx/xrc/xh_dirpicker.h"
#include "wx/xrc/xh_hyperlink.h"
#include "wx/xrc/xh_bmpcbox.h"
+#include "wx/xrc/xh_animatctrl.h"
#endif // _WX_XH_ALL_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_animatctrl.h
+// Purpose: XML resource handler for wxAnimationCtrl
+// Author: Francesco Montorsi
+// Created: 2006-10-15
+// RCS-ID: $Id$
+// Copyright: (c) 2006 Francesco Montorsi
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_ANIMATIONCTRL_H_
+#define _WX_XH_ANIMATIONCTRL_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_ANIMATIONCTRL
+
+class WXDLLIMPEXP_XRC wxAnimationCtrlXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxAnimationCtrlXmlHandler)
+
+public:
+ wxAnimationCtrlXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+};
+
+#endif // wxUSE_XRC && wxUSE_ANIMATIONCTRL
+
+#endif // _WX_XH_ANIMATIONCTRL_H_
#include "wx/icon.h"
#include "wx/artprov.h"
#include "wx/colour.h"
+#include "wx/animate.h"
#include "wx/xml/xml.h"
// Destructor.
virtual ~wxXmlResource();
+ wxXmlNode *GetFirstRoot();
+
// Loads resources from XML files that match given filemask.
// This method understands VFS (see filesys.h).
bool Load(const wxString& filemask);
const wxArtClient& defaultArtClient = wxART_OTHER,
wxSize size = wxDefaultSize);
+#if wxUSE_ANIMATIONCTRL
+ // Gets an animation.
+ wxAnimation GetAnimation(const wxString& param = wxT("animation"));
+#endif
+
// Gets a font.
wxFont GetFont(const wxString& param = wxT("font"));
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: src/xrc/xh_animatctrl.cpp
+// Purpose: XML resource handler for wxAnimationCtrl
+// Author: Francesco Montorsi
+// Created: 2006-10-15
+// RCS-ID: $Id$
+// Copyright: (c) 2006 Francesco Montorsi
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#if wxUSE_XRC && wxUSE_ANIMATIONCTRL
+
+#include "wx/xrc/xh_animatctrl.h"
+#include "wx/animate.h"
+
+IMPLEMENT_DYNAMIC_CLASS(wxAnimationCtrlXmlHandler, wxXmlResourceHandler)
+
+wxAnimationCtrlXmlHandler::wxAnimationCtrlXmlHandler() : wxXmlResourceHandler()
+{
+ XRC_ADD_STYLE(wxAC_NO_AUTORESIZE);
+ XRC_ADD_STYLE(wxAC_DEFAULT_STYLE);
+ AddWindowStyles();
+}
+
+wxObject *wxAnimationCtrlXmlHandler::DoCreateResource()
+{
+ XRC_MAKE_INSTANCE(ctrl, wxAnimationCtrl)
+
+ ctrl->Create(m_parentAsWindow,
+ GetID(),
+ GetAnimation(wxT("animation")),
+ GetPosition(), GetSize(),
+ GetStyle(_T("style"), wxAC_DEFAULT_STYLE),
+ GetName());
+
+ // if no inactive-bitmap has been provided, GetBitmap() will return wxNullBitmap
+ // which just tells wxAnimationCtrl to use the default for inactive status
+ ctrl->SetInactiveBitmap(GetBitmap(wxT("inactive-bitmap")));
+
+ SetupWindow(ctrl);
+
+ return ctrl;
+}
+
+bool wxAnimationCtrlXmlHandler::CanHandle(wxXmlNode *node)
+{
+ return IsOfClass(node, wxT("wxAnimationCtrl"));
+}
+
+#endif // wxUSE_XRC && wxUSE_ANIMATIONCTRL
return wxBitmap(img);
}
+#if wxUSE_ANIMATIONCTRL
+wxAnimation wxXmlResourceHandler::GetAnimation(const wxString& param)
+{
+ wxAnimation ani;
+
+ /* load the animation from file: */
+ wxString name = GetParamValue(param);
+ if (name.empty()) return wxNullAnimation;
+#if wxUSE_FILESYSTEM
+ wxFSFile *fsfile = GetCurFileSystem().OpenFile(name);
+ if (fsfile == NULL)
+ {
+ wxLogError(_("XRC resource: Cannot create animation from '%s'."),
+ name.c_str());
+ return wxNullAnimation;
+ }
+ ani.Load(*(fsfile->GetStream()));
+ delete fsfile;
+#else
+ ani.LoadFile(name);
+#endif
+
+ if (!ani.IsOk())
+ {
+ wxLogError(_("XRC resource: Cannot create animation from '%s'."),
+ name.c_str());
+ return wxNullAnimation;
+ }
+
+ return ani;
+}
+#endif // wxUSE_ANIMATIONCTRL
+
wxIcon wxXmlResourceHandler::GetIcon(const wxString& param,
#if wxUSE_HYPERLINKCTRL
AddHandler( new wxHyperlinkCtrlXmlHandler);
#endif
+#if wxUSE_ANIMATIONCTRL
+ AddHandler( new wxAnimationCtrlXmlHandler);
+#endif
}
#endif // wxUSE_XRC