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_COMPASS_ROSE_H
|
---|
11 | #define QWT_COMPASS_ROSE_H 1
|
---|
12 |
|
---|
13 | #include "qwt_global.h"
|
---|
14 | #include <qpalette.h>
|
---|
15 |
|
---|
16 | class QPainter;
|
---|
17 |
|
---|
18 | /*!
|
---|
19 | \brief Abstract base class for a compass rose
|
---|
20 | */
|
---|
21 | class QWT_EXPORT QwtCompassRose
|
---|
22 | {
|
---|
23 | public:
|
---|
24 | //! Destructor
|
---|
25 | virtual ~QwtCompassRose() {};
|
---|
26 |
|
---|
27 | //! Assign a palette
|
---|
28 | virtual void setPalette( const QPalette &p )
|
---|
29 | {
|
---|
30 | d_palette = p;
|
---|
31 | }
|
---|
32 |
|
---|
33 | //! \return Current palette
|
---|
34 | const QPalette &palette() const
|
---|
35 | {
|
---|
36 | return d_palette;
|
---|
37 | }
|
---|
38 |
|
---|
39 | /*!
|
---|
40 | Draw the rose
|
---|
41 |
|
---|
42 | \param painter Painter
|
---|
43 | \param center Center point
|
---|
44 | \param radius Radius of the rose
|
---|
45 | \param north Position
|
---|
46 | \param colorGroup Color group
|
---|
47 | */
|
---|
48 | virtual void draw( QPainter *painter,
|
---|
49 | const QPointF ¢er, double radius, double north,
|
---|
50 | QPalette::ColorGroup colorGroup = QPalette::Active ) const = 0;
|
---|
51 |
|
---|
52 | private:
|
---|
53 | QPalette d_palette;
|
---|
54 | };
|
---|
55 |
|
---|
56 | /*!
|
---|
57 | \brief A simple rose for QwtCompass
|
---|
58 | */
|
---|
59 | class QWT_EXPORT QwtSimpleCompassRose: public QwtCompassRose
|
---|
60 | {
|
---|
61 | public:
|
---|
62 | QwtSimpleCompassRose( int numThorns = 8, int numThornLevels = -1 );
|
---|
63 | virtual ~QwtSimpleCompassRose();
|
---|
64 |
|
---|
65 | void setWidth( double );
|
---|
66 | double width() const;
|
---|
67 |
|
---|
68 | void setNumThorns( int );
|
---|
69 | int numThorns() const;
|
---|
70 |
|
---|
71 | void setNumThornLevels( int );
|
---|
72 | int numThornLevels() const;
|
---|
73 |
|
---|
74 | void setShrinkFactor( double factor );
|
---|
75 | double shrinkFactor() const;
|
---|
76 |
|
---|
77 | virtual void draw( QPainter *, const QPointF ¢er, double radius,
|
---|
78 | double north, QPalette::ColorGroup = QPalette::Active ) const;
|
---|
79 |
|
---|
80 | static void drawRose( QPainter *, const QPalette &,
|
---|
81 | const QPointF ¢er, double radius, double north, double width,
|
---|
82 | int numThorns, int numThornLevels, double shrinkFactor );
|
---|
83 |
|
---|
84 | private:
|
---|
85 | class PrivateData;
|
---|
86 | PrivateData *d_data;
|
---|
87 | };
|
---|
88 |
|
---|
89 | #endif
|
---|