Qwt User's Guide  5.2.3
qwt_compass_rose.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_COMPASS_ROSE_H
11 #define QWT_COMPASS_ROSE_H 1
12 
13 #include <qpalette.h>
14 #include "qwt_global.h"
15 
16 class QPainter;
17 
21 class QWT_EXPORT QwtCompassRose
22 {
23 public:
24  virtual ~QwtCompassRose() {};
25 
27  virtual void setPalette(const QPalette &p) { d_palette = p; }
28 
30  const QPalette &palette() const { return d_palette; }
31 
41  virtual void draw(QPainter *painter, const QPoint &center,
42  int radius, double north,
43  QPalette::ColorGroup colorGroup = QPalette::Active) const = 0;
44 
45 private:
46  QPalette d_palette;
47 };
48 
52 class QWT_EXPORT QwtSimpleCompassRose: public QwtCompassRose
53 {
54 public:
55  QwtSimpleCompassRose(int numThorns = 8, int numThornLevels = -1);
56 
57  void setWidth(double w);
58 
60  double width() const { return d_width; }
61 
62  void setNumThorns(int count);
63  int numThorns() const;
64 
65  void setNumThornLevels(int count);
66  int numThornLevels() const;
67 
68  void setShrinkFactor(double factor) { d_shrinkFactor = factor; }
69  double shrinkFactor() const { return d_shrinkFactor; }
70 
71  virtual void draw(QPainter *, const QPoint &center, int radius,
72  double north, QPalette::ColorGroup = QPalette::Active) const;
73 
74  static void drawRose(QPainter *,
75 #if QT_VERSION < 0x040000
76  const QColorGroup &,
77 #else
78  const QPalette &,
79 #endif
80  const QPoint &center, int radius, double origin, double width,
81  int numThorns, int numThornLevels, double shrinkFactor);
82 
83 private:
84  double d_width;
85  int d_numThorns;
86  int d_numThornLevels;
87  double d_shrinkFactor;
88 };
89 
90 #endif // QWT_COMPASS_ROSE_H