allow loading wxAnimationCtrl contents from stream (patch 1962344)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53629 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -75,6 +75,8 @@ public:
|
|||||||
// public API
|
// public API
|
||||||
virtual bool LoadFile(const wxString& filename,
|
virtual bool LoadFile(const wxString& filename,
|
||||||
wxAnimationType type = wxANIMATION_TYPE_ANY) = 0;
|
wxAnimationType type = wxANIMATION_TYPE_ANY) = 0;
|
||||||
|
virtual bool Load(wxInputStream& stream,
|
||||||
|
wxAnimationType type = wxANIMATION_TYPE_ANY) = 0;
|
||||||
|
|
||||||
virtual void SetAnimation(const wxAnimation &anim) = 0;
|
virtual void SetAnimation(const wxAnimation &anim) = 0;
|
||||||
virtual wxAnimation GetAnimation() const = 0;
|
virtual wxAnimation GetAnimation() const = 0;
|
||||||
|
@@ -97,6 +97,7 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
virtual bool LoadFile(const wxString& filename, wxAnimationType type = wxANIMATION_TYPE_ANY);
|
virtual bool LoadFile(const wxString& filename, wxAnimationType type = wxANIMATION_TYPE_ANY);
|
||||||
|
virtual bool Load(wxInputStream& stream, wxAnimationType type = wxANIMATION_TYPE_ANY);
|
||||||
|
|
||||||
virtual void Stop();
|
virtual void Stop();
|
||||||
virtual bool Play()
|
virtual bool Play()
|
||||||
|
@@ -113,6 +113,7 @@ public: // event handler
|
|||||||
public: // public API
|
public: // public API
|
||||||
|
|
||||||
virtual bool LoadFile(const wxString& filename, wxAnimationType type = wxANIMATION_TYPE_ANY);
|
virtual bool LoadFile(const wxString& filename, wxAnimationType type = wxANIMATION_TYPE_ANY);
|
||||||
|
virtual bool Load(wxInputStream& stream, wxAnimationType type = wxANIMATION_TYPE_ANY);
|
||||||
|
|
||||||
virtual void SetAnimation(const wxAnimation &anim);
|
virtual void SetAnimation(const wxAnimation &anim);
|
||||||
virtual wxAnimation GetAnimation() const
|
virtual wxAnimation GetAnimation() const
|
||||||
|
@@ -123,6 +123,13 @@ public:
|
|||||||
virtual bool LoadFile(const wxString& file,
|
virtual bool LoadFile(const wxString& file,
|
||||||
wxAnimationType animType = wxANIMATION_TYPE_ANY);
|
wxAnimationType animType = wxANIMATION_TYPE_ANY);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Loads the animation from the given stream and calls SetAnimation().
|
||||||
|
See wxAnimation::Load() for more info.
|
||||||
|
*/
|
||||||
|
virtual bool Load(wxInputStream& file,
|
||||||
|
wxAnimationType animType = wxANIMATION_TYPE_ANY);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Starts playing the animation.
|
Starts playing the animation.
|
||||||
|
|
||||||
|
@@ -307,10 +307,15 @@ wxAnimationCtrl::~wxAnimationCtrl()
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool wxAnimationCtrl::LoadFile(const wxString& filename, wxAnimationType type)
|
bool wxAnimationCtrl::LoadFile(const wxString& filename, wxAnimationType type)
|
||||||
|
{
|
||||||
|
wxFileInputStream fis(filename);
|
||||||
|
return Load(fis, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxAnimationCtrl::Load(wxInputStream& stream, wxAnimationType type)
|
||||||
{
|
{
|
||||||
wxAnimation anim;
|
wxAnimation anim;
|
||||||
if (!anim.LoadFile(filename, type) ||
|
if ( !anim.Load(stream, type) || !anim.IsOk() )
|
||||||
!anim.IsOk())
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
SetAnimation(anim);
|
SetAnimation(anim);
|
||||||
|
@@ -232,9 +232,15 @@ wxAnimationCtrl::~wxAnimationCtrl()
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool wxAnimationCtrl::LoadFile(const wxString &filename, wxAnimationType type)
|
bool wxAnimationCtrl::LoadFile(const wxString &filename, wxAnimationType type)
|
||||||
|
{
|
||||||
|
wxFileInputStream fis(filename);
|
||||||
|
return Load(fis, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxAnimationCtrl::Load(wxInputStream& stream, wxAnimationType type)
|
||||||
{
|
{
|
||||||
wxAnimation anim;
|
wxAnimation anim;
|
||||||
if (!anim.LoadFile(filename, type))
|
if ( !anim.Load(stream, type) || !anim.IsOk() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
SetAnimation(anim);
|
SetAnimation(anim);
|
||||||
|
Reference in New Issue
Block a user