qwt_plot_item.h

00001 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
00002  * Qwt Widget Library
00003  * Copyright (C) 1997   Josef Wilgen
00004  * Copyright (C) 2002   Uwe Rathmann
00005  * 
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the Qwt License, Version 1.0
00008  *****************************************************************************/
00009 
00010 #ifndef QWT_PLOT_ITEM_H
00011 #define QWT_PLOT_ITEM_H
00012 
00013 #include "qwt_global.h"
00014 #include "qwt_text.h"
00015 #include "qwt_double_rect.h"
00016 
00017 class QString;
00018 class QRect;
00019 class QPainter;
00020 class QWidget;
00021 class QwtPlot;
00022 class QwtLegend;
00023 class QwtScaleMap;
00024 class QwtScaleDiv;
00025 
00030 class QWT_EXPORT QwtPlotItem
00031 {
00032 public:
00033     enum RttiValues
00034     { 
00035         Rtti_PlotItem = 0,
00036 
00037         Rtti_PlotGrid,
00038         Rtti_PlotMarker,
00039         Rtti_PlotCurve,
00040         Rtti_PlotHistogram,
00041         Rtti_PlotSpectrogram,
00042         Rtti_PlotSVG,
00043 
00044         Rtti_PlotUserItem = 1000
00045     };
00046 
00047     enum ItemAttribute
00048     {
00049         Legend = 1,
00050         AutoScale = 2
00051     };
00052 
00053 #if QT_VERSION >= 0x040000
00054     enum RenderHint
00055     {
00056         RenderAntialiased = 1
00057     };
00058 #endif
00059 
00060     explicit QwtPlotItem(const QwtText &title = QwtText());
00061     virtual ~QwtPlotItem();
00062 
00063     void attach(QwtPlot *plot);
00064 
00072     void detach() { attach(NULL); }
00073 
00074     QwtPlot *plot() const;
00075     
00076     void setTitle(const QString &title);
00077     void setTitle(const QwtText &title);
00078     const QwtText &title() const;
00079 
00080     virtual int rtti() const;
00081 
00082     void setItemAttribute(ItemAttribute, bool on = true);
00083     bool testItemAttribute(ItemAttribute) const;
00084 
00085 #if QT_VERSION >= 0x040000
00086     void setRenderHint(RenderHint, bool on = true);
00087     bool testRenderHint(RenderHint) const;
00088 #endif
00089 
00090     double z() const; 
00091     void setZ(double z);
00092 
00093     void show();
00094     void hide();
00095     virtual void setVisible(bool);
00096     bool isVisible () const;
00097 
00098     void setAxis(int xAxis, int yAxis);
00099 
00100     void setXAxis(int axis);
00101     int xAxis() const;
00102 
00103     void setYAxis(int axis);
00104     int yAxis() const;
00105 
00106     virtual void itemChanged();
00107 
00116     virtual void draw(QPainter *painter, 
00117         const QwtScaleMap &xMap, const QwtScaleMap &yMap,
00118         const QRect &canvasRect) const = 0;
00119 
00120     virtual QwtDoubleRect boundingRect() const;
00121 
00122     virtual void updateLegend(QwtLegend *) const;
00123     virtual void updateScaleDiv(const QwtScaleDiv&,
00124         const QwtScaleDiv&);
00125 
00126     virtual QWidget *legendItem() const;
00127 
00128     QwtDoubleRect scaleRect(const QwtScaleMap &, const QwtScaleMap &) const;
00129     QRect paintRect(const QwtScaleMap &, const QwtScaleMap &) const;
00130     
00131     QRect transform(const QwtScaleMap &, const QwtScaleMap &, 
00132         const QwtDoubleRect&) const; 
00133     QwtDoubleRect invTransform(const QwtScaleMap &, const QwtScaleMap &,
00134         const QRect&) const; 
00135 
00136 private:
00137     // Disabled copy constructor and operator=
00138     QwtPlotItem( const QwtPlotItem & );
00139     QwtPlotItem &operator=( const QwtPlotItem & );
00140 
00141     class PrivateData;
00142     PrivateData *d_data;
00143 };
00144             
00145 #endif

Generated on Sun Jul 22 11:26:54 2007 for Qwt User's Guide by  doxygen 1.5.2