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:
Vadim Zeitlin 2008-05-17 22:51:52 +00:00
parent 7bf2b0881a
commit 462167a9f7
6 changed files with 25 additions and 3 deletions

View File

@ -75,6 +75,8 @@ public:
// public API
virtual bool LoadFile(const wxString& filename,
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 wxAnimation GetAnimation() const = 0;

View File

@ -97,6 +97,7 @@ public:
public:
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 bool Play()

View File

@ -113,6 +113,7 @@ public: // event handler
public: // public API
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 wxAnimation GetAnimation() const

View File

@ -123,6 +123,13 @@ public:
virtual bool LoadFile(const wxString& file,
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.

View File

@ -307,10 +307,15 @@ wxAnimationCtrl::~wxAnimationCtrl()
}
bool wxAnimationCtrl::LoadFile(const wxString& filename, wxAnimationType type)
{
wxFileInputStream fis(filename);
return Load(fis, type);
}
bool wxAnimationCtrl::Load(wxInputStream& stream, wxAnimationType type)
{
wxAnimation anim;
if (!anim.LoadFile(filename, type) ||
!anim.IsOk())
if ( !anim.Load(stream, type) || !anim.IsOk() )
return false;
SetAnimation(anim);

View File

@ -232,9 +232,15 @@ wxAnimationCtrl::~wxAnimationCtrl()
}
bool wxAnimationCtrl::LoadFile(const wxString &filename, wxAnimationType type)
{
wxFileInputStream fis(filename);
return Load(fis, type);
}
bool wxAnimationCtrl::Load(wxInputStream& stream, wxAnimationType type)
{
wxAnimation anim;
if (!anim.LoadFile(filename, type))
if ( !anim.Load(stream, type) || !anim.IsOk() )
return false;
SetAnimation(anim);