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