Name the base animation class wxGenericAnimation with a wxAnimation shim class
This commit is contained in:
@@ -20,10 +20,9 @@
|
|||||||
#include "wx/timer.h"
|
#include "wx/timer.h"
|
||||||
#include "wx/bitmap.h"
|
#include "wx/bitmap.h"
|
||||||
|
|
||||||
class WXDLLIMPEXP_FWD_CORE wxAnimation;
|
class WXDLLIMPEXP_FWD_CORE wxGenericAnimation;
|
||||||
//class WXDLLIMPEXP_FWD_CORE wxAnimationGeneric;
|
|
||||||
|
|
||||||
extern WXDLLIMPEXP_DATA_CORE(wxAnimation) wxNullAnimation;
|
extern WXDLLIMPEXP_DATA_CORE(wxGenericAnimation) wxNullAnimation;
|
||||||
extern WXDLLIMPEXP_DATA_CORE(const char) wxAnimationCtrlNameStr[];
|
extern WXDLLIMPEXP_DATA_CORE(const char) wxAnimationCtrlNameStr[];
|
||||||
|
|
||||||
|
|
||||||
@@ -99,8 +98,8 @@ public:
|
|||||||
virtual bool Load(wxInputStream& stream,
|
virtual bool Load(wxInputStream& stream,
|
||||||
wxAnimationType type = wxANIMATION_TYPE_ANY) = 0;
|
wxAnimationType type = wxANIMATION_TYPE_ANY) = 0;
|
||||||
|
|
||||||
virtual void SetAnimation(const wxAnimation &anim) = 0;
|
virtual void SetAnimation(const wxGenericAnimation &anim) = 0;
|
||||||
virtual wxAnimation GetAnimation() const = 0;
|
virtual wxGenericAnimation GetAnimation() const = 0;
|
||||||
|
|
||||||
virtual bool Play() = 0;
|
virtual bool Play() = 0;
|
||||||
virtual void Stop() = 0;
|
virtual void Stop() = 0;
|
||||||
@@ -139,6 +138,7 @@ private:
|
|||||||
#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
|
#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
|
||||||
#include "wx/gtk/animate.h"
|
#include "wx/gtk/animate.h"
|
||||||
#else
|
#else
|
||||||
|
#include "wx/generic/animate.h"
|
||||||
|
|
||||||
class WXDLLIMPEXP_ADV wxAnimation : public wxGenericAnimation
|
class WXDLLIMPEXP_ADV wxAnimation : public wxGenericAnimation
|
||||||
{
|
{
|
||||||
@@ -151,8 +151,6 @@ private:
|
|||||||
wxDECLARE_DYNAMIC_CLASS(wxAnimation);
|
wxDECLARE_DYNAMIC_CLASS(wxAnimation);
|
||||||
};
|
};
|
||||||
|
|
||||||
#include "wx/generic/animate.h"
|
|
||||||
|
|
||||||
class WXDLLIMPEXP_ADV wxAnimationCtrl : public wxGenericAnimationCtrl
|
class WXDLLIMPEXP_ADV wxAnimationCtrl : public wxGenericAnimationCtrl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -161,7 +159,7 @@ private:
|
|||||||
{}
|
{}
|
||||||
wxAnimationCtrl(wxWindow *parent,
|
wxAnimationCtrl(wxWindow *parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
const wxAnimation& anim = wxNullAnimation,
|
const wxGenericAnimation& anim = wxNullAnimation,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxSize& size = wxDefaultSize,
|
const wxSize& size = wxDefaultSize,
|
||||||
long style = wxAC_DEFAULT_STYLE,
|
long style = wxAC_DEFAULT_STYLE,
|
||||||
|
@@ -23,7 +23,7 @@ public:
|
|||||||
wxGenericAnimationCtrl() { Init(); }
|
wxGenericAnimationCtrl() { Init(); }
|
||||||
wxGenericAnimationCtrl(wxWindow *parent,
|
wxGenericAnimationCtrl(wxWindow *parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
const wxAnimation& anim = wxNullAnimation,
|
const wxGenericAnimation& anim = wxNullAnimation,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxSize& size = wxDefaultSize,
|
const wxSize& size = wxDefaultSize,
|
||||||
long style = wxAC_DEFAULT_STYLE,
|
long style = wxAC_DEFAULT_STYLE,
|
||||||
@@ -37,7 +37,7 @@ public:
|
|||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
bool Create(wxWindow *parent, wxWindowID id,
|
bool Create(wxWindow *parent, wxWindowID id,
|
||||||
const wxAnimation& anim = wxNullAnimation,
|
const wxGenericAnimation& anim = wxNullAnimation,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxSize& size = wxDefaultSize,
|
const wxSize& size = wxDefaultSize,
|
||||||
long style = wxAC_DEFAULT_STYLE,
|
long style = wxAC_DEFAULT_STYLE,
|
||||||
@@ -55,8 +55,8 @@ public:
|
|||||||
virtual bool IsPlaying() const wxOVERRIDE
|
virtual bool IsPlaying() const wxOVERRIDE
|
||||||
{ return m_isPlaying; }
|
{ return m_isPlaying; }
|
||||||
|
|
||||||
void SetAnimation(const wxAnimation &animation) wxOVERRIDE;
|
void SetAnimation(const wxGenericAnimation &animation) wxOVERRIDE;
|
||||||
wxAnimation GetAnimation() const wxOVERRIDE
|
wxGenericAnimation GetAnimation() const wxOVERRIDE
|
||||||
{ return m_animation; }
|
{ return m_animation; }
|
||||||
|
|
||||||
virtual void SetInactiveBitmap(const wxBitmap &bmp) wxOVERRIDE;
|
virtual void SetInactiveBitmap(const wxBitmap &bmp) wxOVERRIDE;
|
||||||
@@ -111,7 +111,7 @@ protected:
|
|||||||
unsigned int m_currentFrame; // Current frame
|
unsigned int m_currentFrame; // Current frame
|
||||||
bool m_looped; // Looped, or not
|
bool m_looped; // Looped, or not
|
||||||
wxTimer m_timer; // The timer
|
wxTimer m_timer; // The timer
|
||||||
wxAnimation m_animation; // The animation
|
wxGenericAnimation m_animation; // The animation
|
||||||
|
|
||||||
bool m_isPlaying; // Is the animation playing?
|
bool m_isPlaying; // Is the animation playing?
|
||||||
bool m_useWinBackgroundColour; // Use animation bg colour or window bg colour?
|
bool m_useWinBackgroundColour; // Use animation bg colour or window bg colour?
|
||||||
|
@@ -28,7 +28,7 @@ enum wxAnimationType
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@class wxAnimationCtrl
|
@class wxGenericAnimationCtrl
|
||||||
|
|
||||||
This is a static control which displays an animation.
|
This is a static control which displays an animation.
|
||||||
wxAnimationCtrl API is as simple as possible and won't give you full control
|
wxAnimationCtrl API is as simple as possible and won't give you full control
|
||||||
@@ -57,15 +57,15 @@ enum wxAnimationType
|
|||||||
|
|
||||||
@see wxAnimation, @sample{animate}
|
@see wxAnimation, @sample{animate}
|
||||||
*/
|
*/
|
||||||
class wxAnimationCtrl : public wxControl
|
class wxGenericAnimationCtrl : public wxControl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
Initializes the object and calls Create() with
|
Initializes the object and calls Create() with
|
||||||
all the parameters.
|
all the parameters.
|
||||||
*/
|
*/
|
||||||
wxAnimationCtrl(wxWindow* parent, wxWindowID id,
|
wxGenericAnimationCtrl(wxWindow* parent, wxWindowID id,
|
||||||
const wxAnimation& anim = wxNullAnimation,
|
const wxGenericAnimation& anim = wxNullAnimation,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxSize& size = wxDefaultSize,
|
const wxSize& size = wxDefaultSize,
|
||||||
long style = wxAC_DEFAULT_STYLE,
|
long style = wxAC_DEFAULT_STYLE,
|
||||||
@@ -97,7 +97,7 @@ public:
|
|||||||
creation failed.
|
creation failed.
|
||||||
*/
|
*/
|
||||||
bool Create(wxWindow* parent, wxWindowID id,
|
bool Create(wxWindow* parent, wxWindowID id,
|
||||||
const wxAnimation& anim = wxNullAnimation,
|
const wxGenericAnimation& anim = wxNullAnimation,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxSize& size = wxDefaultSize,
|
const wxSize& size = wxDefaultSize,
|
||||||
long style = wxAC_DEFAULT_STYLE,
|
long style = wxAC_DEFAULT_STYLE,
|
||||||
@@ -106,7 +106,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
Returns the animation associated with this control.
|
Returns the animation associated with this control.
|
||||||
*/
|
*/
|
||||||
virtual wxAnimation GetAnimation() const;
|
virtual wxGenericAnimation GetAnimation() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the inactive bitmap shown in this control when the;
|
Returns the inactive bitmap shown in this control when the;
|
||||||
@@ -150,7 +150,7 @@ public:
|
|||||||
animation or the background colour will be shown
|
animation or the background colour will be shown
|
||||||
(see SetInactiveBitmap() for more info).
|
(see SetInactiveBitmap() for more info).
|
||||||
*/
|
*/
|
||||||
virtual void SetAnimation(const wxAnimation& anim);
|
virtual void SetAnimation(const wxGenericAnimation& anim);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Sets the bitmap to show on the control when it's not playing an animation.
|
Sets the bitmap to show on the control when it's not playing an animation.
|
||||||
@@ -221,9 +221,31 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxAnimationCtrl
|
||||||
|
|
||||||
|
If the platform supports a native animation control (currently just wxGTK)
|
||||||
|
then this class implements the control via the native widget.
|
||||||
|
Otherwise it is virtually the same as @c wxGenericAnimationCtrl.
|
||||||
|
*/
|
||||||
|
|
||||||
|
class wxAnimationCtrl : public wxGenericAnimationCtrl
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxAnimationCtrl();
|
||||||
|
wxAnimationCtrl(wxWindow *parent,
|
||||||
|
wxWindowID id,
|
||||||
|
const wxGenericAnimation& anim = wxNullAnimation,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxAC_DEFAULT_STYLE,
|
||||||
|
const wxString& name = wxAnimationCtrlNameStr);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@class wxAnimation
|
@class wxGenericAnimation
|
||||||
|
|
||||||
This class encapsulates the concept of a platform-dependent animation.
|
This class encapsulates the concept of a platform-dependent animation.
|
||||||
An animation is a sequence of frames of the same size.
|
An animation is a sequence of frames of the same size.
|
||||||
@@ -246,18 +268,18 @@ public:
|
|||||||
|
|
||||||
@see wxAnimationCtrl, @sample{animate}
|
@see wxAnimationCtrl, @sample{animate}
|
||||||
*/
|
*/
|
||||||
class wxAnimation : public wxObject
|
class wxGenericAnimation : public wxObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
Default ctor.
|
Default ctor.
|
||||||
*/
|
*/
|
||||||
wxAnimation();
|
wxGenericAnimation();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Copy ctor.
|
Copy ctor.
|
||||||
*/
|
*/
|
||||||
wxAnimation(const wxAnimation& anim);
|
// wxAnimation(const wxAnimation& anim);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Loads an animation from a file.
|
Loads an animation from a file.
|
||||||
@@ -267,14 +289,14 @@ public:
|
|||||||
@param type
|
@param type
|
||||||
See LoadFile() for more info.
|
See LoadFile() for more info.
|
||||||
*/
|
*/
|
||||||
wxAnimation(const wxString& name,
|
wxGenericAnimation(const wxString& name,
|
||||||
wxAnimationType type = wxANIMATION_TYPE_ANY);
|
wxAnimationType type = wxANIMATION_TYPE_ANY);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Destructor.
|
Destructor.
|
||||||
See @ref overview_refcount_destruct for more info.
|
See @ref overview_refcount_destruct for more info.
|
||||||
*/
|
*/
|
||||||
virtual ~wxAnimation();
|
virtual ~wxGenericAnimation();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the delay for the i-th frame in milliseconds.
|
Returns the delay for the i-th frame in milliseconds.
|
||||||
@@ -395,6 +417,21 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxAnimation
|
||||||
|
|
||||||
|
If the platform supports a native animation control (currently just wxGTK)
|
||||||
|
then this is the animation class that should be used with @c wxAnimationCtrl.
|
||||||
|
Otherwise it is virtually the same as @c wxGenericAnimation.
|
||||||
|
*/
|
||||||
|
class wxAnimation : public wxGenericAnimation
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxAnimation();
|
||||||
|
wxAnimation(const wxString &name, wxAnimationType type = wxANIMATION_TYPE_ANY);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// Global functions/macros
|
// Global functions/macros
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
@@ -402,5 +439,5 @@ public:
|
|||||||
/**
|
/**
|
||||||
An empty animation object.
|
An empty animation object.
|
||||||
*/
|
*/
|
||||||
wxAnimation wxNullAnimation;
|
wxGenericAnimation wxNullAnimation;
|
||||||
|
|
||||||
|
@@ -32,7 +32,7 @@
|
|||||||
const char wxAnimationCtrlNameStr[] = "animationctrl";
|
const char wxAnimationCtrlNameStr[] = "animationctrl";
|
||||||
|
|
||||||
// global object
|
// global object
|
||||||
wxAnimation wxNullAnimation;
|
wxGenericAnimation wxNullAnimation;
|
||||||
|
|
||||||
wxIMPLEMENT_DYNAMIC_CLASS(wxAnimation, wxGenericAnimation);
|
wxIMPLEMENT_DYNAMIC_CLASS(wxAnimation, wxGenericAnimation);
|
||||||
wxIMPLEMENT_ABSTRACT_CLASS(wxAnimationCtrlBase, wxControl);
|
wxIMPLEMENT_ABSTRACT_CLASS(wxAnimationCtrlBase, wxControl);
|
||||||
|
@@ -282,7 +282,7 @@ void wxGenericAnimationCtrl::Init()
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool wxGenericAnimationCtrl::Create(wxWindow *parent, wxWindowID id,
|
bool wxGenericAnimationCtrl::Create(wxWindow *parent, wxWindowID id,
|
||||||
const wxAnimation& animation, const wxPoint& pos,
|
const wxGenericAnimation& animation, const wxPoint& pos,
|
||||||
const wxSize& size, long style, const wxString& name)
|
const wxSize& size, long style, const wxString& name)
|
||||||
{
|
{
|
||||||
m_timer.SetOwner(this);
|
m_timer.SetOwner(this);
|
||||||
@@ -329,7 +329,7 @@ wxSize wxGenericAnimationCtrl::DoGetBestSize() const
|
|||||||
return FromDIP(wxSize(100, 100));
|
return FromDIP(wxSize(100, 100));
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGenericAnimationCtrl::SetAnimation(const wxAnimation& animation)
|
void wxGenericAnimationCtrl::SetAnimation(const wxGenericAnimation& animation)
|
||||||
{
|
{
|
||||||
if (IsPlaying())
|
if (IsPlaying())
|
||||||
Stop();
|
Stop();
|
||||||
|
Reference in New Issue
Block a user