1 /*
2  * Copyright (C) 2001-2015 Klaralvdalens Datakonsult AB.  All rights reserved.
3  *
4  * This file is part of the KD Chart library.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; either version 2 of
9  * the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef KCHARTVALUETRACKERATTRIBUTES_H
21 #define KCHARTVALUETRACKERATTRIBUTES_H
22 
23 #include <QDebug>
24 #include <QMetaType>
25 #include "KChartGlobal.h"
26 
27 namespace KChart {
28 
29     /**
30      * \class ValueTrackerAttributes KChartValueTrackerAttributes.h KChartValueTrackerAttributes
31      * \brief Cell-specific attributes regarding value tracking
32      *
33      * ValueTrackerAttributes groups the properties regarding
34      * value tracking, and how it is displayed.
35      * Value tracking can be used to emphasize on one or several
36      * specific points in a line diagram.
37    */
38 
39     class KCHART_EXPORT ValueTrackerAttributes
40     {
41         public:
42             ValueTrackerAttributes();
43             ValueTrackerAttributes( const ValueTrackerAttributes& );
44             ValueTrackerAttributes &operator= ( const ValueTrackerAttributes& );
45 
46             ~ValueTrackerAttributes();
47 
48             /** Set the pen the value tracking lines and markers will be drawn with
49              * \param pen The pen the lines and markers will be drawn with
50              */
51             void setPen( const QPen& pen );
52 
53             /**
54              * @return The pen the lines and markers are drawn with
55              */
56             QPen pen() const;
57 
58             void setLinePen( const QPen &pen );
59             QPen linePen() const;
60 
61             void setMarkerPen( const QPen &pen );
62             QPen markerPen() const;
63 
64             void setMarkerBrush( const QBrush &brush );
65             QBrush markerBrush() const;
66 
67             void setArrowBrush( const QBrush &brush );
68             QBrush arrowBrush() const;
69 
70             /** Set the brush the area below the value tracking
71              * lines should be filled with. Default is a black brush
72              * with the style Qt::NoBrush.
73              * \param brush The brush the area should be filled with
74              */
75             void setAreaBrush( const QBrush& brush );
76 
77             /**
78              * @return The brush the area below the value tracking lines is filled with
79              */
80             QBrush areaBrush() const;
81 
82             /** Set the size of the markers. This includes both the arrows at
83              * the axises and the circle at the data point.
84              * \param size The size of the markers
85              */
86             void setMarkerSize( const QSizeF& size );
87 
88             /**
89              * @return The size of the markers
90              */
91             QSizeF markerSize() const;
92 
93             /**
94              * @return The orientations used to show the value tracking. Using only a
95              * vertical line, horizontal line or both (the default).
96              */
97             Qt::Orientations orientations() const;
98 
99             /** Set the orientations used to show the value tracking.
100              * \param orientations The orientations of the value tracking lines.
101              */
102             void setOrientations( Qt::Orientations orientations );
103 
104             /** Set whether value tracking should be enabled for a specific
105              * index or not
106              * \param enabled Whether value tracking should be enabled or not
107              */
108             void setEnabled( bool enabled );
109 
110             /**
111              * @return Whether value tracking is enabled or not
112              */
113             bool isEnabled() const;
114 
115             bool operator==( const ValueTrackerAttributes& ) const;
116             inline bool operator!=( const ValueTrackerAttributes& other ) const { return !operator==(other); }
117 
118         private:
119             KCHART_DECLARE_PRIVATE_BASE_VALUE( ValueTrackerAttributes )
120     }; // End of class ValueTrackerAttributes
121 
122 }
123 
124 #if !defined(QT_NO_DEBUG_STREAM)
125 KCHART_EXPORT QDebug operator<<(QDebug, const KChart::ValueTrackerAttributes& );
126 #endif /* QT_NO_DEBUG_STREAM */
127 
128 KCHART_DECLARE_SWAP_SPECIALISATION( KChart::ValueTrackerAttributes )
129 
130 QT_BEGIN_NAMESPACE
131 Q_DECLARE_TYPEINFO( KChart::ValueTrackerAttributes, Q_MOVABLE_TYPE );
132 QT_END_NAMESPACE
133 
134 Q_DECLARE_METATYPE( KChart::ValueTrackerAttributes )
135 
136 #endif // KCHARTVALUETRACKERATTRIBUTES_H
137