~ubuntu-branches/ubuntu/oneiric/qwt/oneiric-proposed

« back to all changes in this revision

Viewing changes to qwt-5.1.0/src/qwt_plot_item.h

  • Committer: Bazaar Package Importer
  • Author(s): Fathi Boudra
  • Date: 2008-05-26 10:26:31 UTC
  • mfrom: (1.1.3 upstream) (2.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080526102631-bp95mfccnrb957nx
Tags: 5.1.1-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
2
 
 * Qwt Widget Library
3
 
 * Copyright (C) 1997   Josef Wilgen
4
 
 * Copyright (C) 2002   Uwe Rathmann
5
 
 * 
6
 
 * This library is free software; you can redistribute it and/or
7
 
 * modify it under the terms of the Qwt License, Version 1.0
8
 
 *****************************************************************************/
9
 
 
10
 
#ifndef QWT_PLOT_ITEM_H
11
 
#define QWT_PLOT_ITEM_H
12
 
 
13
 
#include "qwt_global.h"
14
 
#include "qwt_legend_itemmanager.h"
15
 
#include "qwt_text.h"
16
 
#include "qwt_double_rect.h"
17
 
 
18
 
class QString;
19
 
class QRect;
20
 
class QPainter;
21
 
class QWidget;
22
 
class QwtPlot;
23
 
class QwtLegend;
24
 
class QwtScaleMap;
25
 
class QwtScaleDiv;
26
 
 
27
 
/*!
28
 
  \brief Base class for items on the plot canvas
29
 
*/
30
 
 
31
 
class QWT_EXPORT QwtPlotItem: public QwtLegendItemManager
32
 
{
33
 
public:
34
 
    enum RttiValues
35
 
    { 
36
 
        Rtti_PlotItem = 0,
37
 
 
38
 
        Rtti_PlotGrid,
39
 
        Rtti_PlotScale,
40
 
        Rtti_PlotMarker,
41
 
        Rtti_PlotCurve,
42
 
        Rtti_PlotHistogram,
43
 
        Rtti_PlotSpectrogram,
44
 
        Rtti_PlotSVG,
45
 
 
46
 
        Rtti_PlotUserItem = 1000
47
 
    };
48
 
 
49
 
    enum ItemAttribute
50
 
    {
51
 
        Legend = 1,
52
 
        AutoScale = 2
53
 
    };
54
 
 
55
 
#if QT_VERSION >= 0x040000
56
 
    enum RenderHint
57
 
    {
58
 
        RenderAntialiased = 1
59
 
    };
60
 
#endif
61
 
 
62
 
    explicit QwtPlotItem(const QwtText &title = QwtText());
63
 
    virtual ~QwtPlotItem();
64
 
 
65
 
    void attach(QwtPlot *plot);
66
 
 
67
 
    /*!
68
 
       \brief This method detaches a QwtPlotItem from any QwtPlot it has been
69
 
              associated with.
70
 
 
71
 
       detach() is equivalent to calling attach( NULL )
72
 
       \sa attach( QwtPlot* plot )
73
 
    */
74
 
    void detach() { attach(NULL); }
75
 
 
76
 
    QwtPlot *plot() const;
77
 
    
78
 
    void setTitle(const QString &title);
79
 
    void setTitle(const QwtText &title);
80
 
    const QwtText &title() const;
81
 
 
82
 
    virtual int rtti() const;
83
 
 
84
 
    void setItemAttribute(ItemAttribute, bool on = true);
85
 
    bool testItemAttribute(ItemAttribute) const;
86
 
 
87
 
#if QT_VERSION >= 0x040000
88
 
    void setRenderHint(RenderHint, bool on = true);
89
 
    bool testRenderHint(RenderHint) const;
90
 
#endif
91
 
 
92
 
    double z() const; 
93
 
    void setZ(double z);
94
 
 
95
 
    void show();
96
 
    void hide();
97
 
    virtual void setVisible(bool);
98
 
    bool isVisible () const;
99
 
 
100
 
    void setAxis(int xAxis, int yAxis);
101
 
 
102
 
    void setXAxis(int axis);
103
 
    int xAxis() const;
104
 
 
105
 
    void setYAxis(int axis);
106
 
    int yAxis() const;
107
 
 
108
 
    virtual void itemChanged();
109
 
 
110
 
    /*!
111
 
      \brief Draw the item
112
 
 
113
 
      \param painter Painter
114
 
      \param xMap Maps x-values into pixel coordinates.
115
 
      \param yMap Maps y-values into pixel coordinates.
116
 
      \param canvasRect Contents rect of the canvas in painter coordinates
117
 
    */
118
 
    virtual void draw(QPainter *painter, 
119
 
        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
120
 
        const QRect &canvasRect) const = 0;
121
 
 
122
 
    virtual QwtDoubleRect boundingRect() const;
123
 
 
124
 
    virtual void updateLegend(QwtLegend *) const;
125
 
    virtual void updateScaleDiv(const QwtScaleDiv&,
126
 
        const QwtScaleDiv&);
127
 
 
128
 
    virtual QWidget *legendItem() const;
129
 
 
130
 
    QwtDoubleRect scaleRect(const QwtScaleMap &, const QwtScaleMap &) const;
131
 
    QRect paintRect(const QwtScaleMap &, const QwtScaleMap &) const;
132
 
    
133
 
    QRect transform(const QwtScaleMap &, const QwtScaleMap &, 
134
 
        const QwtDoubleRect&) const; 
135
 
    QwtDoubleRect invTransform(const QwtScaleMap &, const QwtScaleMap &,
136
 
        const QRect&) const; 
137
 
 
138
 
private:
139
 
    // Disabled copy constructor and operator=
140
 
    QwtPlotItem( const QwtPlotItem & );
141
 
    QwtPlotItem &operator=( const QwtPlotItem & );
142
 
 
143
 
    class PrivateData;
144
 
    PrivateData *d_data;
145
 
};
146
 
            
147
 
#endif