Make wxAnimationImpl private and get rid of wxAnimationImplType
Simplify and streamline animation classes relationship: wxAnimation is the only public class representing an animation and it can be created by both the native wxAnimationCtrl and wxGenericAnimationCtrl using the new public CreateAnimation() method. Replace wxAnimationImplType enum with more flexible type info based check.
This commit is contained in:
@@ -26,21 +26,6 @@ enum wxAnimationType
|
||||
#define wxAC_NO_AUTORESIZE (0x0010)
|
||||
#define wxAC_DEFAULT_STYLE (wxBORDER_NONE)
|
||||
|
||||
/**
|
||||
Animation implementation types
|
||||
|
||||
@since 3.1.4
|
||||
*/
|
||||
enum wxAnimationImplType
|
||||
{
|
||||
/** With this flag wxAnimation will use a native implemetation if available. */
|
||||
wxANIMATION_IMPL_TYPE_NATIVE,
|
||||
/** Using this flag will cause wxAnimation to use a generic implementation. */
|
||||
wxANIMATION_IMPL_TYPE_GENERIC
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@class wxGenericAnimationCtrl
|
||||
|
||||
@@ -117,6 +102,16 @@ public:
|
||||
long style = wxAC_DEFAULT_STYLE,
|
||||
const wxString& name = wxAnimationCtrlNameStr);
|
||||
|
||||
/**
|
||||
Create a new animation object compatible with this control.
|
||||
|
||||
A wxAnimation object created using this function is always compatible
|
||||
with controls of this type, see wxAnimation::IsCompatibleWith().
|
||||
|
||||
@since 3.1.4
|
||||
*/
|
||||
wxAnimation CreateAnimation() const;
|
||||
|
||||
/**
|
||||
Returns the animation associated with this control.
|
||||
*/
|
||||
@@ -267,38 +262,6 @@ public:
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@class wxAnimationImpl
|
||||
|
||||
Abstract base class for native and generic animation classes. An instance
|
||||
of one of these classes is used by @c wxAnimation to handle the details of
|
||||
the interface between the animation file and the animation control.
|
||||
|
||||
@See wxAnimationGenericImpl
|
||||
*/
|
||||
class wxAnimationImpl : public wxObject, public wxRefCounter
|
||||
{
|
||||
public:
|
||||
wxAnimationImpl();
|
||||
|
||||
virtual wxAnimationImplType GetImplType() = 0;
|
||||
|
||||
virtual bool IsOk() const = 0;
|
||||
|
||||
virtual int GetDelay(unsigned int frame) const = 0;
|
||||
|
||||
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;
|
||||
virtual bool Load(wxInputStream& stream,
|
||||
wxAnimationType type = wxANIMATION_TYPE_ANY) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@class wxAnimation
|
||||
|
||||
@@ -314,15 +277,13 @@ class WXDLLIMPEXP_CORE wxAnimation : public wxObject
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Constructs a new animation object.
|
||||
Constructs a new empty animation object.
|
||||
|
||||
@param implType
|
||||
Specifies if the native or generic animation implementation should
|
||||
be used. Most of the time this can be ignored, but if you want to
|
||||
force the use of the generic back-end implementation on a platform
|
||||
which has a native version, then pass ::wxANIMATION_IMPL_TYPE_GENERIC.
|
||||
Call Load() to initialize it.
|
||||
|
||||
@see wxAnimationCtrl::CreateAnimation()
|
||||
*/
|
||||
wxAnimation(wxAnimationImplType implType = wxANIMATION_IMPL_TYPE_NATIVE);
|
||||
wxAnimation();
|
||||
|
||||
/**
|
||||
Constructs a new animation object and load the animation data from the
|
||||
@@ -333,30 +294,34 @@ public:
|
||||
@param type
|
||||
One of the ::wxAnimationType values; wxANIMATION_TYPE_ANY
|
||||
means that the function should try to autodetect the filetype.
|
||||
@param implType
|
||||
Specifies if the native or generic animation implementation should
|
||||
be used. Most of the time this can be ignored, but if you want to
|
||||
force the use of the generic back-end implementation on a platform
|
||||
which has a native version, then pass ::wxANIMATION_IMPL_TYPE_GENERIC.
|
||||
|
||||
@see wxAnimationCtrl::CreateAnimation()
|
||||
*/
|
||||
wxAnimation(const wxString &name, wxAnimationType type = wxANIMATION_TYPE_ANY,
|
||||
wxAnimationImplType implType = wxANIMATION_IMPL_TYPE_NATIVE);
|
||||
wxAnimation(const wxString &name, wxAnimationType type = wxANIMATION_TYPE_ANY);
|
||||
|
||||
/**
|
||||
Copy constructor.
|
||||
*/
|
||||
wxAnimation(const wxAnimation& other);
|
||||
|
||||
/**
|
||||
Returns a pointer to the backend animation implementation object.
|
||||
*/
|
||||
wxAnimationImpl* GetImpl() const;
|
||||
|
||||
/**
|
||||
Returns @true if animation data is present.
|
||||
*/
|
||||
bool IsOk() const;
|
||||
|
||||
/**
|
||||
Returns @true if animation can be used with controls of the given type.
|
||||
|
||||
This function checks if this animation object can be used with
|
||||
wxAnimationCtrl of particular type. This will be always the case for
|
||||
the platforms where only a single wxAnimationCtrl implementation is
|
||||
available, but not necessarily under e.g. wxGTK where both native (but
|
||||
limited) GTK implementation and generic implementation can be used.
|
||||
|
||||
@since 3.1.4
|
||||
*/
|
||||
bool IsCompatibleWith(wxClassInfo* ci) const;
|
||||
|
||||
/**
|
||||
Returns the delay for the i-th frame in milliseconds.
|
||||
If @c -1 is returned the frame is to be displayed forever.
|
||||
|
Reference in New Issue
Block a user