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 #include "KChartFrameAttributes.h" 21 22 #include "KChartMath_p.h" 23 24 #define d d_func() 25 26 using namespace KChart; 27 28 class Q_DECL_HIDDEN FrameAttributes::Private 29 { 30 friend class FrameAttributes; 31 public: 32 Private(); 33 private: 34 bool visible; 35 QPen pen; 36 qreal cornerRadius; 37 int padding; 38 }; 39 Private()40FrameAttributes::Private::Private() : 41 visible( false ), 42 cornerRadius( 0 ), 43 padding( 0 ) 44 { 45 } 46 47 FrameAttributes()48FrameAttributes::FrameAttributes() 49 : _d( new Private() ) 50 { 51 } 52 FrameAttributes(const FrameAttributes & r)53FrameAttributes::FrameAttributes( const FrameAttributes& r ) 54 : _d( new Private( *r.d ) ) 55 { 56 } 57 operator =(const FrameAttributes & r)58FrameAttributes & FrameAttributes::operator=( const FrameAttributes& r ) 59 { 60 if ( this == &r ) 61 return *this; 62 63 *d = *r.d; 64 65 return *this; 66 } 67 ~FrameAttributes()68FrameAttributes::~FrameAttributes() 69 { 70 delete _d; _d = nullptr; 71 } 72 73 operator ==(const FrameAttributes & r) const74bool FrameAttributes::operator==( const FrameAttributes& r ) const 75 { 76 return ( isVisible() == r.isVisible() && 77 pen() == r.pen() && 78 cornerRadius() == r.cornerRadius() && 79 padding() == r.padding() ); 80 } 81 82 83 84 setVisible(bool visible)85void FrameAttributes::setVisible( bool visible ) 86 { 87 d->visible = visible; 88 } 89 isVisible() const90bool FrameAttributes::isVisible() const 91 { 92 return d->visible; 93 } 94 setPen(const QPen & pen)95void FrameAttributes::setPen( const QPen & pen ) 96 { 97 d->pen = pen; 98 } 99 pen() const100QPen FrameAttributes::pen() const 101 { 102 return d->pen; 103 } 104 setCornerRadius(qreal radius)105void FrameAttributes::setCornerRadius(qreal radius) 106 { 107 d->cornerRadius = radius; 108 } 109 cornerRadius() const110qreal FrameAttributes::cornerRadius() const 111 { 112 return d->cornerRadius; 113 } 114 setPadding(int padding)115void FrameAttributes::setPadding( int padding ) 116 { 117 d->padding = padding; 118 } 119 padding() const120int FrameAttributes::padding() const 121 { 122 return d->padding; 123 } 124 125 #if !defined(QT_NO_DEBUG_STREAM) operator <<(QDebug dbg,const KChart::FrameAttributes & fa)126QDebug operator<<(QDebug dbg, const KChart::FrameAttributes& fa) 127 { 128 dbg << "KChart::FrameAttributes(" 129 << "visible="<<fa.isVisible() 130 << "pen="<<fa.pen() 131 << "cornerRadius="<<fa.cornerRadius() 132 << "padding="<<fa.padding() 133 << ")"; 134 return dbg; 135 } 136 #endif /* QT_NO_DEBUG_STREAM */ 137