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

qwt_dial_needle.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_DIAL_ITEM_H 00011 #define QWT_DIAL_ITEM_H 1 00012 00013 #include <qpalette.h> 00014 #include "qwt_global.h" 00015 00016 class QPainter; 00017 class QPoint; 00018 00031 class QWT_EXPORT QwtDialNeedle 00032 { 00033 public: 00034 QwtDialNeedle(); 00035 virtual ~QwtDialNeedle(); 00036 00046 virtual void draw(QPainter *painter, const QPoint &center, 00047 int length, double direction, 00048 QPalette::ColorGroup cg = QPalette::Active) const = 0; 00049 00050 virtual void setPalette(const QPalette &); 00051 const QPalette &palette() const; 00052 00053 protected: 00054 const QColorGroup &colorGroup(QPalette::ColorGroup) const; 00055 static void drawKnob(QPainter *, const QPoint &pos, 00056 int width, const QBrush &, bool sunken); 00057 00058 private: 00059 QPalette d_palette; 00060 }; 00061 00074 class QWT_EXPORT QwtDialSimpleNeedle: public QwtDialNeedle 00075 { 00076 public: 00077 enum Style 00078 { 00079 Arrow, 00080 Ray 00081 }; 00082 00083 QwtDialSimpleNeedle(Style, bool hasKnob = TRUE, 00084 const QColor &mid = Qt::gray, const QColor &base = Qt::darkGray); 00085 00086 virtual void draw(QPainter *, const QPoint &, int length, 00087 double direction, QPalette::ColorGroup = QPalette::Active) const; 00088 00089 static void drawArrowNeedle(QPainter *, const QColorGroup &, 00090 const QPoint &, int length, int width, double direction, 00091 bool hasKnob); 00092 00093 static void drawRayNeedle(QPainter *, const QColorGroup &, 00094 const QPoint &, int length, int width, double direction, 00095 bool hasKnob); 00096 00097 void setWidth(int width); 00098 int width() const; 00099 00100 private: 00101 Style d_style; 00102 bool d_hasKnob; 00103 int d_width; 00104 }; 00105 00123 class QWT_EXPORT QwtCompassMagnetNeedle: public QwtDialNeedle 00124 { 00125 public: 00126 enum Style 00127 { 00128 TriangleStyle, 00129 ThinStyle 00130 }; 00131 QwtCompassMagnetNeedle(Style = TriangleStyle, 00132 const QColor &light = Qt::white, const QColor &dark = Qt::red); 00133 00134 virtual void draw(QPainter *, const QPoint &, int length, 00135 double direction, QPalette::ColorGroup = QPalette::Active) const; 00136 00137 static void drawTriangleNeedle(QPainter *, const QColorGroup &, 00138 const QPoint &, int length, double direction); 00139 00140 static void drawThinNeedle(QPainter *, const QColorGroup &, 00141 const QPoint &, int length, double direction); 00142 00143 protected: 00144 static void drawPointer(QPainter *painter, const QBrush &brush, 00145 int colorOffset, const QPoint &center, 00146 int length, int width, double direction); 00147 00148 private: 00149 Style d_style; 00150 }; 00151 00165 class QWT_EXPORT QwtCompassWindArrow: public QwtDialNeedle 00166 { 00167 public: 00168 enum Style 00169 { 00170 Style1, 00171 Style2 00172 }; 00173 00174 QwtCompassWindArrow(Style, const QColor &light = Qt::white, 00175 const QColor &dark = Qt::gray); 00176 00177 virtual void draw(QPainter *, const QPoint &, int length, 00178 double direction, QPalette::ColorGroup = QPalette::Active) const; 00179 00180 static void drawStyle1Needle(QPainter *, const QColorGroup &, 00181 const QPoint &, int length, double direction); 00182 00183 static void drawStyle2Needle(QPainter *, const QColorGroup &, 00184 const QPoint &, int length, double direction); 00185 00186 private: 00187 Style d_style; 00188 }; 00189 #endif // QWT_DIAL_ITEM_H

Generated on Tue Nov 16 21:12:20 2004 for Qwt User's Guide by doxygen 1.3.8