Qwt User's Guide 6.1.4

qwt_abstract_scale_draw.h
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_ABSTRACT_SCALE_DRAW_H
11 #define QWT_ABSTRACT_SCALE_DRAW_H
12
13 #include "qwt_global.h"
14 #include "qwt_scale_div.h"
15 #include "qwt_text.h"
16
17 class QPalette;
18 class QPainter;
19 class QFont;
20 class QwtTransform;
21 class QwtScaleMap;
22
31 class QWT_EXPORT QwtAbstractScaleDraw
32 {
33 public:
34
39 enum ScaleComponent
40 {
42 Backbone = 0x01,
43
45 Ticks = 0x02,
46
48 Labels = 0x04
49 };
50
52 typedef QFlags<ScaleComponent> ScaleComponents;
53
54 QwtAbstractScaleDraw();
55 virtual ~QwtAbstractScaleDraw();
56
57 void setScaleDiv( const QwtScaleDiv & );
58 const QwtScaleDiv& scaleDiv() const;
59
60 void setTransformation( QwtTransform * );
61 const QwtScaleMap &scaleMap() const;
62 QwtScaleMap &scaleMap();
63
64 void enableComponent( ScaleComponent, bool enable = true );
65 bool hasComponent( ScaleComponent ) const;
66
67 void setTickLength( QwtScaleDiv::TickType, double length );
68 double tickLength( QwtScaleDiv::TickType ) const;
69 double maxTickLength() const;
70
71 void setSpacing( double );
72 double spacing() const;
73
74 void setPenWidth( int width );
75 int penWidth() const;
76
77 virtual void draw( QPainter *, const QPalette & ) const;
78
79 virtual QwtText label( double ) const;
80
93 virtual double extent( const QFont &font ) const = 0;
94
95 void setMinimumExtent( double );
96 double minimumExtent() const;
97
98 protected:
108 virtual void drawTick( QPainter *painter, double value, double len ) const = 0;
109
116 virtual void drawBackbone( QPainter *painter ) const = 0;
117
126 virtual void drawLabel( QPainter *painter, double value ) const = 0;
127
128 void invalidateCache();
129 const QwtText &tickLabel( const QFont &, double value ) const;
130
131 private:
132 QwtAbstractScaleDraw( const QwtAbstractScaleDraw & );
133 QwtAbstractScaleDraw &operator=( const QwtAbstractScaleDraw & );
134
135 class PrivateData;
136 PrivateData *d_data;
137 };
138
139 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtAbstractScaleDraw::ScaleComponents )
140
141 #endif
QwtTransform
A transformation between coordinate systems.
Definition: qwt_transform.h:35
QwtAbstractScaleDraw
A abstract base class for drawing scales.
Definition: qwt_abstract_scale_draw.h:31
QwtScaleDiv::TickType
TickType
Scale tick types.
Definition: qwt_scale_div.h:40
QwtText
A class representing a text.
Definition: qwt_text.h:51
QwtScaleMap
A scale map.
Definition: qwt_scale_map.h:30
QwtScaleDiv
A class representing a scale division.
Definition: qwt_scale_div.h:36
QwtAbstractScaleDraw::ScaleComponent
ScaleComponent
Definition: qwt_abstract_scale_draw.h:39
QwtAbstractScaleDraw::ScaleComponents
QFlags< ScaleComponent > ScaleComponents
Scale components.
Definition: qwt_abstract_scale_draw.h:52