1
// -------------------------------------------------------------------------------- //
2
// Copyright (C) 2008-2010 J.Rios
5
// This Program is free software; you can redistribute it and/or modify
6
// it under the terms of the GNU General Public License as published by
7
// the Free Software Foundation; either version 2, or (at your option)
10
// This Program is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
// GNU General Public License for more details.
15
// You should have received a copy of the GNU General Public License
16
// along with this program; see the file LICENSE. If not, write to
17
// the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
18
// http://www.gnu.org/copyleft/gpl.html
20
// Bassed on the QTimeLine class from QT
21
// -------------------------------------------------------------------------------- //
28
// -------------------------------------------------------------------------------- //
56
int m_CurrentLoopCount;
62
void ChangeCurrentTime( const int msec );
68
guDirection m_Direction;
70
guCurveShape m_CurveShape;
72
wxEvtHandler * m_Parent;
75
guTimeLine( int duration = 1000, wxEvtHandler * parent = NULL );
78
int Duration( void ) const { return m_Duration; }
79
void SetDuration( const int duration ) { m_Duration = duration; }
80
int UpdateInterval( void ) const { return m_UpdateInterval; }
81
void SetUpdateInterval( const int interval ) { m_UpdateInterval = interval; }
82
int CurrentTime( void ) const { return m_CurrentTime; }
83
void SetCurrentTime( const int time );
84
guDirection Direction( void ) const { return m_Direction; }
85
void SetDirection( const guDirection direction );
86
int LoopCount( void ) const { return m_LoopCount; }
87
void SetLoopCount( const int count ) { m_LoopCount = count; }
88
guCurveShape CurveShape( void ) const { return m_CurveShape; }
89
void SetCurveShape( const guCurveShape shape ) { m_CurveShape = shape; }
91
guState State( void ) const { return m_State; }
92
void SetState( guState state ) { if( m_State != state ) StateChanged( state ); }
94
int StartFrame( void ) const { return m_StartFrame; }
95
void SetStartFrame( const int frame ) { m_StartFrame = frame; }
96
int EndFrame( void ) const { return m_EndFrame; }
97
void SetEndFrame( const int frame ) { m_EndFrame = frame; }
98
void SetFrameRange( const int start, const int end ) { m_StartFrame = start; m_EndFrame = end; }
100
int CurrentFrame( void ) { return FrameForTime( m_CurrentTime ); }
101
float CurrentValue( void ) { return ValueForTime( m_CurrentTime ); }
103
int FrameForTime( int msec ) { return m_StartFrame + int( ( m_EndFrame - m_StartFrame ) * ValueForTime( msec ) ); }
104
virtual float ValueForTime( int msec );
108
void SetPaused( const bool paused );
109
void ToggleDirection( void ) { SetDirection( m_Direction == guTimeLine::Forward ? guTimeLine::Backward : guTimeLine::Forward ); }
111
virtual void ValueChanged( float value );
112
virtual void FrameChanged( int frame );
113
virtual void StateChanged( guState state );
114
virtual void Finished( void );
116
virtual void TimerEvent( void );
117
virtual int TimerCreate( void );
118
virtual void TimerDestroy( void ) { g_source_remove( m_TimerId ); }
123
// -------------------------------------------------------------------------------- //