2006-10-09 17:51:07 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/animate.h
|
|
|
|
// Purpose: wxAnimation and wxAnimationCtrl
|
|
|
|
// Author: Julian Smart and Guillermo Rodriguez Garcia
|
|
|
|
// Modified by: Francesco Montorsi
|
|
|
|
// Created: 13/8/99
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) Julian Smart and Guillermo Rodriguez Garcia
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2006-12-10 14:18:37 +00:00
|
|
|
#ifndef _WX_ANIMATE_H_
|
|
|
|
#define _WX_ANIMATE_H_
|
2006-10-09 17:51:07 +00:00
|
|
|
|
|
|
|
#include "wx/defs.h"
|
|
|
|
|
|
|
|
#if wxUSE_ANIMATIONCTRL
|
|
|
|
|
2006-10-10 04:27:54 +00:00
|
|
|
#include "wx/animdecod.h"
|
|
|
|
#include "wx/control.h"
|
|
|
|
#include "wx/timer.h"
|
2006-10-21 13:51:38 +00:00
|
|
|
#include "wx/bitmap.h"
|
2006-10-09 17:51:07 +00:00
|
|
|
|
2007-07-09 10:09:52 +00:00
|
|
|
class WXDLLIMPEXP_FWD_ADV wxAnimation;
|
2006-10-09 17:51:07 +00:00
|
|
|
|
2006-10-09 23:13:45 +00:00
|
|
|
extern WXDLLIMPEXP_DATA_ADV(wxAnimation) wxNullAnimation;
|
2008-11-02 22:16:14 +00:00
|
|
|
extern WXDLLIMPEXP_DATA_ADV(const char) wxAnimationCtrlNameStr[];
|
2006-10-09 17:51:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxAnimationBase
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2007-12-15 17:54:20 +00:00
|
|
|
class WXDLLIMPEXP_ADV wxAnimationBase : public wxObject
|
2006-10-09 17:51:07 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxAnimationBase() {}
|
|
|
|
|
|
|
|
virtual bool IsOk() const = 0;
|
|
|
|
|
|
|
|
// can be -1
|
2006-12-10 14:18:37 +00:00
|
|
|
virtual int GetDelay(unsigned int frame) const = 0;
|
2006-10-09 17:51:07 +00:00
|
|
|
|
2006-12-10 14:18:37 +00:00
|
|
|
virtual unsigned int GetFrameCount() const = 0;
|
|
|
|
virtual wxImage GetFrame(unsigned int frame) const = 0;
|
2006-10-09 17:51:07 +00:00
|
|
|
virtual wxSize GetSize() const = 0;
|
|
|
|
|
2006-12-10 14:18:37 +00:00
|
|
|
virtual bool LoadFile(const wxString& name,
|
|
|
|
wxAnimationType type = wxANIMATION_TYPE_ANY) = 0;
|
|
|
|
virtual bool Load(wxInputStream& stream,
|
|
|
|
wxAnimationType type = wxANIMATION_TYPE_ANY) = 0;
|
2006-10-09 17:51:07 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
DECLARE_ABSTRACT_CLASS(wxAnimationBase)
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// 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 21:14:31 +00:00
|
|
|
#define wxAC_DEFAULT_STYLE (wxBORDER_NONE)
|
2006-10-09 17:51:07 +00:00
|
|
|
|
|
|
|
class WXDLLIMPEXP_ADV wxAnimationCtrlBase : public wxControl
|
|
|
|
{
|
|
|
|
public:
|
2006-12-10 14:18:37 +00:00
|
|
|
wxAnimationCtrlBase() { }
|
2006-10-09 17:51:07 +00:00
|
|
|
|
2006-12-10 14:18:37 +00:00
|
|
|
// public API
|
|
|
|
virtual bool LoadFile(const wxString& filename,
|
|
|
|
wxAnimationType type = wxANIMATION_TYPE_ANY) = 0;
|
2008-05-17 22:51:52 +00:00
|
|
|
virtual bool Load(wxInputStream& stream,
|
|
|
|
wxAnimationType type = wxANIMATION_TYPE_ANY) = 0;
|
2006-10-09 17:51:07 +00:00
|
|
|
|
|
|
|
virtual void SetAnimation(const wxAnimation &anim) = 0;
|
|
|
|
virtual wxAnimation GetAnimation() const = 0;
|
|
|
|
|
|
|
|
virtual bool Play() = 0;
|
|
|
|
virtual void Stop() = 0;
|
|
|
|
|
|
|
|
virtual bool IsPlaying() const = 0;
|
|
|
|
|
2006-11-18 17:46:29 +00:00
|
|
|
virtual void SetInactiveBitmap(const wxBitmap &bmp);
|
|
|
|
|
|
|
|
// always return the original bitmap set in this control
|
2006-10-21 13:51:38 +00:00
|
|
|
wxBitmap GetInactiveBitmap() const
|
|
|
|
{ return m_bmpStatic; }
|
|
|
|
|
|
|
|
protected:
|
2006-11-18 17:46:29 +00:00
|
|
|
// the inactive bitmap as it was set by the user
|
2006-10-21 13:51:38 +00:00
|
|
|
wxBitmap m_bmpStatic;
|
|
|
|
|
2006-11-18 17:46:29 +00: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 17:51:07 +00:00
|
|
|
private:
|
|
|
|
DECLARE_ABSTRACT_CLASS(wxAnimationCtrlBase)
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// include the platform-specific version of the wxAnimationCtrl class
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2006-10-18 03:32:52 +00:00
|
|
|
#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
|
2006-10-09 17:51:07 +00:00
|
|
|
#include "wx/gtk/animate.h"
|
|
|
|
#else
|
|
|
|
#include "wx/generic/animate.h"
|
|
|
|
#endif
|
|
|
|
|
2006-12-10 14:18:37 +00:00
|
|
|
#endif // wxUSE_ANIMATIONCTRL
|
2006-10-09 17:51:07 +00:00
|
|
|
|
2006-12-10 14:18:37 +00:00
|
|
|
#endif // _WX_ANIMATE_H_
|