File indexing completed on 2024-05-12 15:54:20

0001 /*
0002  * Copyright (C) 2001-2015 Klaralvdalens Datakonsult AB.  All rights reserved.
0003  *
0004  * This file is part of the KD Chart library.
0005  *
0006  * This program is free software; you can redistribute it and/or
0007  * modify it under the terms of the GNU General Public License as
0008  * published by the Free Software Foundation; either version 2 of
0009  * the License, or (at your option) any later version.
0010  *
0011  * This program is distributed in the hope that it will be useful,
0012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014  * GNU General Public License for more details.
0015  *
0016  * You should have received a copy of the GNU General Public License
0017  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
0018  */
0019 
0020 #ifndef KCHARTVALUETRACKERATTRIBUTES_H
0021 #define KCHARTVALUETRACKERATTRIBUTES_H
0022 
0023 #include <QDebug>
0024 #include <QMetaType>
0025 #include "KChartGlobal.h"
0026 
0027 namespace KChart {
0028 
0029     /**
0030      * \class ValueTrackerAttributes KChartValueTrackerAttributes.h KChartValueTrackerAttributes
0031      * \brief Cell-specific attributes regarding value tracking
0032      *
0033      * ValueTrackerAttributes groups the properties regarding
0034      * value tracking, and how it is displayed.
0035      * Value tracking can be used to emphasize on one or several
0036      * specific points in a line diagram.
0037    */
0038 
0039     class KCHART_EXPORT ValueTrackerAttributes
0040     {
0041         public:
0042             ValueTrackerAttributes();
0043             ValueTrackerAttributes( const ValueTrackerAttributes& );
0044             ValueTrackerAttributes &operator= ( const ValueTrackerAttributes& );
0045 
0046             ~ValueTrackerAttributes();
0047 
0048             /** Set the pen the value tracking lines and markers will be drawn with
0049              * \param pen The pen the lines and markers will be drawn with
0050              */
0051             void setPen( const QPen& pen );
0052 
0053             /**
0054              * @return The pen the lines and markers are drawn with
0055              */
0056             QPen pen() const;
0057 
0058             void setLinePen( const QPen &pen );
0059             QPen linePen() const;
0060 
0061             void setMarkerPen( const QPen &pen );
0062             QPen markerPen() const;
0063 
0064             void setMarkerBrush( const QBrush &brush );
0065             QBrush markerBrush() const;
0066 
0067             void setArrowBrush( const QBrush &brush );
0068             QBrush arrowBrush() const;
0069 
0070             /** Set the brush the area below the value tracking
0071              * lines should be filled with. Default is a black brush
0072              * with the style Qt::NoBrush.
0073              * \param brush The brush the area should be filled with
0074              */
0075             void setAreaBrush( const QBrush& brush );
0076 
0077             /**
0078              * @return The brush the area below the value tracking lines is filled with
0079              */
0080             QBrush areaBrush() const;
0081 
0082             /** Set the size of the markers. This includes both the arrows at
0083              * the axises and the circle at the data point.
0084              * \param size The size of the markers
0085              */
0086             void setMarkerSize( const QSizeF& size );
0087 
0088             /**
0089              * @return The size of the markers
0090              */
0091             QSizeF markerSize() const;
0092 
0093             /**
0094              * @return The orientations used to show the value tracking. Using only a
0095              * vertical line, horizontal line or both (the default).
0096              */
0097             Qt::Orientations orientations() const;
0098 
0099             /** Set the orientations used to show the value tracking.
0100              * \param orientations The orientations of the value tracking lines.
0101              */
0102             void setOrientations( Qt::Orientations orientations );
0103 
0104             /** Set whether value tracking should be enabled for a specific
0105              * index or not
0106              * \param enabled Whether value tracking should be enabled or not
0107              */
0108             void setEnabled( bool enabled );
0109 
0110             /**
0111              * @return Whether value tracking is enabled or not
0112              */
0113             bool isEnabled() const;
0114 
0115             bool operator==( const ValueTrackerAttributes& ) const;
0116             inline bool operator!=( const ValueTrackerAttributes& other ) const { return !operator==(other); }
0117 
0118         private:
0119             KCHART_DECLARE_PRIVATE_BASE_VALUE( ValueTrackerAttributes )
0120     }; // End of class ValueTrackerAttributes
0121 
0122 }
0123 
0124 #if !defined(QT_NO_DEBUG_STREAM)
0125 KCHART_EXPORT QDebug operator<<(QDebug, const KChart::ValueTrackerAttributes& );
0126 #endif /* QT_NO_DEBUG_STREAM */
0127 
0128 KCHART_DECLARE_SWAP_SPECIALISATION( KChart::ValueTrackerAttributes )
0129 
0130 QT_BEGIN_NAMESPACE
0131 Q_DECLARE_TYPEINFO( KChart::ValueTrackerAttributes, Q_MOVABLE_TYPE );
0132 QT_END_NAMESPACE
0133 
0134 Q_DECLARE_METATYPE( KChart::ValueTrackerAttributes )
0135 
0136 #endif // KCHARTVALUETRACKERATTRIBUTES_H