KD Chart 2
[rev.2.5]
|
00001 /**************************************************************************** 00002 ** Copyright (C) 2001-2012 Klaralvdalens Datakonsult AB. All rights reserved. 00003 ** 00004 ** This file is part of the KD Chart library. 00005 ** 00006 ** Licensees holding valid commercial KD Chart licenses may use this file in 00007 ** accordance with the KD Chart Commercial License Agreement provided with 00008 ** the Software. 00009 ** 00010 ** 00011 ** This file may be distributed and/or modified under the terms of the 00012 ** GNU General Public License version 2 and version 3 as published by the 00013 ** Free Software Foundation and appearing in the file LICENSE.GPL.txt included. 00014 ** 00015 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00016 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00017 ** 00018 ** Contact info@kdab.com if any conditions of this licensing are not 00019 ** clear to you. 00020 ** 00021 **********************************************************************/ 00022 00023 #include "KDChartFrameAttributes.h" 00024 00025 #include <KDABLibFakes> 00026 00027 #define d d_func() 00028 00029 using namespace KDChart; 00030 00031 class FrameAttributes::Private 00032 { 00033 friend class FrameAttributes; 00034 public: 00035 Private(); 00036 private: 00037 bool visible; 00038 QPen pen; 00039 qreal cornerRadius; 00040 int padding; 00041 }; 00042 00043 FrameAttributes::Private::Private() : 00044 visible( false ), 00045 cornerRadius( 0 ), 00046 padding( 0 ) 00047 { 00048 } 00049 00050 00051 FrameAttributes::FrameAttributes() 00052 : _d( new Private() ) 00053 { 00054 } 00055 00056 FrameAttributes::FrameAttributes( const FrameAttributes& r ) 00057 : _d( new Private( *r.d ) ) 00058 { 00059 } 00060 00061 FrameAttributes & FrameAttributes::operator=( const FrameAttributes& r ) 00062 { 00063 if( this == &r ) 00064 return *this; 00065 00066 *d = *r.d; 00067 00068 return *this; 00069 } 00070 00071 FrameAttributes::~FrameAttributes() 00072 { 00073 delete _d; _d = 0; 00074 } 00075 00076 00077 bool FrameAttributes::operator==( const FrameAttributes& r ) const 00078 { 00079 return ( isVisible() == r.isVisible() && 00080 pen() == r.pen() && 00081 cornerRadius() == r.cornerRadius() && 00082 padding() == r.padding() ); 00083 } 00084 00085 00086 00087 00088 void FrameAttributes::setVisible( bool visible ) 00089 { 00090 d->visible = visible; 00091 } 00092 00093 bool FrameAttributes::isVisible() const 00094 { 00095 return d->visible; 00096 } 00097 00098 void FrameAttributes::setPen( const QPen & pen ) 00099 { 00100 d->pen = pen; 00101 } 00102 00103 QPen FrameAttributes::pen() const 00104 { 00105 return d->pen; 00106 } 00107 00108 void FrameAttributes::setCornerRadius(qreal radius) 00109 { 00110 d->cornerRadius = radius; 00111 } 00112 00113 qreal FrameAttributes::cornerRadius() const 00114 { 00115 return d->cornerRadius; 00116 } 00117 00118 void FrameAttributes::setPadding( int padding ) 00119 { 00120 d->padding = padding; 00121 } 00122 00123 int FrameAttributes::padding() const 00124 { 00125 return d->padding; 00126 } 00127 00128 #if !defined(QT_NO_DEBUG_STREAM) 00129 QDebug operator<<(QDebug dbg, const KDChart::FrameAttributes& fa) 00130 { 00131 dbg << "KDChart::FrameAttributes(" 00132 << "visible="<<fa.isVisible() 00133 << "pen="<<fa.pen() 00134 << "cornerRadius="<<fa.cornerRadius() 00135 << "padding="<<fa.padding() 00136 << ")"; 00137 return dbg; 00138 } 00139 #endif /* QT_NO_DEBUG_STREAM */