Qwt User's Guide 6.0.2

- Main Page
- Related Pages
- Classes

qwt_symbol.h
1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
2 * Qwt Widget Library
3 * Copyright (C) 1997 Josef Wilgen
4 * Copyright (C) 2002 Uwe Rathmann
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the Qwt License, Version 1.0
8 *****************************************************************************/
9
10 #ifndef QWT_SYMBOL_H
11 #define QWT_SYMBOL_H
12
13 #include "qwt_global.h"
14 #include <QPolygonF>
15
16 class QPainter;
17 class QRect;
18 class QSize;
19 class QBrush;
20 class QPen;
21 class QColor;
22 class QPointF;
23
25 class QWT_EXPORT QwtSymbol
26 {
27 public:
32 enum Style
33 {
35 NoSymbol = -1,
36
38 Ellipse,
39
41 Rect,
42
44 Diamond,
45
47 Triangle,
48
50 DTriangle,
51
53 UTriangle,
54
56 LTriangle,
57
59 RTriangle,
60
62 Cross,
63
65 XCross,
66
68 HLine,
69
71 VLine,
72
74 Star1,
75
77 Star2,
78
80 Hexagon,
81
87 UserStyle = 1000
88 };
89
90 public:
91 QwtSymbol( Style = NoSymbol );
92 QwtSymbol( Style, const QBrush &, const QPen &, const QSize & );
93 QwtSymbol( const QwtSymbol & );
94 virtual ~QwtSymbol();
95
96 QwtSymbol &operator=( const QwtSymbol & );
97 bool operator==( const QwtSymbol & ) const;
98 bool operator!=( const QwtSymbol & ) const;
99
100 void setSize( const QSize & );
101 void setSize( int width, int height = -1 );
102 const QSize& size() const;
103
104 virtual void setColor( const QColor & );
105
106 void setBrush( const QBrush& b );
107 const QBrush& brush() const;
108
109 void setPen( const QPen & );
110 const QPen& pen() const;
111
112 void setStyle( Style );
113 Style style() const;
114
115 void drawSymbol( QPainter *, const QPointF & ) const;
116 void drawSymbols( QPainter *, const QPolygonF & ) const;
117
118 virtual QSize boundingSize() const;
119
120 protected:
121 virtual void drawSymbols( QPainter *,
122 const QPointF *, int numPoints ) const;
123
124 private:
125 class PrivateData;
126 PrivateData *d_data;
127 };
128
135 inline void QwtSymbol::drawSymbol(
136 QPainter *painter, const QPointF &pos ) const
137 {
138 drawSymbols( painter, &pos, 1 );
139 }
140
148 inline void QwtSymbol::drawSymbols(
149 QPainter *painter, const QPolygonF &points ) const
150 {
151 drawSymbols( painter, points.data(), points.size() );
152 }
153
154 #endif