Hasty Badger
Small UI library (a branch of Turbo Badger)
 All Classes Namespaces Functions Variables Enumerations Enumerator Friends Groups Pages
tb::TBWidgetAnimationRect Class Reference

Animate the rectangle of the target widget. More...

#include <tb_widget_animation.h>

Inheritance diagram for tb::TBWidgetAnimationRect:
tb::TBWidgetAnimationObject tb::TBAnimationObject tb::TBLinkOf< TBWidgetAnimationObject > tb::TBTypedObject tb::TBLinkOf< TBAnimationObject > tb::TBLink tb::TBLink

Public Types

enum  MODE { MODE_SRC_TO_DST, MODE_DELTA_IN, MODE_DELTA_OUT }
 

Public Member Functions

 TBOBJECT_SUBCLASS (TBWidgetAnimationRect, TBWidgetAnimationObject)
 
 TBWidgetAnimationRect (TBWidget *widget, const TBRect &src_rect, const TBRect &dst_rect)
 Animate the widget between the given source and dest rectangle. More...
 
 TBWidgetAnimationRect (TBWidget *widget, const TBRect &delta_rect, MODE mode)
 Animate the widget between rectangles based on the current widget rectangle and a delta. More...
 
virtual void OnAnimationStart ()
 Called on animation start.
 
virtual void OnAnimationUpdate (float progress)
 Called on animation update. More...
 
virtual void OnAnimationStop (bool aborted)
 Called on animation stop. More...
 
- Public Member Functions inherited from tb::TBWidgetAnimationObject
 TBOBJECT_SUBCLASS (TBWidgetAnimationObject, TBAnimationObject)
 
 TBWidgetAnimationObject (TBWidget *widget)
 
- Public Member Functions inherited from tb::TBAnimationObject
 TBOBJECT_SUBCLASS (TBAnimationObject, TBTypedObject)
 
bool IsAnimating () const
 Return true if the object is currently animating. More...
 
void AddListener (TBAnimationListener *listener)
 Add a listener to this animation object. More...
 
void RemoveListener (TBAnimationListener *listener)
 Remove a listener from this animation object. More...
 
- Public Member Functions inherited from tb::TBTypedObject
virtual bool IsOfTypeId (const TB_TYPE_ID type_id) const
 Returns true if the class or the base class matches the type id.
 
template<class T >
T * SafeCastTo () const
 Returns this object as the given type or nullptr if it's not that type. More...
 
template<class T >
bool IsOfType () const
 Return true if this object can safely be casted to the given type. More...
 
virtual const char * GetClassName () const
 Get the classname of the object. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from tb::TBTypedObject
template<class T >
static TB_TYPE_ID GetTypeId ()
 A static template method that returns a unique id for each type. More...
 
- Public Attributes inherited from tb::TBWidgetAnimationObject
TBWidgetm_widget
 
- Public Attributes inherited from tb::TBAnimationObject
ANIMATION_CURVE animation_curve
 
double animation_start_time
 
double animation_duration
 
bool adjust_start_time
 

Detailed Description

Animate the rectangle of the target widget.

Member Enumeration Documentation

Enumerator
MODE_SRC_TO_DST 

Animate from source to dest.

MODE_DELTA_IN 

Animate from current + delta to current.

MODE_DELTA_OUT 

Animate from current to current + delta.

Constructor & Destructor Documentation

tb::TBWidgetAnimationRect::TBWidgetAnimationRect ( TBWidget widget,
const TBRect src_rect,
const TBRect dst_rect 
)

Animate the widget between the given source and dest rectangle.

tb::TBWidgetAnimationRect::TBWidgetAnimationRect ( TBWidget widget,
const TBRect delta_rect,
MODE  mode 
)

Animate the widget between rectangles based on the current widget rectangle and a delta.

The reference rectangle will be taken from the target widget on the first OnAnimationUpdate.

Member Function Documentation

void tb::TBWidgetAnimationRect::OnAnimationStop ( bool  aborted)
virtual

Called on animation stop.

aborted is true if it was aborted before completion. Note that if a animation is started when it's already running, it will first be aborted and then started again.

Implements tb::TBAnimationObject.

void tb::TBWidgetAnimationRect::OnAnimationUpdate ( float  progress)
virtual

Called on animation update.

progress is current progress from 0 to 1. Note that it isn't called on start, so progress 0 might not happen. It will be called with progress 1 before the animation is completed normally (not aborted)

this is certainly a BUG because it can be called from within the

Implements tb::TBAnimationObject.


The documentation for this class was generated from the following files: