Qwt User's Guide: qwt_plot_item.h Source File

- Main Page
- Related Pages
- Classes
- Files

- File List

# 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
    00065 class QWT_EXPORT QwtPlotItem: public QwtLegendItemManager
    00066 {
    00067 public:
    00074     enum RttiValues
    00075     {
    00076         Rtti_PlotItem = 0,
    00077
    00078         Rtti_PlotGrid,
    00079         Rtti_PlotScale,
    00080         Rtti_PlotMarker,
    00081         Rtti_PlotCurve,
    00082         Rtti_PlotHistogram,
    00083         Rtti_PlotSpectrogram,
    00084         Rtti_PlotSVG,
    00085
    00086         Rtti_PlotUserItem = 1000
    00087     };
    00088
    00100     enum ItemAttribute
    00101     {
    00102         Legend = 1,
    00103         AutoScale = 2
    00104     };
    00105
    00106 #if QT_VERSION >= 0x040000
    00107
    00108     enum RenderHint
    00109     {
    00110         RenderAntialiased = 1
    00111     };
    00112 #endif
    00113
    00114     explicit QwtPlotItem(const QwtText &title = QwtText());
    00115     virtual ~QwtPlotItem();
    00116
    00117     void attach(QwtPlot *plot);
    00118
    00126     void detach() { attach(NULL); }
    00127
    00128     QwtPlot *plot() const;
    00129
    00130     void setTitle(const QString &title);
    00131     void setTitle(const QwtText &title);
    00132     const QwtText &title() const;
    00133
    00134     virtual int rtti() const;
    00135
    00136     void setItemAttribute(ItemAttribute, bool on = true);
    00137     bool testItemAttribute(ItemAttribute) const;
    00138
    00139 #if QT_VERSION >= 0x040000
    00140     void setRenderHint(RenderHint, bool on = true);
    00141     bool testRenderHint(RenderHint) const;
    00142 #endif
    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 setAxis(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 QRect &canvasRect) const = 0;
    00173
    00174     virtual QwtDoubleRect boundingRect() const;
    00175
    00176     virtual void updateLegend(QwtLegend *) const;
    00177     virtual void updateScaleDiv(const QwtScaleDiv&,
    00178         const QwtScaleDiv&);
    00179
    00180     virtual QWidget *legendItem() const;
    00181
    00182     QwtDoubleRect scaleRect(const QwtScaleMap &, const QwtScaleMap &) const;
    00183     QRect paintRect(const QwtScaleMap &, const QwtScaleMap &) const;
    00184
    00185     QRect transform(const QwtScaleMap &, const QwtScaleMap &,
    00186         const QwtDoubleRect&) const;
    00187     QwtDoubleRect invTransform(const QwtScaleMap &, const QwtScaleMap &,
    00188         const QRect&) const;
    00189
    00190 private:
    00191     // Disabled copy constructor and operator=
    00192     QwtPlotItem( const QwtPlotItem & );
    00193     QwtPlotItem &operator=( const QwtPlotItem & );
    00194
    00195     class PrivateData;
    00196     PrivateData *d_data;
    00197 };
    00198
    00199 #endif