Add static wxAnimationCtrl::CreateCompatibleAnimation()
This may be more convenient to use than CreateAnimation() if there is no wxAnimationCtrl object at hand.
This commit is contained in:
@@ -115,12 +115,16 @@ public:
|
|||||||
{ return m_bmpStatic; }
|
{ return m_bmpStatic; }
|
||||||
|
|
||||||
wxAnimation CreateAnimation() const
|
wxAnimation CreateAnimation() const
|
||||||
{ return wxAnimation(DoCreateAnimationImpl()); }
|
{ return MakeAnimFromImpl(DoCreateAnimationImpl()); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual wxAnimationImpl* DoCreateAnimationImpl() const = 0;
|
virtual wxAnimationImpl* DoCreateAnimationImpl() const = 0;
|
||||||
|
|
||||||
// This method allows derived classes access to wxAnimation::GetImpl().
|
// These methods allow derived classes access to private wxAnimation ctor
|
||||||
|
// and wxAnimation::GetImpl(), respectively.
|
||||||
|
static wxAnimation MakeAnimFromImpl(wxAnimationImpl* impl)
|
||||||
|
{ return wxAnimation(impl); }
|
||||||
|
|
||||||
wxAnimationImpl* GetAnimImpl() const
|
wxAnimationImpl* GetAnimImpl() const
|
||||||
{ return m_animation.GetImpl(); }
|
{ return m_animation.GetImpl(); }
|
||||||
|
|
||||||
|
@@ -64,6 +64,8 @@ public:
|
|||||||
// override base class method
|
// override base class method
|
||||||
virtual bool SetBackgroundColour(const wxColour& col) wxOVERRIDE;
|
virtual bool SetBackgroundColour(const wxColour& col) wxOVERRIDE;
|
||||||
|
|
||||||
|
static wxAnimation CreateCompatibleAnimation();
|
||||||
|
|
||||||
public: // event handlers
|
public: // event handlers
|
||||||
|
|
||||||
void OnPaint(wxPaintEvent& event);
|
void OnPaint(wxPaintEvent& event);
|
||||||
|
@@ -65,6 +65,8 @@ public: // public API
|
|||||||
|
|
||||||
bool SetBackgroundColour( const wxColour &colour ) wxOVERRIDE;
|
bool SetBackgroundColour( const wxColour &colour ) wxOVERRIDE;
|
||||||
|
|
||||||
|
static wxAnimation CreateCompatibleAnimation();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual wxAnimationImpl* DoCreateAnimationImpl() const wxOVERRIDE;
|
virtual wxAnimationImpl* DoCreateAnimationImpl() const wxOVERRIDE;
|
||||||
|
|
||||||
|
@@ -113,10 +113,22 @@ public:
|
|||||||
A wxAnimation object created using this function is always compatible
|
A wxAnimation object created using this function is always compatible
|
||||||
with controls of this type, see wxAnimation::IsCompatibleWith().
|
with controls of this type, see wxAnimation::IsCompatibleWith().
|
||||||
|
|
||||||
|
@see CreateCompatibleAnimation()
|
||||||
|
|
||||||
@since 3.1.4
|
@since 3.1.4
|
||||||
*/
|
*/
|
||||||
wxAnimation CreateAnimation() const;
|
wxAnimation CreateAnimation() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Create a new animation object compatible with this control.
|
||||||
|
|
||||||
|
This method does the same thing as CreateAnimation() but is static,
|
||||||
|
i.e. can be called without creating any wxAnimationCtrl objects.
|
||||||
|
|
||||||
|
@since 3.1.4
|
||||||
|
*/
|
||||||
|
static wxAnimation CreateCompatibleAnimation();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the animation associated with this control.
|
Returns the animation associated with this control.
|
||||||
*/
|
*/
|
||||||
|
@@ -225,6 +225,11 @@ bool wxGenericAnimationCtrl::Load(wxInputStream& stream, wxAnimationType type)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxAnimation wxGenericAnimationCtrl::CreateCompatibleAnimation()
|
||||||
|
{
|
||||||
|
return MakeAnimFromImpl(new wxAnimationGenericImpl());
|
||||||
|
}
|
||||||
|
|
||||||
wxAnimationImpl* wxGenericAnimationCtrl::DoCreateAnimationImpl() const
|
wxAnimationImpl* wxGenericAnimationCtrl::DoCreateAnimationImpl() const
|
||||||
{
|
{
|
||||||
return new wxAnimationGenericImpl();
|
return new wxAnimationGenericImpl();
|
||||||
|
@@ -265,6 +265,11 @@ bool wxAnimationCtrl::Load(wxInputStream& stream, wxAnimationType type)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxAnimation wxAnimationCtrl::CreateCompatibleAnimation()
|
||||||
|
{
|
||||||
|
return MakeAnimFromImpl(new wxAnimationGTKImpl());
|
||||||
|
}
|
||||||
|
|
||||||
wxAnimationImpl* wxAnimationCtrl::DoCreateAnimationImpl() const
|
wxAnimationImpl* wxAnimationCtrl::DoCreateAnimationImpl() const
|
||||||
{
|
{
|
||||||
return new wxAnimationGTKImpl();
|
return new wxAnimationGTKImpl();
|
||||||
|
Reference in New Issue
Block a user