]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/xrc/xmladv.cpp
add wrappers to avoid compiling code which will never be used
[wxWidgets.git] / src / xrc / xmladv.cpp
... / ...
CommitLineData
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
33 #include "wx/log.h"
34#endif // WX_PRECOMP
35
36#include "wx/animate.h"
37#include "wx/scopedptr.h"
38
39// ============================================================================
40// implementation
41// ============================================================================
42
43#if wxUSE_ANIMATIONCTRL
44wxAnimation* wxXmlResourceHandlerImpl::GetAnimation(const wxString& param)
45{
46 const wxString name = GetParamValue(param);
47 if ( name.empty() )
48 return NULL;
49
50 // load the animation from file
51 wxScopedPtr<wxAnimation> ani(new wxAnimation);
52#if wxUSE_FILESYSTEM
53 wxFSFile * const
54 fsfile = GetCurFileSystem().OpenFile(name, wxFS_READ | wxFS_SEEKABLE);
55 if ( fsfile )
56 {
57 ani->Load(*fsfile->GetStream());
58 delete fsfile;
59 }
60#else
61 ani->LoadFile(name);
62#endif
63
64 if ( !ani->IsOk() )
65 {
66 ReportParamError
67 (
68 param,
69 wxString::Format("cannot create animation from \"%s\"", name)
70 );
71 return NULL;
72 }
73
74 return ani.release();
75}
76#endif // wxUSE_ANIMATIONCTRL
77
78#endif // wxUSE_XRC
79
80
81
82