animator.h

00001 /***************************************************************************
00002  *   Copyright (C) 2004 by Rick L. Vinyard, Jr.                            *
00003  *   rvinyard@cs.nmsu.edu                                                  *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU Lesser General Public License as        *
00007  *   published by the Free Software Foundation version 2.1.                *
00008  *                                                                         *
00009  *   This program is distributed in the hope that it will be useful,       *
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00012  *   GNU General Public License for more details.                          *
00013  *                                                                         *
00014  *   You should have received a copy of the GNU Lesser General Public      *
00015  *   License along with this library; if not, write to the                 *
00016  *   Free Software Foundation, Inc.,                                       *
00017  *   51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA              *
00018  ***************************************************************************/
00019 #ifndef PAPYRUSANIMATOR_H
00020 #define PAPYRUSANIMATOR_H
00021 
00022 #include <glib.h>
00023 
00024 #include <papyrus/object.h>
00025 
00026 namespace Papyrus {
00027 
00032 class Animator : public sigc::trackable
00033 {
00034 public:
00036   typedef PapyrusSmartPointer<Animator> pointer;
00037 
00038     Animator();
00039 
00040     ~Animator();
00041 
00043     virtual int advance(int n=1);
00044 
00046     virtual int reverse(int n=1);
00047 
00048     virtual void set_interval( unsigned int interval_ms );
00049 
00050     virtual unsigned int interval( );
00051 
00052     virtual double frame_rate( );
00053 
00066     virtual void set_frame_rate( unsigned int frames_per_second );
00067 
00068     virtual void start();
00069 
00070     virtual void start( unsigned int interval_ms );
00071 
00072     virtual void stop();
00073 
00074     virtual bool is_started();
00075 
00077     int bounce_frames();
00078 
00086     int bounce_direction();
00087 
00104     void set_bounce_frames( int frames );
00105 
00106     sigc::signal<void, int> signal_advanced();
00107 
00108   protected:
00109     unsigned int m_interval;
00110     int m_bounce_frames;
00111     int m_bounce_direction;
00112     int m_bounce_position;
00113     guint m_timeout_source_id;
00114 
00115     sigc::signal<void, int> m_signal_advanced;
00116 
00117     bool timeout_handler();
00118 
00130     virtual int animate( int n ) = 0;
00131 
00132   private:
00133     static gboolean timeout_handler_proxy( gpointer data );
00134 };
00135 
00136 }
00137 
00138 #endif

Generated on Sun Mar 11 10:01:27 2007 by  doxygen 1.5.1