]> git.saurik.com Git - wxWidgets.git/blame - src/xrc/xmladv.cpp
Add missing space to fix r73681 changes.
[wxWidgets.git] / src / xrc / xmladv.cpp
CommitLineData
aaa03125
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: src/xrc/xmladv.cpp
3// Purpose: Parts of wxXRC library depending on wxAdv: they must not be in
4// xmlres.cpp itself or it becomes impossible to use wxXRC without
5// linking wxAdv even if the latter is not used at all.
6// Author: Vadim Zeitlin (extracted from src/xrc/xmlres.cpp)
7// Created: 2008-08-02
8// RCS-ID: $Id$
9// Copyright: (c) 2000 Vaclav Slavik
10// Licence: wxWindows licence
11///////////////////////////////////////////////////////////////////////////////
12
13// ============================================================================
14// declarations
15// ============================================================================
16
17// ----------------------------------------------------------------------------
18// headers
19// ----------------------------------------------------------------------------
20
21// for compilers that support precompilation, includes "wx.h".
22#include "wx/wxprec.h"
23
24#ifdef __BORLANDC__
25 #pragma hdrstop
26#endif
27
28#if wxUSE_XRC
29
30#include "wx/xrc/xmlres.h"
31
32#ifndef WX_PRECOMP
ec585c30 33 #include "wx/log.h"
aaa03125
VZ
34#endif // WX_PRECOMP
35
bdb4b832
VZ
36#include "wx/animate.h"
37#include "wx/scopedptr.h"
38
aaa03125
VZ
39// ============================================================================
40// implementation
41// ============================================================================
42
43#if wxUSE_ANIMATIONCTRL
bdb4b832 44wxAnimation* wxXmlResourceHandlerImpl::GetAnimation(const wxString& param)
aaa03125
VZ
45{
46 const wxString name = GetParamValue(param);
47 if ( name.empty() )
bdb4b832 48 return NULL;
aaa03125
VZ
49
50 // load the animation from file
bdb4b832 51 wxScopedPtr<wxAnimation> ani(new wxAnimation);
aaa03125
VZ
52#if wxUSE_FILESYSTEM
53 wxFSFile * const
54 fsfile = GetCurFileSystem().OpenFile(name, wxFS_READ | wxFS_SEEKABLE);
55 if ( fsfile )
56 {
bdb4b832 57 ani->Load(*fsfile->GetStream());
aaa03125
VZ
58 delete fsfile;
59 }
60#else
bdb4b832 61 ani->LoadFile(name);
aaa03125
VZ
62#endif
63
bdb4b832 64 if ( !ani->IsOk() )
aaa03125 65 {
819559b2
VS
66 ReportParamError
67 (
68 param,
69 wxString::Format("cannot create animation from \"%s\"", name)
70 );
bdb4b832 71 return NULL;
aaa03125
VZ
72 }
73
bdb4b832 74 return ani.release();
aaa03125
VZ
75}
76#endif // wxUSE_ANIMATIONCTRL
77
78#endif // wxUSE_XRC
79
80
81
82