From: Vadim Zeitlin Date: Sat, 27 Oct 2012 00:46:58 +0000 (+0000) Subject: Break implicit dependency of "core" on "adv" via wxXmlResourceHandlerImplBase. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/bdb4b8320d066a0931ad66a40bca30a0500d3b65 Break implicit dependency of "core" on "adv" via wxXmlResourceHandlerImplBase. 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 --- diff --git a/include/wx/xrc/xmlres.h b/include/wx/xrc/xmlres.h index 4622b3d8a7..23cbea1c51 100644 --- a/include/wx/xrc/xmlres.h +++ b/include/wx/xrc/xmlres.h @@ -26,7 +26,6 @@ #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" @@ -565,7 +564,7 @@ public: #if wxUSE_ANIMATIONCTRL // Gets an animation. - wxAnimation GetAnimation(const wxString& param = wxT("animation")); + wxAnimation* GetAnimation(const wxString& param = wxT("animation")); #endif // Gets a font. diff --git a/include/wx/xrc/xmlreshandler.h b/include/wx/xrc/xmlreshandler.h index 46eb374c18..d0ad233519 100644 --- a/include/wx/xrc/xmlreshandler.h +++ b/include/wx/xrc/xmlreshandler.h @@ -18,10 +18,11 @@ #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; @@ -87,7 +88,7 @@ public: 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; @@ -305,7 +306,7 @@ protected: } #if wxUSE_ANIMATIONCTRL - wxAnimation GetAnimation(const wxString& param = wxT("animation")) + wxAnimation* GetAnimation(const wxString& param = wxT("animation")) { return GetImpl()->GetAnimation(param); } diff --git a/samples/xrc/myframe.cpp b/samples/xrc/myframe.cpp index 6662b34597..509ea31833 100644 --- a/samples/xrc/myframe.cpp +++ b/samples/xrc/myframe.cpp @@ -51,7 +51,8 @@ #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" diff --git a/src/xrc/xh_animatctrl.cpp b/src/xrc/xh_animatctrl.cpp index 6bded88fdc..b912f1b92b 100644 --- a/src/xrc/xh_animatctrl.cpp +++ b/src/xrc/xh_animatctrl.cpp @@ -19,6 +19,7 @@ #include "wx/xrc/xh_animatctrl.h" #include "wx/animate.h" +#include "wx/scopedptr.h" IMPLEMENT_DYNAMIC_CLASS(wxAnimationCtrlXmlHandler, wxXmlResourceHandler) @@ -33,9 +34,11 @@ wxObject *wxAnimationCtrlXmlHandler::DoCreateResource() { XRC_MAKE_INSTANCE(ctrl, wxAnimationCtrl) + wxScopedPtr animation(GetAnimation(wxT("animation"))); + ctrl->Create(m_parentAsWindow, GetID(), - GetAnimation(wxT("animation")), + animation ? *animation : wxNullAnimation, GetPosition(), GetSize(), GetStyle(wxT("style"), wxAC_DEFAULT_STYLE), GetName()); diff --git a/src/xrc/xmladv.cpp b/src/xrc/xmladv.cpp index 6f6f36067a..729c5b2892 100644 --- a/src/xrc/xmladv.cpp +++ b/src/xrc/xmladv.cpp @@ -33,42 +33,45 @@ #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 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