Qwt User's Guide: qwt_plot_item.h Source File

- Main Page
- Classes
- Files
- Related Pages

# 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     void detach() { attach(NULL); }
    00065
    00066     QwtPlot *plot() const;
    00067
    00068     void setTitle(const QString &title);
    00069     void setTitle(const QwtText &title);
    00070     const QwtText &title() const;
    00071
    00072     virtual int rtti() const;
    00073
    00074     void setItemAttribute(ItemAttribute, bool on = true);
    00075     bool testItemAttribute(ItemAttribute) const;
    00076
    00077 #if QT_VERSION >= 0x040000
    00078     void setRenderHint(RenderHint, bool on = true);
    00079     bool testRenderHint(RenderHint) const;
    00080 #endif
    00081
    00082     double z() const;
    00083     void setZ(double z);
    00084
    00085     void show();
    00086     void hide();
    00087     virtual void setVisible(bool);
    00088     bool isVisible () const;
    00089
    00090     void setAxis(int xAxis, int yAxis);
    00091
    00092     void setXAxis(int axis);
    00093     int xAxis() const;
    00094
    00095     void setYAxis(int axis);
    00096     int yAxis() const;
    00097
    00098     virtual void itemChanged();
    00099
    00108     virtual void draw(QPainter *painter,
    00109         const QwtScaleMap &xMap, const QwtScaleMap &yMap,
    00110         const QRect &canvasRect) const = 0;
    00111
    00112     virtual QwtDoubleRect boundingRect() const;
    00113
    00114     virtual void updateLegend(QwtLegend *) const;
    00115     virtual void updateScaleDiv(const QwtScaleDiv&,
    00116         const QwtScaleDiv&);
    00117
    00118     virtual QWidget *legendItem() const;
    00119
    00120     QwtDoubleRect scaleRect(const QwtScaleMap &, const QwtScaleMap &) const;
    00121     QRect paintRect(const QwtScaleMap &, const QwtScaleMap &) const;
    00122
    00123     QRect transform(const QwtScaleMap &, const QwtScaleMap &,
    00124         const QwtDoubleRect&) const;
    00125     QwtDoubleRect invTransform(const QwtScaleMap &, const QwtScaleMap &,
    00126         const QRect&) const;
    00127
    00128 private:
    00129     // Disabled copy constructor and operator=
    00130     QwtPlotItem( const QwtPlotItem & );
    00131     QwtPlotItem &operator=( const QwtPlotItem & );
    00132
    00133     class PrivateData;
    00134     PrivateData *d_data;
    00135 };
    00136
    00137 #endif