Qwt Polar User's Guide  0.1.0
qwt_polar_item.h
1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
2  * QwtPolar Widget Library
3  * Copyright (C) 2008 Uwe Rathmann
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the Qwt License, Version 1.0
7  *****************************************************************************/
8 
9 #ifndef QWT_POLAR_ITEM_H
10 #define QWT_POLAR_ITEM_H
11 
12 #include "qwt_polar_global.h"
13 #include "qwt_text.h"
14 #include "qwt_legend_itemmanager.h"
15 #include "qwt_double_interval.h"
16 #include "qwt_double_rect.h"
17 
18 class QString;
19 class QRect;
20 class QPainter;
21 class QwtPolarPlot;
22 class QwtScaleMap;
23 class QwtScaleDiv;
24 
36 class QWT_POLAR_EXPORT QwtPolarItem: public QwtLegendItemManager
37 {
38 public:
46  {
47  Rtti_PolarItem = 0,
48 
49  Rtti_PolarGrid,
50  Rtti_PolarScale,
51  Rtti_PolarMarker,
52  Rtti_PolarCurve,
53  Rtti_PolarSpectrogram,
54 
55  Rtti_PolarUserItem = 1000
56  };
57 
70  {
71  Legend = 1,
72  AutoScale = 2
73  };
74 
75 #if QT_VERSION >= 0x040000
76 
78  {
79  RenderAntialiased = 1
80  };
81 #endif
82 
83  explicit QwtPolarItem(const QwtText &title = QwtText());
84  virtual ~QwtPolarItem();
85 
86  void attach(QwtPolarPlot *plot);
87 
95  void detach() { attach(NULL); }
96 
97  QwtPolarPlot *plot() const;
98 
99  void setTitle(const QString &title);
100  void setTitle(const QwtText &title);
101  const QwtText &title() const;
102 
103  virtual int rtti() const;
104 
105  void setItemAttribute(ItemAttribute, bool on = true);
106  bool testItemAttribute(ItemAttribute) const;
107 
108 #if QT_VERSION >= 0x040000
109  void setRenderHint(RenderHint, bool on = true);
110  bool testRenderHint(RenderHint) const;
111 #endif
112 
113  double z() const;
114  void setZ(double z);
115 
116  void show();
117  void hide();
118  virtual void setVisible(bool);
119  bool isVisible () const;
120 
121  virtual void itemChanged();
122 
133  virtual void draw(QPainter *painter,
134  const QwtScaleMap &azimuthMap, const QwtScaleMap &radialMap,
135  const QwtDoublePoint &pole, double radius,
136  const QwtDoubleRect &canvasRect) const = 0;
137 
138  virtual QwtDoubleInterval boundingInterval(int scaleId) const;
139 
140  virtual QWidget *legendItem() const;
141 
142  virtual void updateLegend(QwtLegend *) const;
143  virtual void updateScaleDiv(const QwtScaleDiv &,
144  const QwtScaleDiv &, const QwtDoubleInterval &);
145 
146  virtual int marginHint() const;
147 
148 private:
149  // Disabled copy constructor and operator=
150  QwtPolarItem( const QwtPolarItem & );
151  QwtPolarItem &operator=( const QwtPolarItem & );
152 
153  class PrivateData;
154  PrivateData *d_data;
155 };
156 
157 #endif