Use GetAnimation() in wxAnimationCtrlXmlHandler again

This function basically only exists in order to be used in this handler,
so extend it to allow doing it by adding wxAnimationCtrlBase argument to
it, allowing it to create wxAnimation object compatible with the given
control.

This reduces code duplication and, incidentally, makes GetAnimation()
more useful for any user-defined XRC handlers.
This commit is contained in:
Vadim Zeitlin
2020-06-09 18:05:00 +02:00
parent 2c4b0b4271
commit 8ff6fa6f54
4 changed files with 25 additions and 39 deletions

View File

@@ -22,6 +22,7 @@
#include "wx/window.h"
class WXDLLIMPEXP_FWD_CORE wxAnimation;
class WXDLLIMPEXP_FWD_CORE wxAnimationCtrlBase;
class WXDLLIMPEXP_FWD_XML wxXmlNode;
class WXDLLIMPEXP_FWD_XML wxXmlResource;
@@ -100,7 +101,8 @@ 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"),
wxAnimationCtrlBase* ctrl = NULL) = 0;
#endif
virtual wxFont GetFont(const wxString& param = wxT("font"), wxWindow* parent = NULL) = 0;
@@ -353,9 +355,10 @@ protected:
}
#if wxUSE_ANIMATIONCTRL
wxAnimation* GetAnimation(const wxString& param = wxT("animation"))
wxAnimation* GetAnimation(const wxString& param = wxT("animation"),
wxAnimationCtrlBase* ctrl = NULL)
{
return GetImpl()->GetAnimation(param);
return GetImpl()->GetAnimation(param, ctrl);
}
#endif