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 <QPolygonF>
00015
00016 class QPainter;
00017 class QRect;
00018 class QSize;
00019 class QBrush;
00020 class QPen;
00021 class QColor;
00022 class QPointF;
00023
00025 class QWT_EXPORT QwtSymbol
00026 {
00027 public:
00086 enum Style
00087 {
00088 NoSymbol = -1,
00089
00090 Ellipse,
00091 Rect,
00092 Diamond,
00093 Triangle,
00094 DTriangle,
00095 UTriangle,
00096 LTriangle,
00097 RTriangle,
00098 Cross,
00099 XCross,
00100 HLine,
00101 VLine,
00102 Star1,
00103 Star2,
00104 Hexagon,
00105
00106 UserSymbol = 1000
00107 };
00108
00109 public:
00110 QwtSymbol( Style = NoSymbol );
00111 QwtSymbol( Style, const QBrush &, const QPen &, const QSize & );
00112 QwtSymbol( const QwtSymbol & );
00113 virtual ~QwtSymbol();
00114
00115 QwtSymbol &operator=( const QwtSymbol & );
00116 bool operator==( const QwtSymbol & ) const;
00117 bool operator!=( const QwtSymbol & ) const;
00118
00119 void setSize( const QSize & );
00120 void setSize( int width, int height = -1 );
00121 const QSize& size() const;
00122
00123 virtual void setColor( const QColor & );
00124
00125 void setBrush( const QBrush& b );
00126 const QBrush& brush() const;
00127
00128 void setPen( const QPen & );
00129 const QPen& pen() const;
00130
00131 void setStyle( Style );
00132 Style style() const;
00133
00134 void drawSymbol( QPainter *, const QPointF & ) const;
00135 void drawSymbols( QPainter *, const QPolygonF & ) const;
00136
00137 virtual QSize boundingSize() const;
00138
00139 protected:
00140 virtual void drawSymbols( QPainter *,
00141 const QPointF *, int numPoints ) const;
00142
00143 private:
00144 class PrivateData;
00145 PrivateData *d_data;
00146 };
00147
00154 inline void QwtSymbol::drawSymbol(
00155 QPainter *painter, const QPointF &pos ) const
00156 {
00157 drawSymbols( painter, &pos, 1 );
00158 }
00159
00167 inline void QwtSymbol::drawSymbols(
00168 QPainter *painter, const QPolygonF &points ) const
00169 {
00170 drawSymbols( painter, points.data(), points.size() );
00171 }
00172
00173 #endif