Qwt User's Guide: qwt_abstract_scale_draw.h Source File

Qwt User's Guide 6.3.0

Loading...
Searching...
No Matches
qwt_abstract_scale_draw.h
1/******************************************************************************
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
16class QwtText;
17class QPalette;
18class QPainter;
19class QFont;
20class QwtTransform;
21class 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
51 Q_DECLARE_FLAGS( ScaleComponents, ScaleComponent )
52
53 QwtAbstractScaleDraw();
54 virtual ~QwtAbstractScaleDraw();
55
56 void setScaleDiv( const QwtScaleDiv& );
57 const QwtScaleDiv& scaleDiv() const;
58
59 void setTransformation( QwtTransform* );
60 const QwtScaleMap& scaleMap() const;
61 QwtScaleMap& scaleMap();
62
63 void enableComponent( ScaleComponent, bool enable = true );
64 bool hasComponent( ScaleComponent ) const;
65
66 void setTickLength( QwtScaleDiv::TickType, double length );
67 double tickLength( QwtScaleDiv::TickType ) const;
68 double maxTickLength() const;
69
70 void setSpacing( double );
71 double spacing() const;
72
73 void setPenWidthF( qreal width );
74 qreal penWidthF() const;
75
76 virtual void draw( QPainter*, const QPalette& ) const;
77
78 virtual QwtText label( double ) const;
79
92 virtual double extent( const QFont& font ) const = 0;
93
94 void setMinimumExtent( double );
95 double minimumExtent() const;
96
97 void invalidateCache();
98
99 protected:
109 virtual void drawTick( QPainter* painter, double value, double len ) const = 0;
110
117 virtual void drawBackbone( QPainter* painter ) const = 0;
118
127 virtual void drawLabel( QPainter* painter, double value ) const = 0;
128
129 const QwtText& tickLabel( const QFont&, double value ) const;
130
131 private:
132 Q_DISABLE_COPY(QwtAbstractScaleDraw)
133
134 class PrivateData;
135 PrivateData* m_data;
136};
137
138Q_DECLARE_OPERATORS_FOR_FLAGS( QwtAbstractScaleDraw::ScaleComponents )
139
140#endif
QwtAbstractScaleDraw
A abstract base class for drawing scales.
Definition qwt_abstract_scale_draw.h:32
QwtAbstractScaleDraw::drawBackbone
virtual void drawBackbone(QPainter *painter) const =0
QwtAbstractScaleDraw::ScaleComponent
ScaleComponent
Definition qwt_abstract_scale_draw.h:40
QwtAbstractScaleDraw::drawTick
virtual void drawTick(QPainter *painter, double value, double len) const =0
QwtAbstractScaleDraw::extent
virtual double extent(const QFont &font) const =0
QwtAbstractScaleDraw::drawLabel
virtual void drawLabel(QPainter *painter, double value) const =0
QwtAbstractScaleDraw::ScaleComponents
QFlags< ScaleComponent > ScaleComponents
Definition qwt_abstract_scale_draw.h:51
QwtScaleDiv
A class representing a scale division.
Definition qwt_scale_div.h:34
QwtScaleDiv::TickType
TickType
Scale tick types.
Definition qwt_scale_div.h:38
QwtScaleMap
A scale map.
Definition qwt_scale_map.h:27
QwtText
A class representing a text.
Definition qwt_text.h:52
QwtTransform
A transformation between coordinate systems.
Definition qwt_transform.h:36