source: pacpusframework/branches/2.0-beta1/include/extlib/qwt-5.2.1/qwt_scale_draw.h@ 89

Last change on this file since 89 was 89, checked in by morasjul, 11 years ago

PACPUS 2.0 Beta deployed in new branch

Major changes:
-Add communication interface between components
-Add examples for communications interface (TestComponents)
-Move to Qt5 support

  • Property svn:executable set to *
File size: 3.1 KB
Line 
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 <qpoint.h>
14#include "qwt_global.h"
15#include "qwt_abstract_scale_draw.h"
16
17/*!
18 \brief A class for drawing scales
19
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().
24
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.
28*/
29
30class QWT_EXPORT QwtScaleDraw: public QwtAbstractScaleDraw
31{
32public:
33 /*!
34 Alignment of the scale draw
35 \sa setAlignment(), alignment()
36 */
37 enum Alignment { BottomScale, TopScale, LeftScale, RightScale };
38
39 QwtScaleDraw();
40 QwtScaleDraw(const QwtScaleDraw &);
41
42 virtual ~QwtScaleDraw();
43
44 QwtScaleDraw &operator=(const QwtScaleDraw &other);
45
46 void getBorderDistHint(const QFont &, int &start, int &end) const;
47 int minLabelDist(const QFont &) const;
48
49 int minLength(const QPen &, const QFont &) const;
50 virtual int extent(const QPen &, const QFont &) const;
51
52 void move(int x, int y);
53 void move(const QPoint &);
54 void setLength(int length);
55
56 Alignment alignment() const;
57 void setAlignment(Alignment);
58
59 Qt::Orientation orientation() const;
60
61 QPoint pos() const;
62 int length() const;
63
64#if QT_VERSION < 0x040000
65 void setLabelAlignment(int);
66 int labelAlignment() const;
67#else
68 void setLabelAlignment(Qt::Alignment);
69 Qt::Alignment labelAlignment() const;
70#endif
71
72 void setLabelRotation(double rotation);
73 double labelRotation() const;
74
75 int maxLabelHeight(const QFont &) const;
76 int maxLabelWidth(const QFont &) const;
77
78 QPoint labelPosition(double val) const;
79
80 QRect labelRect(const QFont &, double val) const;
81 QSize labelSize(const QFont &, double val) const;
82
83 QRect boundingLabelRect(const QFont &, double val) const;
84
85protected:
86
87#if QT_VERSION < 0x040000
88 QWMatrix labelMatrix(const QPoint &, const QSize &) const;
89#else
90 QMatrix labelMatrix(const QPoint &, const QSize &) const;
91#endif
92
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;
96
97private:
98 void updateMap();
99
100 class PrivateData;
101 PrivateData *d_data;
102};
103
104/*!
105 Move the position of the scale
106 \sa move(const QPoint &)
107*/
108inline void QwtScaleDraw::move(int x, int y)
109{
110 move(QPoint(x, y));
111}
112
113#endif
Note: See TracBrowser for help on using the repository browser.