// linking wxAdv even if the latter is not used at all.
// Author: Vadim Zeitlin (extracted from src/xrc/xmlres.cpp)
// Created: 2008-08-02
-// RCS-ID: $Id$
// Copyright: (c) 2000 Vaclav Slavik
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#include "wx/xrc/xmlres.h"
#ifndef WX_PRECOMP
- #include "wx/string.h"
+ #include "wx/log.h"
#endif // WX_PRECOMP
+#include "wx/animate.h"
+#include "wx/scopedptr.h"
+
// ============================================================================
// implementation
// ============================================================================
#if wxUSE_ANIMATIONCTRL
-wxAnimation wxXmlResourceHandler::GetAnimation(const wxString& param)
+wxAnimation* wxXmlResourceHandlerImpl::GetAnimation(const wxString& param)
{
const wxString name = GetParamValue(param);
if ( name.empty() )
- return wxNullAnimation;
+ return NULL;
// load the animation from file
- wxAnimation ani;
+ wxScopedPtr<wxAnimation> ani(new wxAnimation);
#if wxUSE_FILESYSTEM
wxFSFile * const
fsfile = GetCurFileSystem().OpenFile(name, wxFS_READ | wxFS_SEEKABLE);
if ( fsfile )
{
- ani.Load(*fsfile->GetStream());
+ ani->Load(*fsfile->GetStream());
delete fsfile;
}
#else
- ani.LoadFile(name);
+ ani->LoadFile(name);
#endif
- if ( !ani.IsOk() )
+ if ( !ani->IsOk() )
{
- wxLogError(_("XRC resource: Cannot create animation from '%s'."),
- name.c_str());
- return wxNullAnimation;
+ ReportParamError
+ (
+ param,
+ wxString::Format("cannot create animation from \"%s\"", name)
+ );
+ return NULL;
}
- return ani;
+ return ani.release();
}
#endif // wxUSE_ANIMATIONCTRL