]>
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 | |
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 | ||
36 | // ============================================================================ | |
37 | // implementation | |
38 | // ============================================================================ | |
39 | ||
40 | #if wxUSE_ANIMATIONCTRL | |
41 | wxAnimation wxXmlResourceHandler::GetAnimation(const wxString& param) | |
42 | { | |
43 | const wxString name = GetParamValue(param); | |
44 | if ( name.empty() ) | |
45 | return wxNullAnimation; | |
46 | ||
47 | // load the animation from file | |
48 | wxAnimation ani; | |
49 | #if wxUSE_FILESYSTEM | |
50 | wxFSFile * const | |
51 | fsfile = GetCurFileSystem().OpenFile(name, wxFS_READ | wxFS_SEEKABLE); | |
52 | if ( fsfile ) | |
53 | { | |
54 | ani.Load(*fsfile->GetStream()); | |
55 | delete fsfile; | |
56 | } | |
57 | #else | |
58 | ani.LoadFile(name); | |
59 | #endif | |
60 | ||
61 | if ( !ani.IsOk() ) | |
62 | { | |
63 | wxLogError(_("XRC resource: Cannot create animation from '%s'."), | |
64 | name.c_str()); | |
65 | return wxNullAnimation; | |
66 | } | |
67 | ||
68 | return ani; | |
69 | } | |
70 | #endif // wxUSE_ANIMATIONCTRL | |
71 | ||
72 | #endif // wxUSE_XRC | |
73 | ||
74 | ||
75 | ||
76 |