]> git.saurik.com Git - wxWidgets.git/blobdiff - src/xrc/xmlres.cpp
use wxChar correctly in wxString docs; mark wx1 compatibility functions
[wxWidgets.git] / src / xrc / xmlres.cpp
index 9a55df5861ad75861ae723adcd8d64496aa20068..c2aa6a5586fb6c66dd94f44465d58380bbb6c964 100644 (file)
@@ -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,