// ESAF : Euso Simulation and Analysis Framework
// $Id: EAnimator.hh,v 1.4 2005/02/18 01:47:43 thea Exp $
// Author: A.Thea   Aug,  5 2004

#ifndef __EANIMATOR_HH_
#define __EANIMATOR_HH_

#include "TObject.h"

/*******************************************************************************
 *
 * EAnimator: base class for all Euso Event Painter that are able to display
 * an animation
 *
 ******************************************************************************/

class TTimer;

class EAnimator : public TObject {
public:
    EAnimator();
    virtual ~EAnimator();

    virtual        void Play( Option_t *opt=""); // *MENU*
    virtual        void Stop(); // *MENU*
    virtual inline void Rewind() { fFrame = 0; } // *MENU*

    virtual        void Animate();
    virtual inline void NextFrame() { fFrame++; } // *MENU*


    virtual inline Bool_t  IsEnded();

    virtual inline TTimer* GetTimer() const { return fTimer; }
    virtual inline Int_t   GetFrame() const { return fFrame; }
    virtual inline Int_t   GetNumFrames() const { return fNumFrames; }

protected:

    TTimer *fTimer;

    Int_t fNumFrames;
    Int_t fFrame;

    ClassDef(EAnimator,1)
};

// inline functions

inline Bool_t EAnimator::IsEnded() {
    return (fFrame > fNumFrames-1);
}

#endif  /* __EANIMATOR_HH_ */