X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d4a724d4075418ccaea166925c33242a338249c7..b0b96f667dbc2fc2d3ebaa342c50bdea10f84a91:/src/xrc/xmlres.cpp diff --git a/src/xrc/xmlres.cpp b/src/xrc/xmlres.cpp index 9a55df5861..c2aa6a5586 100644 --- a/src/xrc/xmlres.cpp +++ b/src/xrc/xmlres.cpp @@ -28,6 +28,7 @@ #include "wx/settings.h" #include "wx/bitmap.h" #include "wx/image.h" + #include "wx/module.h" #endif #ifndef __WXWINCE__ @@ -39,7 +40,6 @@ #include "wx/filename.h" #include "wx/tokenzr.h" #include "wx/fontenum.h" -#include "wx/module.h" #include "wx/fontmap.h" #include "wx/artprov.h" @@ -1139,6 +1139,39 @@ wxBitmap wxXmlResourceHandler::GetBitmap(const wxString& param, 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,