File indexing completed on 2024-11-03 03:47:17

0001 //
0002 // C++ Interface: cgauge
0003 //
0004 // Description: One gauge (no GUI). It maintains the GUI item though.
0005 //
0006 /*
0007 Copyright 2004-2011 Tomas Mecir <kmuddy@kmuddy.com>
0008 
0009 This program is free software; you can redistribute it and/or
0010 modify it under the terms of the GNU General Public License as
0011 published by the Free Software Foundation; either version 2 of 
0012 the License, or (at your option) any later version.
0013 
0014 This program is distributed in the hope that it will be useful,
0015 but WITHOUT ANY WARRANTY; without even the implied warranty of
0016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0017 GNU General Public License for more details.
0018 
0019 You should have received a copy of the GNU General Public License
0020 along with this program.  If not, see <http://www.gnu.org/licenses/>.
0021 */
0022 #ifndef CGAUGE_H
0023 #define CGAUGE_H
0024 
0025 #include "csaveablefield.h"
0026 
0027 #include <qcolor.h>
0028 
0029 class cGaugeBarItem;
0030 
0031 /**
0032 This class represents one gauge. It stores necessary information, but doesn't paint anything.
0033 
0034 @author Tomas Mecir
0035 */
0036 
0037 class cGauge : public cSaveableField
0038 {
0039  public:
0040   /** constructor */
0041   cGauge (int _sess);
0042   /** destructor */
0043   ~cGauge() override;
0044   
0045   /** creates a new instance of the class */
0046   cSaveableField *newInstance () override;
0047 
0048     /** load data from a config file*/
0049   void load (KConfig *config, const QString &group) override;
0050 
0051   /** returns type of item (light-weight RTTI) */
0052   int itemType () override { return TYPE_GAUGE; };
0053   
0054   const QString &variable () { return _variable; };
0055   const QString &maxVariable () { return _maxvariable; };
0056   const QString &caption () { return _caption; };
0057   const QColor &color () { return _color; };
0058   bool hidden () { return _hidden; };
0059   
0060   void setVariable (const QString &val);
0061   void setMaxVariable (const QString &val);
0062   void setCaption (const QString &val);
0063   void setColor (const QColor &c);
0064   void setHidden (bool h);
0065 
0066   int varValue () { return varvalue; };
0067   int maxVarValue () { return maxvarvalue; };
0068   
0069  protected:
0070   QString _variable, _maxvariable, _caption;
0071   int varvalue, maxvarvalue;
0072   QColor _color;
0073   bool _hidden;
0074   int sess;
0075 };
0076 
0077 #endif