00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef QWT_PLOT_ITEM_H
00011 #define QWT_PLOT_ITEM_H
00012
00013 #include "qwt_global.h"
00014 #include "qwt_legend_itemmanager.h"
00015 #include "qwt_text.h"
00016 #include <qrect.h>
00017
00018 class QString;
00019 class QPainter;
00020 class QWidget;
00021 class QwtPlot;
00022 class QwtLegend;
00023 class QwtScaleMap;
00024 class QwtScaleDiv;
00025
00064 class QWT_EXPORT QwtPlotItem: public QwtLegendItemManager
00065 {
00066 public:
00073 enum RttiValues
00074 {
00075 Rtti_PlotItem = 0,
00076
00077 Rtti_PlotGrid,
00078 Rtti_PlotScale,
00079 Rtti_PlotMarker,
00080 Rtti_PlotCurve,
00081 Rtti_PlotSpectroCurve,
00082 Rtti_PlotIntervalCurve,
00083 Rtti_PlotHistogram,
00084 Rtti_PlotSpectrogram,
00085 Rtti_PlotSVG,
00086
00087 Rtti_PlotUserItem = 1000
00088 };
00089
00101 enum ItemAttribute
00102 {
00103 Legend = 1,
00104 AutoScale = 2
00105 };
00106
00108 enum RenderHint
00109 {
00110 RenderAntialiased = 1
00111 };
00112
00113 explicit QwtPlotItem( const QwtText &title = QwtText() );
00114 virtual ~QwtPlotItem();
00115
00116 void attach( QwtPlot *plot );
00117
00125 void detach()
00126 {
00127 attach( NULL );
00128 }
00129
00130 QwtPlot *plot() const;
00131
00132 void setTitle( const QString &title );
00133 void setTitle( const QwtText &title );
00134 const QwtText &title() const;
00135
00136 virtual int rtti() const;
00137
00138 void setItemAttribute( ItemAttribute, bool on = true );
00139 bool testItemAttribute( ItemAttribute ) const;
00140
00141 void setRenderHint( RenderHint, bool on = true );
00142 bool testRenderHint( RenderHint ) const;
00143
00144 double z() const;
00145 void setZ( double z );
00146
00147 void show();
00148 void hide();
00149 virtual void setVisible( bool );
00150 bool isVisible () const;
00151
00152 void setAxes( int xAxis, int yAxis );
00153
00154 void setXAxis( int axis );
00155 int xAxis() const;
00156
00157 void setYAxis( int axis );
00158 int yAxis() const;
00159
00160 virtual void itemChanged();
00161
00170 virtual void draw( QPainter *painter,
00171 const QwtScaleMap &xMap, const QwtScaleMap &yMap,
00172 const QRectF &canvasRect ) const = 0;
00173
00174 virtual QRectF boundingRect() const;
00175
00176 virtual void updateLegend( QwtLegend * ) const;
00177 virtual void updateScaleDiv(
00178 const QwtScaleDiv&, const QwtScaleDiv& );
00179
00180 virtual QWidget *legendItem() const;
00181
00182 QRectF scaleRect( const QwtScaleMap &, const QwtScaleMap & ) const;
00183 QRectF paintRect( const QwtScaleMap &, const QwtScaleMap & ) const;
00184
00185 private:
00186
00187 QwtPlotItem( const QwtPlotItem & );
00188 QwtPlotItem &operator=( const QwtPlotItem & );
00189
00190 class PrivateData;
00191 PrivateData *d_data;
00192 };
00193
00194 #endif