2
KDChart - a multi-platform charting engine
5
/****************************************************************************
6
** Copyright (C) 2005-2007 Klarävdalens Datakonsult AB. All rights reserved.
8
** This file is part of the KD Chart library.
10
** This file may be used under the terms of the GNU General Public
11
** License versions 2.0 or 3.0 as published by the Free Software
12
** Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3
13
** included in the packaging of this file. Alternatively you may (at
14
** your option) use any later version of the GNU General Public
15
** License if such license has been publicly approved by
16
** Klarälvdalens Datakonsult AB (or its successors, if any).
18
** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
19
** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
20
** A PARTICULAR PURPOSE. Klarälvdalens Datakonsult AB reserves all rights
21
** not expressly granted herein.
23
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
24
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
26
**********************************************************************/
28
#ifndef KDCHARTTEXTATTRIBUTES_H
29
#define KDCHARTTEXTATTRIBUTES_H
33
#include "KDChartGlobal.h"
34
#include "KDChartMeasure.h"
42
* \brief A set of text attributes.
44
* TextAttributes encapsulates settings that have to do with
45
* text. This includes font, fontsize, color, whether the text
48
class KDCHART_EXPORT TextAttributes
52
TextAttributes( const TextAttributes& );
53
TextAttributes &operator= ( const TextAttributes& );
54
bool operator==( const TextAttributes& ) const;
55
inline bool operator!=( const TextAttributes& other ) const
56
{ return !operator==(other); }
61
* Set whether the text is to be rendered at all.
62
* \param visible Whether the text is visible.
64
void setVisible( bool visible );
67
* \return Whether the text is visible.
69
bool isVisible() const;
72
* Set the font to be used for rendering the text.
74
* \note All of the font's attributes will be used - except of its size!
75
* To specify the size please use setFontSize (or setMinimalFontSize, resp.)
77
* \param font The font to use.
79
* \sa setFontSize, setMinimalFontSize
81
void setFont( const QFont& font );
84
* \return The font that is used for rendering text.
89
* Set the size of the font used for rendering text.
90
* \param measure The measure to use.
93
void setFontSize( const Measure & measure );
96
* \return The measure used for the font size.
98
Measure fontSize() const;
101
* Set the minimal size of the font used for rendering text.
102
* \param measure The measure to use.
105
void setMinimalFontSize( const Measure & measure );
108
* \return The measure used for the minimal font size.
110
Measure minimalFontSize() const;
113
* \brief Returns the font size that is used at drawing time.
115
* This method is called at drawing time. It returns the
116
* font size as it is used for rendering text, taking into account
117
* any measures that were set via setFontSize and/or setMinimalFontSize.
119
#if QT_VERSION < 0x040400 || defined(Q_COMPILER_MANGLES_RETURN_TYPE)
120
const qreal calculatedFontSize(
122
qreal calculatedFontSize(
124
const QObject* autoReferenceArea,
125
KDChartEnums::MeasureOrientation autoReferenceOrientation ) const;
128
* \brief Returns the font in the size that is used at drawing time.
130
* This method is called at drawing time. It returns the
131
* font as it is used for rendering text, taking into account
132
* any measures that were set via setFontSize and/or setMinimalFontSize.
134
const QFont calculatedFont(
135
const QObject* autoReferenceArea,
136
KDChartEnums::MeasureOrientation autoReferenceOrientation ) const;
139
* \return Whether the text has an absolute font size set.
141
bool hasAbsoluteFontSize() const;
144
* Set whether the text should be automatically rotated as
145
* needed when space is constraint.
146
* \param autoRotate Whether text should be automatically rotated.
148
void setAutoRotate( bool autoRotate );
151
* \return Whether text is automatically rotated when space is
154
bool autoRotate() const;
157
* Set whether the text should automatically be shrunk, if
158
* space is constraint.
159
* \param autoShrink Whether text should be auto-shrunk.
161
void setAutoShrink( bool autoShrink );
164
* \return Whether text is automatically shrunk if space is
167
bool autoShrink() const;
170
* Set the rotation angle to use for the text.
172
* \note For axis titles the rotation angle can be set to one of the
173
* following angles: 0, 90, 180, 270
174
* Any other values specified will be replaced by the next smaller
175
* one of the allowed values, so no matter what you set the rotation
176
* will always be one of these four values.
178
* \param rotation The rotation angle.
180
void setRotation( int rotation );
183
* \return The rotation angle used for rendering the text.
185
int rotation() const;
188
* Set the pen to use for rendering the text.
189
* \param pen The pen to use.
191
void setPen( const QPen& pen );
194
* \return The pen used for rendering the text.
198
// FIXME KDChartEnums::TextLayoutPolicy?
201
KDCHART_DECLARE_PRIVATE_BASE_VALUE( TextAttributes )
203
}; // End of class TextAttributes
207
#if !defined(QT_NO_DEBUG_STREAM)
208
KDCHART_EXPORT QDebug operator<<(QDebug, const KDChart::TextAttributes& );
209
#endif /* QT_NO_DEBUG_STREAM */
211
KDCHART_DECLARE_SWAP_SPECIALISATION( KDChart::TextAttributes )
212
Q_DECLARE_METATYPE( KDChart::TextAttributes )
213
Q_DECLARE_TYPEINFO( KDChart::TextAttributes, Q_MOVABLE_TYPE );
215
#endif // KDCHARTTEXTATTRIBUTES_H