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

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 KCHARTBACKGROUNDATTRIBUTES_H
0021 #define KCHARTBACKGROUNDATTRIBUTES_H
0022 
0023 #include <QDebug>
0024 #include <QMetaType>
0025 #include <QBrush>
0026 #include "KChartGlobal.h"
0027 
0028 namespace KChart {
0029 
0030 /**
0031   * Set of attributes usable for background pixmaps
0032   */
0033 class KCHART_EXPORT BackgroundAttributes
0034 {
0035 public:
0036     BackgroundAttributes();
0037     BackgroundAttributes( const BackgroundAttributes& );
0038     BackgroundAttributes &operator= ( const BackgroundAttributes& );
0039 
0040     ~BackgroundAttributes();
0041 
0042     enum BackgroundPixmapMode { BackgroundPixmapModeNone,
0043                                 BackgroundPixmapModeCentered,
0044                                 BackgroundPixmapModeScaled,
0045                                 BackgroundPixmapModeStretched };
0046 
0047     void setVisible( bool visible );
0048     bool isVisible() const;
0049 
0050     void setBrush( const QBrush &brush );
0051     QBrush brush() const;
0052 
0053     void setPixmapMode( BackgroundPixmapMode mode );
0054     BackgroundPixmapMode pixmapMode() const;
0055 
0056     void setPixmap( const QPixmap &backPixmap );
0057     QPixmap pixmap() const;
0058 
0059     bool operator==( const BackgroundAttributes& ) const;
0060     inline bool operator!=( const BackgroundAttributes& other ) const { return !operator==(other); }
0061 
0062     bool isEqualTo( const BackgroundAttributes& other, bool ignorePixmap=false ) const;
0063 
0064 private:
0065     KCHART_DECLARE_PRIVATE_BASE_VALUE( BackgroundAttributes )
0066 }; // End of class BackgroundAttributes
0067 
0068 }
0069 
0070 #if !defined(QT_NO_DEBUG_STREAM)
0071 KCHART_EXPORT QDebug operator<<(QDebug, const KChart::BackgroundAttributes& );
0072 #endif /* QT_NO_DEBUG_STREAM */
0073 
0074 KCHART_DECLARE_SWAP_SPECIALISATION( KChart::BackgroundAttributes )
0075 
0076 QT_BEGIN_NAMESPACE
0077 Q_DECLARE_TYPEINFO( KChart::BackgroundAttributes, Q_MOVABLE_TYPE );
0078 QT_END_NAMESPACE
0079 
0080 Q_DECLARE_METATYPE( KChart::BackgroundAttributes )
0081 
0082 #endif // KCHARTBACKGROUNDATTRIBUTES_H