wxXmlResourceHandlerImplBase::GetAnimation() returned wxAnimation by value
which created references to wxAnimationCtrlNameStr and wxNullAnimation
symbols, defined in the "adv" library, in "core" when using Sun CC even though
they were not referenced directly.
Fix this by returning wxAnimation by pointer to keep it opaque for "core" code.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72782
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
#include "wx/icon.h"
#include "wx/artprov.h"
#include "wx/colour.h"
-#include "wx/animate.h"
#include "wx/vector.h"
#include "wx/xrc/xmlreshandler.h"
#if wxUSE_ANIMATIONCTRL
// Gets an animation.
- wxAnimation GetAnimation(const wxString& param = wxT("animation"));
+ wxAnimation* GetAnimation(const wxString& param = wxT("animation"));
#endif
// Gets a font.
#include "wx/string.h"
#include "wx/artprov.h"
#include "wx/colour.h"
-#include "wx/animate.h"
#include "wx/filesys.h"
#include "wx/imaglist.h"
+class WXDLLIMPEXP_FWD_ADV wxAnimation;
+
class WXDLLIMPEXP_FWD_XML wxXmlNode;
class WXDLLIMPEXP_FWD_XML wxXmlResource;
virtual wxImageList *GetImageList(const wxString& param = wxT("imagelist")) = 0;
#if wxUSE_ANIMATIONCTRL
- virtual wxAnimation GetAnimation(const wxString& param = wxT("animation")) = 0;
+ virtual wxAnimation* GetAnimation(const wxString& param = wxT("animation")) = 0;
#endif
virtual wxFont GetFont(const wxString& param = wxT("font"), wxWindow* parent = NULL) = 0;
}
#if wxUSE_ANIMATIONCTRL
- wxAnimation GetAnimation(const wxString& param = wxT("animation"))
+ wxAnimation* GetAnimation(const wxString& param = wxT("animation"))
{
return GetImpl()->GetAnimation(param);
}
#include "custclas.h"
// And our objref dialog, for the object reference and ID range example.
#include "objrefdlg.h"
-// For functions to manipulate our wxTreeCtrl and wxListCtrl
+// For functions to manipulate the corresponding controls.
+#include "wx/animate.h"
#include "wx/treectrl.h"
#include "wx/listctrl.h"
#include "wx/xrc/xh_animatctrl.h"
#include "wx/animate.h"
+#include "wx/scopedptr.h"
IMPLEMENT_DYNAMIC_CLASS(wxAnimationCtrlXmlHandler, wxXmlResourceHandler)
{
XRC_MAKE_INSTANCE(ctrl, wxAnimationCtrl)
+ wxScopedPtr<wxAnimation> animation(GetAnimation(wxT("animation")));
+
ctrl->Create(m_parentAsWindow,
GetID(),
- GetAnimation(wxT("animation")),
+ animation ? *animation : wxNullAnimation,
GetPosition(), GetSize(),
GetStyle(wxT("style"), wxAC_DEFAULT_STYLE),
GetName());
#include "wx/log.h"
#endif // WX_PRECOMP
+#include "wx/animate.h"
+#include "wx/scopedptr.h"
+
// ============================================================================
// implementation
// ============================================================================
#if wxUSE_ANIMATIONCTRL
-wxAnimation wxXmlResourceHandlerImpl::GetAnimation(const wxString& param)
+wxAnimation* wxXmlResourceHandlerImpl::GetAnimation(const wxString& param)
{
const wxString name = GetParamValue(param);
if ( name.empty() )
- return wxNullAnimation;
+ return NULL;
// load the animation from file
- wxAnimation ani;
+ wxScopedPtr<wxAnimation> ani(new wxAnimation);
#if wxUSE_FILESYSTEM
wxFSFile * const
fsfile = GetCurFileSystem().OpenFile(name, wxFS_READ | wxFS_SEEKABLE);
if ( fsfile )
{
- ani.Load(*fsfile->GetStream());
+ ani->Load(*fsfile->GetStream());
delete fsfile;
}
#else
- ani.LoadFile(name);
+ ani->LoadFile(name);
#endif
- if ( !ani.IsOk() )
+ if ( !ani->IsOk() )
{
ReportParamError
(
param,
wxString::Format("cannot create animation from \"%s\"", name)
);
- return wxNullAnimation;
+ return NULL;
}
- return ani;
+ return ani.release();
}
#endif // wxUSE_ANIMATIONCTRL