meter.h
00001 /*************************************************************************** 00002 * Copyright (C) 2003 by Hans Karlsson * 00003 * karlsson.h@home.se * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 ***************************************************************************/ 00010 #ifndef METER_H 00011 #define METER_H 00012 00013 #include <tqpixmap.h> 00014 #include <tqpainter.h> 00015 #include <tqstring.h> 00016 #include <tqstringlist.h> 00017 #include <tqobject.h> 00018 00019 #include <tqfileinfo.h> 00020 00021 class karamba; 00022 00023 class Meter : public TQObject 00024 { 00025 Q_OBJECT 00026 TQ_OBJECT 00027 public: 00028 00029 Meter(karamba* k, int ix,int iy,int iw,int ih); 00030 Meter(karamba* k); 00031 virtual ~Meter(); 00032 virtual int getX(); 00033 virtual int getY(); 00034 virtual int getWidth(); 00035 virtual int getHeight(); 00036 virtual void setX(int); 00037 virtual void setY(int); 00038 virtual void setWidth(int); 00039 virtual void setHeight(int); 00040 00041 virtual void setSize(int ix, int iy, int iw, int ih); 00042 00043 virtual void setMax(long max) { maxValue = max; }; 00044 virtual void setMin(long min) { minValue = min; }; 00045 virtual long getMax() { return minValue; }; 00046 virtual long getMin() { return maxValue; }; 00047 00048 void setThemePath( TQString ); 00049 00050 virtual void mUpdate(TQPainter *)=0 ; 00051 00052 virtual void setValue(long) {}; 00053 virtual long getValue() { return -1; }; 00054 virtual void setValue(TQString) {}; 00055 virtual TQString getStringValue() const { return TQString(); }; 00056 virtual void recalculateValue() {}; 00057 00058 virtual void setColor(TQColor clr) { color = clr; }; 00059 virtual TQColor getColor() { return color; }; 00060 00061 virtual void show() { hidden = 0; }; 00062 virtual void hide() { hidden = 1; }; 00063 00064 TQRect getBoundingBox(); 00065 00066 // true when given coordinate point is inside the meters 00067 // active reagion and meter is enabled 00068 virtual bool insideActiveArea(int, int); 00069 00070 // returns true when callback meterClicked should be called. 00071 virtual bool click( TQMouseEvent* ); 00072 00073 void setEnabled(bool); 00074 bool isEnabled(); 00075 00076 /* 00077 void setOnClick( TQString ); 00078 void setOnMiddleClick( TQString ); 00079 */ 00080 00081 protected: // Protected attributes 00082 TQString themePath; 00083 00084 TQRect boundingBox; 00085 00086 // Actions to execute when clicked on meter 00087 TQString leftButtonAction; 00088 TQString middleButtonAction; 00089 TQString rightButtonAction; 00090 00091 bool clickable; 00092 int hidden; 00093 long minValue; 00094 long maxValue; 00095 00096 TQColor color; 00097 karamba* m_karamba; 00098 }; 00099 00100 #endif // METER_H