/usr/include/KChart/KChartAbstractAxis.h is in libkchart-dev 2.6.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | /**
* Copyright (C) 2001-2015 Klaralvdalens Datakonsult AB. All rights reserved.
*
* This file is part of the KD Chart library.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KCHARTABSTRACTAXIS_H
#define KCHARTABSTRACTAXIS_H
// #include <QObject>
// #include <QRectF>
// #include <QWidget>
#include "kchart_export.h"
#include "KChartGlobal.h"
#include "KChartAbstractArea.h"
#include "KChartTextAttributes.h"
#include "KChartRulerAttributes.h"
QT_BEGIN_NAMESPACE
class QPainter;
class QSizeF;
QT_END_NAMESPACE
namespace KChart {
class Area;
class AbstractCoordinatePlane;
class PaintContext;
class AbstractDiagram;
/**
* The base class for axes.
*
* For being useful, axes need to be assigned to a diagram, see
* AbstractCartesianDiagram::addAxis and AbstractCartesianDiagram::takeAxis.
*
* \sa PolarAxis, AbstractCartesianDiagram
*/
class KCHART_EXPORT AbstractAxis : public AbstractArea
{
Q_OBJECT
Q_DISABLE_COPY( AbstractAxis )
KCHART_DECLARE_PRIVATE_DERIVED_PARENT( AbstractAxis, AbstractDiagram* )
public:
explicit AbstractAxis( AbstractDiagram* diagram = 0 );
virtual ~AbstractAxis();
// FIXME implement when code os ready for it:
// virtual Area* clone() const = 0;
// FIXME (Mirko) readd when needed
// void copyRelevantDetailsFrom( const KChartAxis* axis );
/* virtual void paint( PaintContext* ) const = 0;
virtual QSize sizeHint() const = 0;*/
//virtual void paintEvent( QPaintEvent* event) = 0;
/**
* \brief Reimplement this method if you want to adjust axis labels
* before they are printed.
*
* KD Chart is calling this method immediately before drawing the
* text, this means: What you return here will be drawn without
* further modifications.
*
* \param label The text of the label as KD Chart has calculated it
* automatically (or as it was taken from a QStringList provided
* by you, resp.)
*
* \note If you reimplement this method in a subclass of KChartCartesianAxis,
* and your reimplementation's return value depends on data other than @p label
* (so KChart will not know when it changes), you must manually ensure that
* layouts are adapted to any changed sizes of the axis labels. To do that,
* call KChartCartesianAxis::layoutPlanes() from your reimplementation when
* you know that the external data changed and it will change label sizes -
* or when you cannot exclude that.
*
* \return The text to be drawn. By default this is the same as \c label.
*/
virtual const QString customizedLabel( const QString& label ) const;
/**
* Returns true if both axes have the same settings.
*/
bool compare( const AbstractAxis* other ) const;
/**
* \internal
*
* Method invoked by AbstractCartesianDiagram::addAxis().
*
* You should not call this function, unless you know exactly,
* what you are doing.
*
* \sa connectSignals(), AbstractCartesianDiagram::addAxis()
*/
void createObserver( AbstractDiagram* diagram );
/**
* \internal
*
* Method invoked by AbstractCartesianDiagram::takeAxis().
*
* You should not call this function, unless you know exactly,
* what you are doing.
*
* \sa AbstractCartesianDiagram::takeAxis()
*/
void deleteObserver( AbstractDiagram* diagram );
const AbstractDiagram* diagram() const;
bool observedBy( AbstractDiagram* diagram ) const;
/**
* Wireing the signal/slot connections.
*
* This method gets called automatically, each time, when you assign
* the axis to a diagram, either by passing a diagram* to the c'tor,
* or by calling the diagram's setAxis method, resp.
*
* If overwriting this method in derived classes, make sure to call
* this base method AbstractAxis::connectSignals(), so your axis
* gets connected to the diagram's built-in signals.
*
* \sa AbstractCartesianDiagram::addAxis()
*/
virtual void connectSignals();
/**
\brief Use this to specify the text attributes to be used for axis labels.
By default, the reference area will be set at painting time.
It will be the then-valid coordinate plane's parent widget,
so normally, it will be the KChart::Chart.
Thus the labels of all of your axes in all of your diagrams
within that Chart will be drawn in same font size, by default.
\sa textAttributes, setLabels
*/
void setTextAttributes( const TextAttributes &a );
/**
\brief Returns the text attributes to be used for axis labels.
\sa setTextAttributes
*/
TextAttributes textAttributes() const;
/**
\brief Use this to specify the attributes used to paint the axis ruler
Every axis has a default set of ruler attributes that is exactly the
same among them. Use this method to specify your own attributes.
\sa rulerAttributes
*/
void setRulerAttributes( const RulerAttributes &a );
/**
\brief Returns the attributes to be used for painting the rulers
\sa setRulerAttributes
*/
RulerAttributes rulerAttributes() const;
/**
\brief Use this to specify your own set of strings, to be used as axis labels.
Labels specified via setLabels take precedence:
If a non-empty list is passed, KD Chart will use these strings as axis labels,
instead of calculating them.
If you pass a smaller number of strings than the number of labels drawn at this
axis, KD Chart will repeat the strings until all labels are drawn.
As an example you could specify the seven days of the week as abscissa labels,
which would be repeatedly used then.
By passing an empty QStringList you can reset the default behaviour.
\sa labels, setShortLabels
*/
void setLabels( const QStringList& list );
/**
Returns a list of strings, that are used as axis labels, as set via setLabels.
\sa setLabels
*/
QStringList labels() const;
/**
\brief Use this to specify your own set of strings, to be used as axis labels,
in case the normal labels are too long.
\note Setting done via setShortLabels will be ignored, if you did not pass
a non-empty string list via setLabels too!
By passing an empty QStringList you can reset the default behaviour.
\sa shortLabels, setLabels
*/
void setShortLabels( const QStringList& list );
/**
Returns a list of strings, that are used as axis labels, as set via setShortLabels.
\note Setting done via setShortLabels will be ignored, if you did not pass
a non-empty string list via setLabels too!
\sa setShortLabels
*/
QStringList shortLabels() const;
virtual void setGeometry( const QRect& rect ) = 0;
virtual QRect geometry() const = 0;
/**
\brief Convenience function, returns the coordinate plane, in which this axis is used.
If the axis is not used in a coordinate plane, the return value is Zero.
*/
const AbstractCoordinatePlane* coordinatePlane() const;
protected Q_SLOTS:
/** called for initializing after the c'tor has completed */
virtual void delayedInit();
public Q_SLOTS:
void update();
Q_SIGNALS:
void coordinateSystemChanged();
};
}
#endif // KCHARTABSTRACTAXIS_H
|