Qwt Polar User's Guide 0.1.0
qwt_polar_item.h
00001 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
00002  * QwtPolar Widget Library
00003  * Copyright (C) 2008   Uwe Rathmann
00004  *
00005  * This library is free software; you can redistribute it and/or
00006  * modify it under the terms of the Qwt License, Version 1.0
00007  *****************************************************************************/
00008 
00009 #ifndef QWT_POLAR_ITEM_H
00010 #define QWT_POLAR_ITEM_H
00011 
00012 #include "qwt_polar_global.h"
00013 #include "qwt_text.h"
00014 #include "qwt_legend_itemmanager.h"
00015 #include "qwt_double_interval.h"
00016 #include "qwt_double_rect.h"
00017 
00018 class QString;
00019 class QRect;
00020 class QPainter;
00021 class QwtPolarPlot;
00022 class QwtScaleMap;
00023 class QwtScaleDiv;
00024 
00036 class QWT_POLAR_EXPORT QwtPolarItem: public QwtLegendItemManager
00037 {
00038 public:
00045     enum RttiValues
00046     { 
00047         Rtti_PolarItem = 0,
00048 
00049         Rtti_PolarGrid,
00050         Rtti_PolarScale,
00051         Rtti_PolarMarker,
00052         Rtti_PolarCurve,
00053         Rtti_PolarSpectrogram,
00054 
00055         Rtti_PolarUserItem = 1000
00056     };
00057 
00069     enum ItemAttribute
00070     {
00071         Legend = 1,
00072         AutoScale = 2
00073     };
00074 
00075 #if QT_VERSION >= 0x040000
00076 
00077     enum RenderHint
00078     {
00079         RenderAntialiased = 1
00080     };
00081 #endif
00082 
00083     explicit QwtPolarItem(const QwtText &title = QwtText());
00084     virtual ~QwtPolarItem();
00085 
00086     void attach(QwtPolarPlot *plot);
00087 
00095     void detach() { attach(NULL); }
00096 
00097     QwtPolarPlot *plot() const;
00098     
00099     void setTitle(const QString &title);
00100     void setTitle(const QwtText &title);
00101     const QwtText &title() const;
00102 
00103     virtual int rtti() const;
00104 
00105     void setItemAttribute(ItemAttribute, bool on = true);
00106     bool testItemAttribute(ItemAttribute) const;
00107 
00108 #if QT_VERSION >= 0x040000
00109     void setRenderHint(RenderHint, bool on = true);
00110     bool testRenderHint(RenderHint) const;
00111 #endif
00112 
00113     double z() const; 
00114     void setZ(double z);
00115 
00116     void show();
00117     void hide();
00118     virtual void setVisible(bool);
00119     bool isVisible () const;
00120 
00121     virtual void itemChanged();
00122 
00133     virtual void draw(QPainter *painter, 
00134         const QwtScaleMap &azimuthMap, const QwtScaleMap &radialMap,
00135         const QwtDoublePoint &pole, double radius,
00136         const QwtDoubleRect &canvasRect) const = 0;
00137 
00138     virtual QwtDoubleInterval boundingInterval(int scaleId) const;
00139 
00140     virtual QWidget *legendItem() const;
00141 
00142     virtual void updateLegend(QwtLegend *) const;
00143     virtual void updateScaleDiv(const QwtScaleDiv &,
00144         const QwtScaleDiv &, const QwtDoubleInterval &);
00145 
00146     virtual int marginHint() const;
00147 
00148 private:
00149     // Disabled copy constructor and operator=
00150     QwtPolarItem( const QwtPolarItem & );
00151     QwtPolarItem &operator=( const QwtPolarItem & );
00152 
00153     class PrivateData;
00154     PrivateData *d_data;
00155 };
00156             
00157 #endif