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

« back to all changes in this revision

Viewing changes to qwt-5.1.0/src/qwt_scale_draw.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_SCALE_DRAW_H
11
 
#define QWT_SCALE_DRAW_H
12
 
 
13
 
#include <qpoint.h>
14
 
#include "qwt_global.h"
15
 
#include "qwt_abstract_scale_draw.h"
16
 
 
17
 
/*!
18
 
  \brief A class for drawing scales
19
 
 
20
 
  QwtScaleDraw can be used to draw linear or logarithmic scales.
21
 
  A scale has a position, an alignment and a length, which can be specified .
22
 
  The labels can be rotated and aligned
23
 
  to the ticks using setLabelRotation() and setLabelAlignment().
24
 
 
25
 
  After a scale division has been specified as a QwtScaleDiv object
26
 
  using QwtAbstractScaleDraw::setScaleDiv(const QwtScaleDiv &s),
27
 
  the scale can be drawn with the QwtAbstractScaleDraw::draw() member.
28
 
*/
29
 
 
30
 
class QWT_EXPORT QwtScaleDraw: public QwtAbstractScaleDraw
31
 
{
32
 
public:
33
 
    /*! 
34
 
        Alignment of the scale draw
35
 
        \sa setAlignment(), alignment()
36
 
     */
37
 
    enum Alignment { BottomScale, TopScale, LeftScale, RightScale };
38
 
 
39
 
    QwtScaleDraw();
40
 
    QwtScaleDraw(const QwtScaleDraw &);
41
 
 
42
 
    virtual ~QwtScaleDraw();
43
 
 
44
 
    QwtScaleDraw &operator=(const QwtScaleDraw &other);
45
 
 
46
 
    void getBorderDistHint(const QFont &, int &start, int &end) const;
47
 
    int minLabelDist(const QFont &) const;
48
 
 
49
 
    int minLength(const QPen &, const QFont &) const;
50
 
    virtual int extent(const QPen &, const QFont &) const;
51
 
 
52
 
    void move(int x, int y);
53
 
    void move(const QPoint &);
54
 
    void setLength(int length);
55
 
 
56
 
    Alignment alignment() const;
57
 
    void setAlignment(Alignment);
58
 
 
59
 
    Qt::Orientation orientation() const;
60
 
 
61
 
    QPoint pos() const;
62
 
    int length() const;
63
 
 
64
 
#if QT_VERSION < 0x040000
65
 
    void setLabelAlignment(int);
66
 
    int labelAlignment() const;
67
 
#else
68
 
    void setLabelAlignment(Qt::Alignment);
69
 
    Qt::Alignment labelAlignment() const;
70
 
#endif
71
 
 
72
 
    void setLabelRotation(double rotation);
73
 
    double labelRotation() const;
74
 
 
75
 
    int maxLabelHeight(const QFont &) const;
76
 
    int maxLabelWidth(const QFont &) const;
77
 
 
78
 
    QPoint labelPosition(double val) const;
79
 
 
80
 
    QRect labelRect(const QFont &, double val) const;
81
 
    QSize labelSize(const QFont &, double val) const;
82
 
 
83
 
    QRect boundingLabelRect(const QFont &, double val) const;
84
 
 
85
 
protected:
86
 
 
87
 
#if QT_VERSION < 0x040000
88
 
    QWMatrix labelMatrix(const QPoint &, const QSize &) const;
89
 
#else   
90
 
    QMatrix labelMatrix(const QPoint &, const QSize &) const;
91
 
#endif  
92
 
 
93
 
    virtual void drawTick(QPainter *p, double val, int len) const;
94
 
    virtual void drawBackbone(QPainter *p) const;
95
 
    virtual void drawLabel(QPainter *p, double val) const;
96
 
 
97
 
private:
98
 
    void updateMap();
99
 
 
100
 
    class PrivateData;
101
 
    PrivateData *d_data;
102
 
};
103
 
 
104
 
inline void QwtScaleDraw::move(int x, int y)
105
 
{
106
 
    move(QPoint(x, y));
107
 
}
108
 
 
109
 
#endif