Qwt User's Guide 5.2.3

- 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 <qbrush.h>
14 #include <qpen.h>
15 #include <qsize.h>
16 #include "qwt_global.h"
17
18 class QPainter;
19 class QRect;
20
22 class QWT_EXPORT QwtSymbol
23 {
24 public:
29 enum Style
30 {
31 NoSymbol = -1,
32
33 Ellipse,
34 Rect,
35 Diamond,
36 Triangle,
37 DTriangle,
38 UTriangle,
39 LTriangle,
40 RTriangle,
41 Cross,
42 XCross,
43 HLine,
44 VLine,
45 Star1,
46 Star2,
47 Hexagon,
48
49 StyleCnt
50 };
51
52 public:
53 QwtSymbol();
54 QwtSymbol(Style st, const QBrush &bd, const QPen &pn, const QSize &s);
55 virtual ~QwtSymbol();
56
57 bool operator!=(const QwtSymbol &) const;
58 virtual bool operator==(const QwtSymbol &) const;
59
60 virtual QwtSymbol *clone() const;
61
62 void setSize(const QSize &s);
63 void setSize(int a, int b = -1);
64 void setBrush(const QBrush& b);
65 void setPen(const QPen &p);
66 void setStyle (Style s);
67
69 const QBrush& brush() const { return d_brush; }
71 const QPen& pen() const { return d_pen; }
73 const QSize& size() const { return d_size; }
75 Style style() const { return d_style; }
76
77 void draw(QPainter *p, const QPoint &pt) const;
78 void draw(QPainter *p, int x, int y) const;
79 virtual void draw(QPainter *p, const QRect &r) const;
80
81 private:
82 QBrush d_brush;
83 QPen d_pen;
84 QSize d_size;
85 Style d_style;
86 };
87
88 #endif