#pragma hdrstop
#endif //__BORLANDC__
-#if wxUSE_ANIMATIONCTRL && (!defined(__WXGTK20__) || defined(__WXUNIVERSAL__))
+#if wxUSE_ANIMATIONCTRL
#include "wx/animate.h"
// ----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxAnimation, wxAnimationBase)
-#define M_ANIMDATA wx_static_cast(wxAnimationDecoder*, m_refData)
+#define M_ANIMDATA static_cast<wxAnimationDecoder*>(m_refData)
wxSize wxAnimation::GetSize() const
{
m_refData = handler->Clone();
return M_ANIMDATA->Load(stream);
}
-
}
wxLogWarning( _("No handler found for animation type.") );
// a good reason to add and remove duplicate handlers (and they
// may) we should probably refcount the duplicates.
- wxLogDebug( _T("Adding duplicate animation handler for '%d' type"),
+ wxLogDebug( wxT("Adding duplicate animation handler for '%d' type"),
handler->GetType() );
delete handler;
}
else
{
// see AddHandler for additional comments.
- wxLogDebug( _T("Inserting duplicate animation handler for '%d' type"),
+ wxLogDebug( wxT("Inserting duplicate animation handler for '%d' type"),
handler->GetType() );
delete handler;
}
}
bool wxAnimationCtrl::LoadFile(const wxString& filename, wxAnimationType type)
+{
+ wxFileInputStream fis(filename);
+ if (!fis.Ok())
+ return false;
+ 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);
int delay = m_animation.GetDelay(0);
if (delay == 0)
delay = 1; // 0 is invalid timeout for wxTimer.
- m_timer.Start(delay);
+ m_timer.Start(delay, true);
return true;
}
}
void wxAnimationCtrl::DisposeToBackground(wxDC& dc)
-{
+{
wxColour col = IsUsingWindowBackgroundColour()
? GetBackgroundColour()
: m_animation.GetBackgroundColour();
if ( m_backingStore.IsOk() )
{
// NOTE: we draw the bitmap explicitely ignoring the mask (if any);
- // i.e. we don't want to combine the backing store with the
+ // i.e. we don't want to combine the backing store with the
// possibly wrong preexisting contents of the window!
dc.DrawBitmap(m_backingStore, 0, 0, false /* no mask */);
}
int delay = m_animation.GetDelay(m_currentFrame);
if (delay == 0)
delay = 1; // 0 is invalid timeout for wxTimer.
- m_timer.Start(delay);
+ m_timer.Start(delay, true);
}
void wxAnimationCtrl::OnSize(wxSizeEvent &WXUNUSED(event))
// 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
+ // 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())
{
}
}
-#endif // wxUSE_ANIMATIONCTRL
+#endif // wxUSE_ANIMATIONCTRL