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_ABSTRACT_SCALE_DRAW_H
11
#define QWT_ABSTRACT_SCALE_DRAW_H
13
#include "qwt_global.h"
14
#include "qwt_scale_div.h"
18
#if QT_VERSION < 0x040000
25
class QwtScaleTransformation;
29
\brief A abstract base class for drawing scales
31
QwtAbstractScaleDraw can be used to draw linear or logarithmic scales.
33
After a scale division has been specified as a QwtScaleDiv object
34
using QwtAbstractScaleDraw::setScaleDiv(const QwtScaleDiv &s),
35
the scale can be drawn with the QwtAbstractScaleDraw::draw() member.
37
class QWT_EXPORT QwtAbstractScaleDraw
48
\sa QwtAbstractScaleDraw::enableComponent,
49
QwtAbstractScaleDraw::hasComponent
59
QwtAbstractScaleDraw();
60
QwtAbstractScaleDraw( const QwtAbstractScaleDraw & );
61
virtual ~QwtAbstractScaleDraw();
63
QwtAbstractScaleDraw &operator=(const QwtAbstractScaleDraw &);
65
void setScaleDiv(const QwtScaleDiv &s);
66
const QwtScaleDiv& scaleDiv() const;
68
void setTransformation(QwtScaleTransformation *);
69
const QwtScaleMap &map() const;
71
void enableComponent(ScaleComponent, bool enable = true);
72
bool hasComponent(ScaleComponent) const;
74
void setTickLength(QwtScaleDiv::TickType, int length);
75
int tickLength(QwtScaleDiv::TickType) const;
76
int majTickLength() const;
78
void setSpacing(int margin);
81
#if QT_VERSION < 0x040000
82
virtual void draw(QPainter *, const QColorGroup &) const;
84
virtual void draw(QPainter *, const QPalette &) const;
87
virtual QwtText label(double) const;
92
The extent is the distcance from the baseline to the outermost
93
pixel of the scale draw in opposite to its orientation.
94
It is at least minimumExtent() pixels.
96
\sa setMinimumExtent(), minimumExtent()
98
virtual int extent(const QPen &, const QFont &) const = 0;
100
void setMinimumExtent(int);
101
int minimumExtent() const;
103
QwtScaleMap &scaleMap();
109
\param painter Painter
110
\param value Value of the tick
111
\param len Lenght of the tick
113
\sa drawBackbone(), drawLabel()
115
virtual void drawTick(QPainter *painter, double value, int len) const = 0;
118
Draws the baseline of the scale
119
\param painter Painter
121
\sa drawTick(), drawLabel()
123
virtual void drawBackbone(QPainter *painter) const = 0;
126
Draws the label for a major scale tick
128
\param painter Painter
131
\sa drawTick, drawBackbone
133
virtual void drawLabel(QPainter *painter, double value) const = 0;
135
void invalidateCache();
136
const QwtText &tickLabel(const QFont &, double value) const;
139
int operator==(const QwtAbstractScaleDraw &) const;
140
int operator!=(const QwtAbstractScaleDraw &) const;