wxAnimationCtrl fix to display inactive bitmap at start (patch 1590192)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43001 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2006-11-03 22:16:51 +00:00
parent 28639df9c7
commit 580ca0a4e1
4 changed files with 15 additions and 10 deletions

View File

@@ -82,7 +82,7 @@ public: // public API
virtual bool IsPlaying() const = 0;
virtual void SetInactiveBitmap(const wxBitmap &bmp);
virtual void SetInactiveBitmap(const wxBitmap &bmp) = 0;
wxBitmap GetInactiveBitmap() const
{ return m_bmpStatic; }

View File

@@ -30,11 +30,5 @@ wxAnimation wxNullAnimation;
IMPLEMENT_ABSTRACT_CLASS(wxAnimationBase, wxObject)
IMPLEMENT_ABSTRACT_CLASS(wxAnimationCtrlBase, wxControl)
void wxAnimationCtrlBase::SetInactiveBitmap(const wxBitmap &bmp)
{
m_bmpStatic = bmp;
m_bmpStatic.UnShare();
}
#endif // wxUSE_ANIMATIONCTRL

View File

@@ -343,7 +343,7 @@ void wxAnimationCtrl::SetAnimation(const wxAnimation& animation)
void wxAnimationCtrl::SetInactiveBitmap(const wxBitmap &bmp)
{
wxAnimationCtrlBase::SetInactiveBitmap(bmp);
m_bmpStatic = bmp;
// if not playing, update the backing store now
if (!IsPlaying())
@@ -630,11 +630,22 @@ void wxAnimationCtrl::OnSize(wxSizeEvent &WXUNUSED(event))
{
// NB: resizing an animation control may take a lot of time
// for big animations as the backing store must be
// extended and rebuilt. Try to avoid it!!
// extended and rebuilt. Try to avoid it e.g. using
// a null proportion value for your wxAnimationCtrls
// when using them inside sizers.
if (m_animation.IsOk())
{
// be careful to change the backing store *only* if we are
// playing the animation as otherwise we may be displaying
// the inactive bitmap and overwriting the backing store
// with the last played frame is wrong in this case
if (IsPlaying())
{
if (!RebuildBackingStoreUpToFrame(m_currentFrame))
Stop(); // in case we are playing
}
}
}
#endif // wxUSE_ANIMATIONCTRL

View File

@@ -320,7 +320,7 @@ void wxAnimationCtrl::Stop()
void wxAnimationCtrl::SetInactiveBitmap(const wxBitmap &bmp)
{
wxAnimationCtrlBase::SetInactiveBitmap(bmp);
m_bmpStatic = bmp;
// update the pixbuf associated with m_widget now...
if (!IsPlaying())