Qwt User's Guide: qwt_plot_item.h Source File

- Main Page
- Classes
- Files
- Related Pages

- File List
- File Members

# 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_legend_itemmanager.h"
    00015 #include "qwt_text.h"
    00016 #include "qwt_double_rect.h"
    00017
    00018 class QString;
    00019 class QRect;
    00020 class QPainter;
    00021 class QWidget;
    00022 class QwtPlot;
    00023 class QwtLegend;
    00024 class QwtScaleMap;
    00025 class QwtScaleDiv;
    00026
    00031 class QWT_EXPORT QwtPlotItem: public QwtLegendItemManager
    00032 {
    00033 public:
    00034     enum RttiValues
    00035     {
    00036         Rtti_PlotItem = 0,
    00037
    00038         Rtti_PlotGrid,
    00039         Rtti_PlotScale,
    00040         Rtti_PlotMarker,
    00041         Rtti_PlotCurve,
    00042         Rtti_PlotHistogram,
    00043         Rtti_PlotSpectrogram,
    00044         Rtti_PlotSVG,
    00045
    00046         Rtti_PlotUserItem = 1000
    00047     };
    00048
    00049     enum ItemAttribute
    00050     {
    00051         Legend = 1,
    00052         AutoScale = 2
    00053     };
    00054
    00055 #if QT_VERSION >= 0x040000
    00056     enum RenderHint
    00057     {
    00058         RenderAntialiased = 1
    00059     };
    00060 #endif
    00061
    00062     explicit QwtPlotItem(const QwtText &title = QwtText());
    00063     virtual ~QwtPlotItem();
    00064
    00065     void attach(QwtPlot *plot);
    00066
    00074     void detach() { attach(NULL); }
    00075
    00076     QwtPlot *plot() const;
    00077
    00078     void setTitle(const QString &title);
    00079     void setTitle(const QwtText &title);
    00080     const QwtText &title() const;
    00081
    00082     virtual int rtti() const;
    00083
    00084     void setItemAttribute(ItemAttribute, bool on = true);
    00085     bool testItemAttribute(ItemAttribute) const;
    00086
    00087 #if QT_VERSION >= 0x040000
    00088     void setRenderHint(RenderHint, bool on = true);
    00089     bool testRenderHint(RenderHint) const;
    00090 #endif
    00091
    00092     double z() const;
    00093     void setZ(double z);
    00094
    00095     void show();
    00096     void hide();
    00097     virtual void setVisible(bool);
    00098     bool isVisible () const;
    00099
    00100     void setAxis(int xAxis, int yAxis);
    00101
    00102     void setXAxis(int axis);
    00103     int xAxis() const;
    00104
    00105     void setYAxis(int axis);
    00106     int yAxis() const;
    00107
    00108     virtual void itemChanged();
    00109
    00118     virtual void draw(QPainter *painter,
    00119         const QwtScaleMap &xMap, const QwtScaleMap &yMap,
    00120         const QRect &canvasRect) const = 0;
    00121
    00122     virtual QwtDoubleRect boundingRect() const;
    00123
    00124     virtual void updateLegend(QwtLegend *) const;
    00125     virtual void updateScaleDiv(const QwtScaleDiv&,
    00126         const QwtScaleDiv&);
    00127
    00128     virtual QWidget *legendItem() const;
    00129
    00130     QwtDoubleRect scaleRect(const QwtScaleMap &, const QwtScaleMap &) const;
    00131     QRect paintRect(const QwtScaleMap &, const QwtScaleMap &) const;
    00132
    00133     QRect transform(const QwtScaleMap &, const QwtScaleMap &,
    00134         const QwtDoubleRect&) const;
    00135     QwtDoubleRect invTransform(const QwtScaleMap &, const QwtScaleMap &,
    00136         const QRect&) const;
    00137
    00138 private:
    00139     // Disabled copy constructor and operator=
    00140     QwtPlotItem( const QwtPlotItem & );
    00141     QwtPlotItem &operator=( const QwtPlotItem & );
    00142
    00143     class PrivateData;
    00144     PrivateData *d_data;
    00145 };
    00146
    00147 #endif