Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

qwt_thermo.h

00001 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
00002  * Qwt Widget Library
00003  * Copyright (C) 1997   Josef Wilgen
00004  * Copyright (C) 2002   Uwe Rathmann
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the Qwt License, Version 1.0
00008  *****************************************************************************/
00009 
00010 #ifndef QWT_THERMO_H
00011 #define QWT_THERMO_H
00012 
00013 #include <qwidget.h>
00014 #include <qcolor.h>
00015 #include <qfont.h>
00016 #include <qrect.h>
00017 #include "qwt_global.h"
00018 #include "qwt_abstract_scale.h"
00019 
00020 class QwtScaleDraw;
00021 
00066 class QWT_EXPORT QwtThermo: public QWidget, public QwtAbstractScale
00067 {
00068     Q_OBJECT
00069 
00070     Q_ENUMS( ScalePos )
00071 
00072     Q_PROPERTY( QBrush alarmBrush READ alarmBrush WRITE setAlarmBrush )
00073     Q_PROPERTY( QColor alarmColor READ alarmColor WRITE setAlarmColor )
00074     Q_PROPERTY( bool alarmEnabled READ alarmEnabled WRITE setAlarmEnabled )
00075     Q_PROPERTY( double alarmLevel READ alarmLevel WRITE setAlarmLevel )
00076     Q_PROPERTY( ScalePos scalePosition READ scalePosition
00077         WRITE setScalePosition )
00078     Q_PROPERTY( int borderWidth READ borderWidth WRITE setBorderWidth )
00079     Q_PROPERTY( QBrush fillBrush READ fillBrush WRITE setFillBrush )
00080     Q_PROPERTY( QColor fillColor READ fillColor WRITE setFillColor )
00081     Q_PROPERTY( double maxValue READ maxValue WRITE setMaxValue )
00082     Q_PROPERTY( double minValue READ minValue WRITE setMinValue )
00083     Q_PROPERTY( int pipeWidth READ pipeWidth WRITE setPipeWidth )
00084     Q_PROPERTY( double value READ value WRITE setValue )
00085 
00086 public:
00087     /*
00088       Scale position. QwtThermo tries to enforce valid combinations of its
00089       orientation and scale position:
00090       - Qt::Horizonal combines with None, Top and Bottom
00091       - Qt::Vertical combines with None, Left and Right
00092       
00093       \sa QwtThermo::setOrientation, QwtThermo::setScalePosition
00094     */
00095     enum ScalePos {None, Left, Right, Top, Bottom};
00096 
00097     explicit QwtThermo(QWidget *parent = NULL);
00098     virtual ~QwtThermo();
00099 
00100     void setOrientation(Qt::Orientation o, ScalePos s);
00101 
00102     void setScalePosition(ScalePos s);
00103     ScalePos scalePosition() const;
00104 
00105     void setBorderWidth(int w);
00106     int borderWidth() const;
00107 
00108     void setFillBrush(const QBrush &b);
00109     const QBrush &fillBrush() const;
00110 
00111     void setFillColor(const QColor &c);
00112     const QColor &fillColor() const;
00113  
00114     void setAlarmBrush(const QBrush &b);
00115     const QBrush &alarmBrush() const;
00116 
00117     void setAlarmColor(const QColor &c);
00118     const QColor &alarmColor() const;
00119 
00120     void setAlarmLevel(double v);
00121     double alarmLevel() const;
00122 
00123     void setAlarmEnabled(bool tf);
00124     bool alarmEnabled() const;
00125 
00126     void setPipeWidth(int w);
00127     int pipeWidth() const;
00128 
00129     void setMaxValue(double v);
00130     double maxValue() const;
00131 
00132     void setMinValue(double v);
00133     double minValue() const;
00134 
00135     double value() const;
00136 
00137     void setRange(double vmin, double vmax, bool lg = false);
00138     void setMargin(int m);
00139 
00140     virtual QSize sizeHint() const;
00141     virtual QSize minimumSizeHint() const;
00142 
00143     void setScaleDraw(QwtScaleDraw *);
00144     const QwtScaleDraw *scaleDraw() const;
00145 
00146 public slots:
00147     void setValue(double val);
00148     
00149 protected:
00150     void draw(QPainter *p, const QRect& update_rect);
00151     void drawThermo(QPainter *p);
00152     void layoutThermo( bool update = true );
00153     virtual void scaleChange();
00154     virtual void fontChange(const QFont &oldFont);
00155 
00156     virtual void paintEvent(QPaintEvent *e);
00157     virtual void resizeEvent(QResizeEvent *e);
00158 
00159     QwtScaleDraw *scaleDraw();
00160 
00161 private:
00162     int transform(double v) const;
00163     
00164     class PrivateData;
00165     PrivateData *d_data;
00166 };
00167 
00168 #endif

Generated on Mon Jan 30 22:16:26 2006 for Qwt User's Guide by  doxygen 1.4.4