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
00094 enum ItemAttribute
00095 {
00097 Legend = 0x01,
00098
00103 AutoScale = 0x02
00104 };
00105
00107 typedef QFlags<ItemAttribute> ItemAttributes;
00108
00110 enum RenderHint
00111 {
00113 RenderAntialiased = 1
00114 };
00115
00117 typedef QFlags<RenderHint> RenderHints;
00118
00119 explicit QwtPlotItem( const QwtText &title = QwtText() );
00120 virtual ~QwtPlotItem();
00121
00122 void attach( QwtPlot *plot );
00123 void detach();
00124
00125 QwtPlot *plot() const;
00126
00127 void setTitle( const QString &title );
00128 void setTitle( const QwtText &title );
00129 const QwtText &title() const;
00130
00131 virtual int rtti() const;
00132
00133 void setItemAttribute( ItemAttribute, bool on = true );
00134 bool testItemAttribute( ItemAttribute ) const;
00135
00136 void setRenderHint( RenderHint, bool on = true );
00137 bool testRenderHint( RenderHint ) const;
00138
00139 double z() const;
00140 void setZ( double z );
00141
00142 void show();
00143 void hide();
00144 virtual void setVisible( bool );
00145 bool isVisible () const;
00146
00147 void setAxes( int xAxis, int yAxis );
00148
00149 void setXAxis( int axis );
00150 int xAxis() const;
00151
00152 void setYAxis( int axis );
00153 int yAxis() const;
00154
00155 virtual void itemChanged();
00156
00165 virtual void draw( QPainter *painter,
00166 const QwtScaleMap &xMap, const QwtScaleMap &yMap,
00167 const QRectF &canvasRect ) const = 0;
00168
00169 virtual QRectF boundingRect() const;
00170
00171 virtual void updateLegend( QwtLegend * ) const;
00172 virtual void updateScaleDiv(
00173 const QwtScaleDiv&, const QwtScaleDiv& );
00174
00175 virtual QWidget *legendItem() const;
00176
00177 QRectF scaleRect( const QwtScaleMap &, const QwtScaleMap & ) const;
00178 QRectF paintRect( const QwtScaleMap &, const QwtScaleMap & ) const;
00179
00180 private:
00181
00182 QwtPlotItem( const QwtPlotItem & );
00183 QwtPlotItem &operator=( const QwtPlotItem & );
00184
00185 class PrivateData;
00186 PrivateData *d_data;
00187 };
00188
00189 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotItem::ItemAttributes )
00190 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotItem::RenderHints )
00191
00192 #endif