File indexing completed on 2024-04-14 03:59:56

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 
0023 #ifndef CGAUGE_H
0024 #define CGAUGE_H
0025 
0026 #include "clistobject.h"
0027 
0028 #include <qcolor.h>
0029 
0030 class cGaugeBarItem;
0031 
0032 /**
0033 This class represents one gauge. It stores necessary information, but doesn't paint anything.
0034 
0035 @author Tomas Mecir
0036 */
0037 
0038 class cGauge : public cListObject
0039 {
0040  public:
0041   /** destructor */
0042   ~cGauge() override;
0043   
0044 #define GAUGE_MATCH 1
0045 #define GAUGE_UPDATE 2
0046   
0047   cList::TraverseAction traverse (int traversalType) override;
0048 
0049   void attribChanged (const QString &name) override;
0050 
0051   void updateVisibleName() override;
0052 
0053   /** variable value has been changed - called by cGaugeList */
0054   void varValueChanged (const QString &var, int newval);
0055 
0056   cGaugeBarItem *gaugeItem ();
0057  protected:
0058   friend class cGaugeList;
0059   cGauge (cList *list);
0060 
0061   struct Private;
0062   Private *d;
0063 
0064   /** Update this gauge. */
0065   void updateGauge ();
0066 
0067   /** React on the fact that the object has moved. */
0068   void objectMoved () override;
0069   void objectEnabled () override;
0070   void objectDisabled () override;
0071 };
0072 
0073 #endif