Version: 3.3.0
wxAnimationBundle Class Reference

#include <wx/animate.h>

Detailed Description

Container for possible multiple versions of the same animation in different resolutions.

This class is used to pass either one or multiple animations to use in wxAnimationCtrl. If it contains multiple elements, they must be added to it using its Add() function in ascending size order and, in particular, the first element defines the size of the animation in standard DPI, with the other elements containing versions of the animation to use in higher DPI.

Example of using this class to pass a normal and high DPI version of a "throbbing" animation to the control and let it choose the one most appropriate to the current resolution automatically:

auto animationCtrl = new wxAnimationCtrl(parent, wxID_ANY);
wxAnimationBundle animations;
animations.Add("throbber.gif");
animations.Add("throbber_2x.gif");
if ( animationCtrl->SetAnimation(animations) )
animationCtrl->Play();
Container for possible multiple versions of the same animation in different resolutions.
Definition: animate.h:56
void Add(const wxAnimation &anim)
Add an animation in another, bigger, size.
This is a static control which displays an animation.
Definition: animate.h:141
@ wxID_ANY
Any id: means that we don't care about the id, whether when installing an event handler or when creat...
Definition: defs.h:590
Since
3.3.0

Public Member Functions

 wxAnimationBundle ()=default
 Default constructor creates an empty bundle. More...
 
 wxAnimationBundle (const wxAnimation &anim)
 Implicit ctor from wxAnimation for backwards compatibility. More...
 
 wxAnimationBundle (const wxString &filename, wxAnimationType type=wxANIMATION_TYPE_ANY)
 Implicit ctor from animation file name for backwards compatibility. More...
 
 wxAnimationBundle (const wxAnimationBundle &)=default
 
wxAnimationBundleoperator= (const wxAnimationBundle &)=default
 
 ~wxAnimationBundle ()=default
 
void Add (const wxAnimation &anim)
 Add an animation in another, bigger, size. More...
 
void Add (const wxString &filename, wxAnimationType type=wxANIMATION_TYPE_ANY)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
const std::vector< wxAnimation > & GetAll () const
 Get vector containing all animations in this bundle. More...
 
bool IsOk () const
 Return true if this animation bundle is not empty. More...
 

Constructor & Destructor Documentation

◆ wxAnimationBundle() [1/4]

wxAnimationBundle::wxAnimationBundle ( )
default

Default constructor creates an empty bundle.

Call Add() later.

◆ wxAnimationBundle() [2/4]

wxAnimationBundle::wxAnimationBundle ( const wxAnimation anim)

Implicit ctor from wxAnimation for backwards compatibility.

◆ wxAnimationBundle() [3/4]

wxAnimationBundle::wxAnimationBundle ( const wxString filename,
wxAnimationType  type = wxANIMATION_TYPE_ANY 
)

Implicit ctor from animation file name for backwards compatibility.

◆ wxAnimationBundle() [4/4]

wxAnimationBundle::wxAnimationBundle ( const wxAnimationBundle )
default

◆ ~wxAnimationBundle()

wxAnimationBundle::~wxAnimationBundle ( )
default

Member Function Documentation

◆ Add() [1/2]

void wxAnimationBundle::Add ( const wxAnimation anim)

Add an animation in another, bigger, size.

◆ Add() [2/2]

void wxAnimationBundle::Add ( const wxString filename,
wxAnimationType  type = wxANIMATION_TYPE_ANY 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ GetAll()

const std::vector<wxAnimation>& wxAnimationBundle::GetAll ( ) const

Get vector containing all animations in this bundle.

The vector can be empty.

◆ IsOk()

bool wxAnimationBundle::IsOk ( ) const

Return true if this animation bundle is not empty.

Notice that any elements of the bundle are always valid animations.

◆ operator=()

wxAnimationBundle& wxAnimationBundle::operator= ( const wxAnimationBundle )
default