1
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
3
* Copyright (C) 1997 Josef Wilgen
4
* Copyright (C) 2002 Uwe Rathmann
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
*****************************************************************************/
10
#ifndef QWT_SCALE_DRAW_H
11
#define QWT_SCALE_DRAW_H
14
#include "qwt_global.h"
15
#include "qwt_abstract_scale_draw.h"
18
\brief A class for drawing scales
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().
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.
30
class QWT_EXPORT QwtScaleDraw: public QwtAbstractScaleDraw
34
Alignment of the scale draw
35
\sa setAlignment(), alignment()
37
enum Alignment { BottomScale, TopScale, LeftScale, RightScale };
40
QwtScaleDraw(const QwtScaleDraw &);
42
virtual ~QwtScaleDraw();
44
QwtScaleDraw &operator=(const QwtScaleDraw &other);
46
void getBorderDistHint(const QFont &, int &start, int &end) const;
47
int minLabelDist(const QFont &) const;
49
int minLength(const QPen &, const QFont &) const;
50
virtual int extent(const QPen &, const QFont &) const;
52
void move(int x, int y);
53
void move(const QPoint &);
54
void setLength(int length);
56
Alignment alignment() const;
57
void setAlignment(Alignment);
59
Qt::Orientation orientation() const;
64
#if QT_VERSION < 0x040000
65
void setLabelAlignment(int);
66
int labelAlignment() const;
68
void setLabelAlignment(Qt::Alignment);
69
Qt::Alignment labelAlignment() const;
72
void setLabelRotation(double rotation);
73
double labelRotation() const;
75
int maxLabelHeight(const QFont &) const;
76
int maxLabelWidth(const QFont &) const;
78
QPoint labelPosition(double val) const;
80
QRect labelRect(const QFont &, double val) const;
81
QSize labelSize(const QFont &, double val) const;
83
QRect boundingLabelRect(const QFont &, double val) const;
87
#if QT_VERSION < 0x040000
88
QWMatrix labelMatrix(const QPoint &, const QSize &) const;
90
QMatrix labelMatrix(const QPoint &, const QSize &) const;
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;
104
inline void QwtScaleDraw::move(int x, int y)