Qwt User's Guide 6.0.2

- Main Page
- Related Pages
- Classes

qwt_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_SCALE_DRAW_H
11 #define QWT_SCALE_DRAW_H
12
13 #include "qwt_global.h"
14 #include "qwt_abstract_scale_draw.h"
15 #include <qpoint.h>
16 #include <qrect.h>
17 #include <qtransform.h>
18
32 class QWT_EXPORT QwtScaleDraw: public QwtAbstractScaleDraw
33 {
34 public:
39 enum Alignment
40 {
42 BottomScale,
43
45 TopScale,
46
48 LeftScale,
49
51 RightScale
52 };
53
54 QwtScaleDraw();
55 virtual ~QwtScaleDraw();
56
57 void getBorderDistHint( const QFont &, int &start, int &end ) const;
58 int minLabelDist( const QFont & ) const;
59
60 int minLength( const QFont & ) const;
61 virtual double extent( const QFont & ) const;
62
63 void move( double x, double y );
64 void move( const QPointF & );
65 void setLength( double length );
66
67 Alignment alignment() const;
68 void setAlignment( Alignment );
69
70 Qt::Orientation orientation() const;
71
72 QPointF pos() const;
73 double length() const;
74
75 void setLabelAlignment( Qt::Alignment );
76 Qt::Alignment labelAlignment() const;
77
78 void setLabelRotation( double rotation );
79 double labelRotation() const;
80
81 int maxLabelHeight( const QFont & ) const;
82 int maxLabelWidth( const QFont & ) const;
83
84 QPointF labelPosition( double val ) const;
85
86 QRectF labelRect( const QFont &, double val ) const;
87 QSizeF labelSize( const QFont &, double val ) const;
88
89 QRect boundingLabelRect( const QFont &, double val ) const;
90
91 protected:
92 QTransform labelTransformation( const QPointF &, const QSizeF & ) const;
93
94 virtual void drawTick( QPainter *, double val, double len ) const;
95 virtual void drawBackbone( QPainter * ) const;
96 virtual void drawLabel( QPainter *, double val ) const;
97
98 private:
99 QwtScaleDraw( const QwtScaleDraw & );
100 QwtScaleDraw &operator=( const QwtScaleDraw &other );
101
102 void updateMap();
103
104 class PrivateData;
105 PrivateData *d_data;
106 };
107
112 inline void QwtScaleDraw::move( double x, double y )
113 {
114 move( QPointF( x, y ) );
115 }
116
117 #endif