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

« back to all changes in this revision

Viewing changes to qwt-5.1.1/src/qwt_plot_scaleitem.h

  • Committer: Bazaar Package Importer
  • Author(s): Fathi Boudra
  • Date: 2009-04-12 23:25:58 UTC
  • mfrom: (1.1.4 upstream) (2.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090412232558-3bl06x785yr8xm8u
Tags: 5.1.2-1
* New upstream release.
* Bump compat/debhelper to 7.
* Bump Standards-Version to 3.8.1. No changes needed.
* Invert Maintainers and Uploaders field.
* Fix lintian warnings:
  - dh_clean _k deprecated.
  - missing dependency on libc.

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_SCALE_ITEM_H
11
 
#define QWT_PLOT_SCALE_ITEM_H
12
 
 
13
 
#include "qwt_global.h"
14
 
#include "qwt_plot_item.h"
15
 
#include "qwt_scale_draw.h"
16
 
 
17
 
#if QT_VERSION < 0x040000
18
 
class QColorGroup;
19
 
#else
20
 
class QPalette;
21
 
#endif
22
 
 
23
 
/*!
24
 
  \brief A class which draws a scale inside the plot canvas
25
 
 
26
 
  QwtPlotScaleItem can be used to draw an axis inside the plot canvas.
27
 
  It might by synchronized to one of the axis of the plot, but can
28
 
  also display its own ticks and labels.
29
 
 
30
 
  It is allowed to synchronize the scale item with a disabled axis.
31
 
  In plots with vertical and horizontal scale items, it might be
32
 
  necessary to remove ticks at the intersections, by overloading
33
 
  updateScaleDiv().
34
 
 
35
 
  The scale might be at a specific position (f.e 0.0) or it might be
36
 
  aligned to a canvas border.
37
 
 
38
 
  \par Example
39
 
  The following example shows how to replace the left axis, by a scale item
40
 
  at the x position 0.0.
41
 
  \verbatim
42
 
QwtPlotScaleItem *scaleItem = 
43
 
    new QwtPlotScaleItem(QwtScaleDraw::RightScale, 0.0);
44
 
scaleItem->setFont(plot->axisWidget(QwtPlot::yLeft)->font());
45
 
scaleItem->attach(plot);
46
 
 
47
 
plot->enableAxis(QwtPlot::yLeft, false);
48
 
\endverbatim
49
 
*/
50
 
 
51
 
class QWT_EXPORT QwtPlotScaleItem: public QwtPlotItem
52
 
{
53
 
public:
54
 
    explicit QwtPlotScaleItem(
55
 
        QwtScaleDraw::Alignment = QwtScaleDraw::BottomScale, 
56
 
        const double pos = 0.0);
57
 
    virtual ~QwtPlotScaleItem();
58
 
 
59
 
    virtual int rtti() const;
60
 
 
61
 
    void setScaleDiv(const QwtScaleDiv& );
62
 
    const QwtScaleDiv& scaleDiv() const;
63
 
 
64
 
    void setScaleDivFromAxis(bool on);
65
 
    bool isScaleDivFromAxis() const;
66
 
    
67
 
#if QT_VERSION < 0x040000
68
 
    void setColorGroup(const QColorGroup &);
69
 
    QColorGroup colorGroup() const;
70
 
#else
71
 
    void setPalette(const QPalette &);
72
 
    QPalette palette() const;
73
 
#endif
74
 
 
75
 
    void setFont(const QFont&);
76
 
    QFont font() const;
77
 
 
78
 
    void setScaleDraw(QwtScaleDraw *);
79
 
 
80
 
    const QwtScaleDraw *scaleDraw() const;
81
 
    QwtScaleDraw *scaleDraw();
82
 
 
83
 
    void setPosition(double pos);
84
 
    double position() const;
85
 
 
86
 
    void setBorderDistance(int numPixels);
87
 
    int borderDistance() const;
88
 
 
89
 
    void setAlignment(QwtScaleDraw::Alignment);
90
 
 
91
 
    virtual void draw(QPainter *p, 
92
 
        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
93
 
        const QRect &rect) const;
94
 
 
95
 
    virtual void updateScaleDiv(const QwtScaleDiv&,
96
 
        const QwtScaleDiv&);
97
 
 
98
 
private:
99
 
    void updateBorders();
100
 
 
101
 
    class PrivateData;
102
 
    PrivateData *d_data;
103
 
};
104
 
 
105
 
#endif