00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef QWT_SYMBOL_H
00011 #define QWT_SYMBOL_H
00012
00013 #include "qwt_global.h"
00014 #include <qbrush.h>
00015 #include <qpen.h>
00016 #include <qsize.h>
00017
00018 class QPainter;
00019 class QRect;
00020
00022 class QWT_EXPORT QwtSymbol
00023 {
00024 public:
00029 enum Style
00030 {
00031 NoSymbol = -1,
00032
00033 Ellipse,
00034 Rect,
00035 Diamond,
00036 Triangle,
00037 DTriangle,
00038 UTriangle,
00039 LTriangle,
00040 RTriangle,
00041 Cross,
00042 XCross,
00043 HLine,
00044 VLine,
00045 Star1,
00046 Star2,
00047 Hexagon,
00048
00049 StyleCnt
00050 };
00051
00052 public:
00053 QwtSymbol();
00054 QwtSymbol(Style, const QBrush &, const QPen &, const QSizeF &);
00055 virtual ~QwtSymbol();
00056
00057 bool operator!=(const QwtSymbol &) const;
00058 virtual bool operator==(const QwtSymbol &) const;
00059
00060 virtual QwtSymbol *clone() const;
00061
00062 void setSize(const QSizeF &);
00063 void setSize(double width, double height = -1.0);
00064 const QSizeF& size() const;
00065
00066 virtual void setColor(const QColor &);
00067
00068 void setBrush(const QBrush& b);
00069 const QBrush& brush() const;
00070
00071 void setPen(const QPen &);
00072 const QPen& pen() const;
00073
00074 void setStyle(Style);
00075 Style style() const;
00076
00077 void draw(QPainter *p, const QPointF &) const;
00078 void draw(QPainter *p, double x, double y) const;
00079
00080 virtual void draw(QPainter *p, const QRectF &r) const;
00081
00082 private:
00083 QBrush d_brush;
00084 QPen d_pen;
00085 QSizeF d_size;
00086 Style d_style;
00087 };
00088
00090 inline const QBrush& QwtSymbol::brush() const
00091 {
00092 return d_brush;
00093 }
00094
00096 inline const QPen& QwtSymbol::pen() const
00097 {
00098 return d_pen;
00099 }
00100
00102 inline QwtSymbol::Style QwtSymbol::style() const
00103 {
00104 return d_style;
00105 }
00106
00108 inline const QSizeF& QwtSymbol::size() const
00109 {
00110 return d_size;
00111 }
00112
00113 #endif