2006-10-09 13:51:07 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/animate.h
|
|
|
|
// Purpose: wxAnimation and wxAnimationCtrl
|
|
|
|
// Author: Julian Smart and Guillermo Rodriguez Garcia
|
|
|
|
// Modified by: Francesco Montorsi
|
|
|
|
// Created: 13/8/99
|
|
|
|
// Copyright: (c) Julian Smart and Guillermo Rodriguez Garcia
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2006-12-10 09:18:37 -05:00
|
|
|
#ifndef _WX_ANIMATE_H_
|
|
|
|
#define _WX_ANIMATE_H_
|
2006-10-09 13:51:07 -04:00
|
|
|
|
|
|
|
#include "wx/defs.h"
|
|
|
|
|
|
|
|
#if wxUSE_ANIMATIONCTRL
|
|
|
|
|
2006-10-10 00:27:54 -04:00
|
|
|
#include "wx/animdecod.h"
|
|
|
|
#include "wx/control.h"
|
|
|
|
#include "wx/timer.h"
|
2006-10-21 09:51:38 -04:00
|
|
|
#include "wx/bitmap.h"
|
2006-10-09 13:51:07 -04:00
|
|
|
|
2020-03-30 17:53:11 -04:00
|
|
|
class WXDLLIMPEXP_FWD_CORE wxAnimation;
|
2020-03-27 18:53:03 -04:00
|
|
|
class WXDLLIMPEXP_FWD_CORE wxGenericAnimation;
|
2006-10-09 13:51:07 -04:00
|
|
|
|
2020-03-30 17:53:11 -04:00
|
|
|
extern WXDLLIMPEXP_DATA_CORE(wxAnimation) wxNullAnimation;
|
|
|
|
extern WXDLLIMPEXP_DATA_CORE(wxGenericAnimation) wxNullGenericAnimation;
|
2018-08-27 10:34:34 -04:00
|
|
|
extern WXDLLIMPEXP_DATA_CORE(const char) wxAnimationCtrlNameStr[];
|
2006-10-09 13:51:07 -04:00
|
|
|
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2020-03-25 19:29:34 -04:00
|
|
|
// wxAnimation
|
2006-10-09 13:51:07 -04:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2020-03-25 19:29:34 -04:00
|
|
|
WX_DECLARE_LIST_WITH_DECL(wxAnimationDecoder, wxAnimationDecoderList, class WXDLLIMPEXP_ADV);
|
|
|
|
|
2020-03-30 17:53:11 -04:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxAnimationBase
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class WXDLLIMPEXP_CORE wxAnimationBase : public wxObject
|
2006-10-09 13:51:07 -04:00
|
|
|
{
|
|
|
|
public:
|
2020-03-30 17:53:11 -04:00
|
|
|
wxAnimationBase() {}
|
2006-10-09 13:51:07 -04:00
|
|
|
|
2020-03-30 17:53:11 -04:00
|
|
|
virtual bool IsOk() const = 0;
|
2006-10-09 13:51:07 -04:00
|
|
|
|
2020-03-30 17:53:11 -04:00
|
|
|
// can be -1
|
|
|
|
virtual int GetDelay(unsigned int frame) const = 0;
|
2006-10-09 13:51:07 -04:00
|
|
|
|
2020-03-30 17:53:11 -04:00
|
|
|
virtual unsigned int GetFrameCount() const = 0;
|
|
|
|
virtual wxImage GetFrame(unsigned int frame) const = 0;
|
|
|
|
virtual wxSize GetSize() const = 0;
|
|
|
|
|
|
|
|
virtual bool LoadFile(const wxString& name,
|
|
|
|
wxAnimationType type = wxANIMATION_TYPE_ANY) = 0;
|
2006-12-10 09:18:37 -05:00
|
|
|
virtual bool Load(wxInputStream& stream,
|
2020-03-30 17:53:11 -04:00
|
|
|
wxAnimationType type = wxANIMATION_TYPE_ANY) = 0;
|
2020-03-25 19:29:34 -04:00
|
|
|
|
2020-03-30 17:53:11 -04:00
|
|
|
// extended interface used only by the generic implementation of wxAnimationCtrl
|
|
|
|
virtual wxPoint GetFramePosition(unsigned int frame) const = 0;
|
|
|
|
virtual wxSize GetFrameSize(unsigned int frame) const = 0;
|
|
|
|
virtual wxAnimationDisposal GetDisposalMethod(unsigned int frame) const = 0;
|
|
|
|
virtual wxColour GetTransparentColour(unsigned int frame) const = 0;
|
|
|
|
virtual wxColour GetBackgroundColour() const = 0;
|
2006-10-09 13:51:07 -04:00
|
|
|
|
|
|
|
protected:
|
2020-03-30 17:53:11 -04:00
|
|
|
wxDECLARE_ABSTRACT_CLASS(wxAnimationBase);
|
2006-10-09 13:51:07 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxAnimationCtrlBase
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// do not autoresize to the animation's size when SetAnimation() is called
|
|
|
|
#define wxAC_NO_AUTORESIZE (0x0010)
|
|
|
|
|
|
|
|
// default style does not include wxAC_NO_AUTORESIZE, that is, the control
|
|
|
|
// auto-resizes by default to fit the new animation when SetAnimation() is called
|
2008-03-27 17:14:31 -04:00
|
|
|
#define wxAC_DEFAULT_STYLE (wxBORDER_NONE)
|
2006-10-09 13:51:07 -04:00
|
|
|
|
2018-08-27 10:34:34 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxAnimationCtrlBase : public wxControl
|
2006-10-09 13:51:07 -04:00
|
|
|
{
|
|
|
|
public:
|
2006-12-10 09:18:37 -05:00
|
|
|
wxAnimationCtrlBase() { }
|
2006-10-09 13:51:07 -04:00
|
|
|
|
2006-12-10 09:18:37 -05:00
|
|
|
// public API
|
|
|
|
virtual bool LoadFile(const wxString& filename,
|
|
|
|
wxAnimationType type = wxANIMATION_TYPE_ANY) = 0;
|
2008-05-17 18:51:52 -04:00
|
|
|
virtual bool Load(wxInputStream& stream,
|
|
|
|
wxAnimationType type = wxANIMATION_TYPE_ANY) = 0;
|
2006-10-09 13:51:07 -04:00
|
|
|
|
|
|
|
virtual bool Play() = 0;
|
|
|
|
virtual void Stop() = 0;
|
|
|
|
|
|
|
|
virtual bool IsPlaying() const = 0;
|
|
|
|
|
2006-11-18 12:46:29 -05:00
|
|
|
virtual void SetInactiveBitmap(const wxBitmap &bmp);
|
|
|
|
|
|
|
|
// always return the original bitmap set in this control
|
2006-10-21 09:51:38 -04:00
|
|
|
wxBitmap GetInactiveBitmap() const
|
|
|
|
{ return m_bmpStatic; }
|
|
|
|
|
|
|
|
protected:
|
2006-11-18 12:46:29 -05:00
|
|
|
// the inactive bitmap as it was set by the user
|
2006-10-21 09:51:38 -04:00
|
|
|
wxBitmap m_bmpStatic;
|
|
|
|
|
2006-11-18 12:46:29 -05:00
|
|
|
// the inactive bitmap currently shown in the control
|
|
|
|
// (may differ in the size from m_bmpStatic)
|
|
|
|
wxBitmap m_bmpStaticReal;
|
|
|
|
|
|
|
|
// updates m_bmpStaticReal from m_bmpStatic if needed
|
|
|
|
virtual void UpdateStaticImage();
|
|
|
|
|
|
|
|
// called by SetInactiveBitmap
|
|
|
|
virtual void DisplayStaticImage() = 0;
|
|
|
|
|
2006-10-09 13:51:07 -04:00
|
|
|
private:
|
2015-04-23 07:49:01 -04:00
|
|
|
wxDECLARE_ABSTRACT_CLASS(wxAnimationCtrlBase);
|
2006-10-09 13:51:07 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// include the platform-specific version of the wxAnimationCtrl class
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2020-03-30 17:53:11 -04:00
|
|
|
#if defined(__WXGTK20__)
|
|
|
|
#include "wx/generic/animate.h"
|
2006-10-09 13:51:07 -04:00
|
|
|
#include "wx/gtk/animate.h"
|
2020-03-25 19:29:34 -04:00
|
|
|
#else
|
2020-03-27 18:53:03 -04:00
|
|
|
#include "wx/generic/animate.h"
|
2020-03-27 17:33:11 -04:00
|
|
|
|
|
|
|
class WXDLLIMPEXP_ADV wxAnimation : public wxGenericAnimation
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxAnimation()
|
|
|
|
: wxGenericAnimation() {}
|
|
|
|
wxAnimation(const wxString &name, wxAnimationType type = wxANIMATION_TYPE_ANY)
|
|
|
|
: wxGenericAnimation(name, type) {}
|
2020-03-30 17:53:11 -04:00
|
|
|
wxAnimation(const wxGenericAnimation& other)
|
|
|
|
: wxGenericAnimation(other) {}
|
2020-03-27 17:33:11 -04:00
|
|
|
private:
|
|
|
|
wxDECLARE_DYNAMIC_CLASS(wxAnimation);
|
|
|
|
};
|
|
|
|
|
2020-03-25 19:29:34 -04:00
|
|
|
class WXDLLIMPEXP_ADV wxAnimationCtrl : public wxGenericAnimationCtrl
|
|
|
|
{
|
|
|
|
public:
|
2020-03-30 17:53:11 -04:00
|
|
|
wxAnimationCtrl()
|
2020-03-25 19:29:34 -04:00
|
|
|
: wxGenericAnimationCtrl()
|
|
|
|
{}
|
|
|
|
wxAnimationCtrl(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
2020-03-30 17:53:11 -04:00
|
|
|
const wxAnimation& anim = wxNullAnimation,
|
2020-03-25 19:29:34 -04:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxAC_DEFAULT_STYLE,
|
|
|
|
const wxString& name = wxAnimationCtrlNameStr)
|
|
|
|
: wxGenericAnimationCtrl(parent, id, anim, pos, size, style, name)
|
|
|
|
{}
|
2020-03-30 17:53:11 -04:00
|
|
|
|
|
|
|
virtual wxAnimation GetAnimation() const
|
|
|
|
{ return wxAnimation(m_animation) ; }
|
|
|
|
|
2020-03-25 19:29:34 -04:00
|
|
|
private:
|
|
|
|
wxDECLARE_DYNAMIC_CLASS(wxAnimationCtrl);
|
|
|
|
};
|
2006-10-09 13:51:07 -04:00
|
|
|
#endif
|
|
|
|
|
2006-12-10 09:18:37 -05:00
|
|
|
#endif // wxUSE_ANIMATIONCTRL
|
2006-10-09 13:51:07 -04:00
|
|
|
|
2006-12-10 09:18:37 -05:00
|
|
|
#endif // _WX_ANIMATE_H_
|