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
This commit is contained in:
Vadim Zeitlin 2012-10-27 00:46:58 +00:00
parent 9823d1c5d1
commit bdb4b8320d
5 changed files with 22 additions and 15 deletions

View File

@ -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.

View File

@ -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);
}

View File

@ -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"

View File

@ -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<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());

View File

@ -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<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