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 KCHARTBACKGROUNDATTRIBUTES_H
21 #define KCHARTBACKGROUNDATTRIBUTES_H
22 
23 #include <QDebug>
24 #include <QMetaType>
25 #include <QBrush>
26 #include "KChartGlobal.h"
27 
28 namespace KChart {
29 
30 /**
31   * Set of attributes usable for background pixmaps
32   */
33 class KCHART_EXPORT BackgroundAttributes
34 {
35 public:
36     BackgroundAttributes();
37     BackgroundAttributes( const BackgroundAttributes& );
38     BackgroundAttributes &operator= ( const BackgroundAttributes& );
39 
40     ~BackgroundAttributes();
41 
42     enum BackgroundPixmapMode { BackgroundPixmapModeNone,
43                                 BackgroundPixmapModeCentered,
44                                 BackgroundPixmapModeScaled,
45                                 BackgroundPixmapModeStretched };
46 
47     void setVisible( bool visible );
48     bool isVisible() const;
49 
50     void setBrush( const QBrush &brush );
51     QBrush brush() const;
52 
53     void setPixmapMode( BackgroundPixmapMode mode );
54     BackgroundPixmapMode pixmapMode() const;
55 
56     void setPixmap( const QPixmap &backPixmap );
57     QPixmap pixmap() const;
58 
59     bool operator==( const BackgroundAttributes& ) const;
60     inline bool operator!=( const BackgroundAttributes& other ) const { return !operator==(other); }
61 
62     bool isEqualTo( const BackgroundAttributes& other, bool ignorePixmap=false ) const;
63 
64 private:
65     KCHART_DECLARE_PRIVATE_BASE_VALUE( BackgroundAttributes )
66 }; // End of class BackgroundAttributes
67 
68 }
69 
70 #if !defined(QT_NO_DEBUG_STREAM)
71 KCHART_EXPORT QDebug operator<<(QDebug, const KChart::BackgroundAttributes& );
72 #endif /* QT_NO_DEBUG_STREAM */
73 
74 KCHART_DECLARE_SWAP_SPECIALISATION( KChart::BackgroundAttributes )
75 
76 QT_BEGIN_NAMESPACE
77 Q_DECLARE_TYPEINFO( KChart::BackgroundAttributes, Q_MOVABLE_TYPE );
78 QT_END_NAMESPACE
79 
80 Q_DECLARE_METATYPE( KChart::BackgroundAttributes )
81 
82 #endif // KCHARTBACKGROUNDATTRIBUTES_H
83