00001 00002 /* 00003 TEDDY - General graphics application library 00004 Copyright (C) 1999-2002 Timo Suoranta 00005 tksuoran@cc.helsinki.fi 00006 00007 This library is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU Lesser General Public 00009 License as published by the Free Software Foundation; either 00010 version 2.1 of the License, or (at your option) any later version. 00011 00012 This library is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 Lesser General Public License for more details. 00016 00017 You should have received a copy of the GNU Lesser General Public 00018 License along with this library; if not, write to the Free Software 00019 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 00021 $Id: $ 00022 */ 00023 00024 00025 #ifndef TEDDY__BEHAVIOUR__CONTROL__H 00026 #define TEDDY__BEHAVIOUR__CONTROL__H 00027 00028 00029 #include "Teddy/MixIn/Tick.h" 00030 #include "Teddy/MixIn/Options.h" 00031 00032 00033 namespace Teddy { 00034 namespace Behaviour { 00035 00036 00037 class Control 00038 : 00039 public Teddy::MixIn::Options, 00040 public Teddy::MixIn::Tick 00041 { 00042 public: 00043 static const unsigned long RESERVED ; 00044 static const unsigned long MORE ; 00045 static const unsigned long LESS ; 00046 static const unsigned long STOP ; 00047 static const unsigned long ACTIVE ; 00048 static const unsigned long INHIBIT ; 00049 static const unsigned long DAMPEN_LINEAR ; 00050 static const unsigned long DAMPEN_MULTIPLY ; 00051 static const unsigned long DAMPEN_MASTER ; 00052 00053 static const unsigned long RESERVED_M ; 00054 static const unsigned long MORE_M ; 00055 static const unsigned long LESS_M ; 00056 static const unsigned long STOP_M ; 00057 static const unsigned long ACTIVE_M ; 00058 static const unsigned long INHIBIT_M ; 00059 static const unsigned long DAMPEN_LINEAR_M ; 00060 static const unsigned long DAMPEN_MULTIPLY_M; 00061 static const unsigned long DAMPEN_MASTER_M ; 00062 00063 static const unsigned long CLEAR_M ; 00064 00065 public: 00066 Control( double max_delta, double max, Teddy::MixIn::Options options, double dampen_const ); 00067 00068 // Teddy::MixIn::Tick API 00069 virtual void tick(); 00070 00071 // BaseControl API 00072 void setValue ( double value ); 00073 double getValue () const; 00074 double getMin () const; 00075 double getMax () const; 00076 double getDelta () const; 00077 double getDampConst () const; 00078 void setDelta ( double max_delta ); 00079 void setDampConst ( double dampen_const ); 00080 void adjust ( double analog ); 00081 void more ( bool apply ); 00082 void less ( bool apply ); 00083 void stop ( bool apply ); 00084 void inhibit ( bool apply ); 00085 void clear (); 00086 void dampen (); 00087 00088 protected: 00089 double dampen_const; 00090 double max_delta; 00091 double min; 00092 double max; 00093 double c_delta; 00094 double c_value; 00095 }; 00096 00097 00098 }; // namespace Behaviour 00099 }; // namespace Teddy 00100 00101 00102 #endif // TEDDY__BEHAVIOUR__CONTROL__H 00103