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

qwt_thermo.h

Go to the documentation of this file.
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_dimap.h"
00019 #include "qwt_scldraw.h"
00020 #include "qwt_sclif.h"
00021 
00022 
00024 class QWT_EXPORT QwtThermo: public QWidget, public QwtScaleIf
00025 {
00026     Q_OBJECT
00027 
00028 public:
00033     enum ScalePos {None, Left, Right, Top, Bottom};
00034 
00035     QwtThermo(QWidget *parent = 0, const char *name = 0);
00036     virtual ~QwtThermo();
00037 
00038     void setOrientation(Qt::Orientation o, ScalePos s);
00039     void setBorderWidth(int w);
00040     void setFillColor(const QColor &c);
00041     void setAlarmColor(const QColor &c);
00042     void setAlarmLevel(double v);
00043     void setAlarmEnabled (int tf);
00044     void setPipeWidth(int w);
00045     void setRange(double vmin, double vmax);
00046     void setMargin(int m);
00048     double maxValue() { return d_maxValue; }
00050     double minValue() { return d_minValue; }
00052     double value() { return d_value; }
00053 
00054     virtual QSize sizeHint() const;
00055     virtual QSize minimumSizeHint() const;
00056     virtual QSizePolicy sizePolicy() const;
00057 
00058 public slots:
00059     void setValue(double val);
00060     
00061 protected:
00062     void draw(QPainter *p, const QRect& update_rect);
00063     void drawThermo(QPainter *p);
00064     void layoutThermo( bool update = TRUE );
00065     virtual void scaleChange();
00066     virtual void fontChange(const QFont &oldFont);
00067 
00068     virtual void paintEvent(QPaintEvent *e);
00069     virtual void resizeEvent(QResizeEvent *e);
00070 
00071 private:
00072     void init();
00073     
00074     QwtDiMap d_map;
00075     QRect d_thermoRect;
00076     QColor d_fillColor;
00077     QColor d_alarmColor;
00078     
00079     Qt::Orientation d_orient;
00080     ScalePos d_scalePos;
00081     int d_borderWidth;
00082     int d_scaleDist;
00083     int d_thermoWidth;
00084 
00085     double d_minValue;
00086     double d_maxValue;
00087     double d_value;
00088     double d_alarmLevel;
00089     int d_alarmEnabled;
00090 };
00091 
00092 #endif

Generated on Fri Nov 7 14:11:46 2003 for Qwt Developer's Guide by doxygen 1.3.2