]>
Commit | Line | Data |
---|---|---|
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 | |
aaa03125 VZ |
8 | // Copyright: (c) 2000 Vaclav Slavik |
9 | // Licence: wxWindows licence | |
10 | /////////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | // ============================================================================ | |
13 | // declarations | |
14 | // ============================================================================ | |
15 | ||
16 | // ---------------------------------------------------------------------------- | |
17 | // headers | |
18 | // ---------------------------------------------------------------------------- | |
19 | ||
20 | // for compilers that support precompilation, includes "wx.h". | |
21 | #include "wx/wxprec.h" | |
22 | ||
23 | #ifdef __BORLANDC__ | |
24 | #pragma hdrstop | |
25 | #endif | |
26 | ||
27 | #if wxUSE_XRC | |
28 | ||
29 | #include "wx/xrc/xmlres.h" | |
30 | ||
31 | #ifndef WX_PRECOMP | |
ec585c30 | 32 | #include "wx/log.h" |
aaa03125 VZ |
33 | #endif // WX_PRECOMP |
34 | ||
bdb4b832 VZ |
35 | #include "wx/animate.h" |
36 | #include "wx/scopedptr.h" | |
37 | ||
aaa03125 VZ |
38 | // ============================================================================ |
39 | // implementation | |
40 | // ============================================================================ | |
41 | ||
42 | #if wxUSE_ANIMATIONCTRL | |
bdb4b832 | 43 | wxAnimation* wxXmlResourceHandlerImpl::GetAnimation(const wxString& param) |
aaa03125 VZ |
44 | { |
45 | const wxString name = GetParamValue(param); | |
46 | if ( name.empty() ) | |
bdb4b832 | 47 | return NULL; |
aaa03125 VZ |
48 | |
49 | // load the animation from file | |
bdb4b832 | 50 | wxScopedPtr<wxAnimation> ani(new wxAnimation); |
aaa03125 VZ |
51 | #if wxUSE_FILESYSTEM |
52 | wxFSFile * const | |
53 | fsfile = GetCurFileSystem().OpenFile(name, wxFS_READ | wxFS_SEEKABLE); | |
54 | if ( fsfile ) | |
55 | { | |
bdb4b832 | 56 | ani->Load(*fsfile->GetStream()); |
aaa03125 VZ |
57 | delete fsfile; |
58 | } | |
59 | #else | |
bdb4b832 | 60 | ani->LoadFile(name); |
aaa03125 VZ |
61 | #endif |
62 | ||
bdb4b832 | 63 | if ( !ani->IsOk() ) |
aaa03125 | 64 | { |
819559b2 VS |
65 | ReportParamError |
66 | ( | |
67 | param, | |
68 | wxString::Format("cannot create animation from \"%s\"", name) | |
69 | ); | |
bdb4b832 | 70 | return NULL; |
aaa03125 VZ |
71 | } |
72 | ||
bdb4b832 | 73 | return ani.release(); |
aaa03125 VZ |
74 | } |
75 | #endif // wxUSE_ANIMATIONCTRL | |
76 | ||
77 | #endif // wxUSE_XRC | |
78 | ||
79 | ||
80 | ||
81 |