]> git.saurik.com Git - wxWidgets.git/blob - src/xrc/xmladv.cpp
Use unsigned char for XBM bitmaps data.
[wxWidgets.git] / src / xrc / xmladv.cpp
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 // ============================================================================
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 ReportParamError
64 (
65 param,
66 wxString::Format("cannot create animation from \"%s\"", name)
67 );
68 return wxNullAnimation;
69 }
70
71 return ani;
72 }
73 #endif // wxUSE_ANIMATIONCTRL
74
75 #endif // wxUSE_XRC
76
77
78
79