KDChartFrameAttributes.cpp

Go to the documentation of this file.
00001 /****************************************************************************
00002 ** Copyright (C) 2001-2011 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     int padding;
00040 };
00041 
00042 FrameAttributes::Private::Private() :
00043     visible( false ),
00044     padding( 0 )
00045 {
00046 }
00047 
00048 
00049 FrameAttributes::FrameAttributes()
00050     : _d( new Private() )
00051 {
00052 }
00053 
00054 FrameAttributes::FrameAttributes( const FrameAttributes& r )
00055     : _d( new Private( *r.d ) )
00056 {
00057 }
00058 
00059 FrameAttributes & FrameAttributes::operator=( const FrameAttributes& r )
00060 {
00061     if( this == &r )
00062         return *this;
00063 
00064     *d = *r.d;
00065 
00066     return *this;
00067 }
00068 
00069 FrameAttributes::~FrameAttributes()
00070 {
00071     delete _d; _d = 0;
00072 }
00073 
00074 
00075 bool FrameAttributes::operator==( const FrameAttributes& r ) const
00076 {
00077     /*
00078     qDebug() << "FrameAttributes:" << (isVisible() == r.isVisible())
00079         << (pen() == r.pen())
00080         << (padding() == r.padding()) << "\n";
00081     */
00082     return ( isVisible() == r.isVisible() &&
00083             pen() == r.pen() &&
00084             padding() == r.padding() );
00085 }
00086 
00087 
00088 
00089 
00090 void FrameAttributes::setVisible( bool visible )
00091 {
00092     d->visible = visible;
00093 }
00094 
00095 bool FrameAttributes::isVisible() const
00096 {
00097     return d->visible;
00098 }
00099 
00100 void FrameAttributes::setPen( const QPen & pen )
00101 {
00102     d->pen = pen;
00103 }
00104 
00105 QPen FrameAttributes::pen() const
00106 {
00107     return d->pen;
00108 }
00109 
00110 void FrameAttributes::setPadding( int padding )
00111 {
00112     d->padding = padding;
00113 }
00114 
00115 int FrameAttributes::padding() const
00116 {
00117     return d->padding;
00118 }
00119 
00120 #if !defined(QT_NO_DEBUG_STREAM)
00121 QDebug operator<<(QDebug dbg, const KDChart::FrameAttributes& fa)
00122 {
00123     dbg << "KDChart::FrameAttributes("
00124         << "visible="<<fa.isVisible()
00125         << "pen="<<fa.pen()
00126         << "padding="<<fa.padding()
00127         << ")";
00128     return dbg;
00129 }
00130 #endif /* QT_NO_DEBUG_STREAM */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Defines

Klarälvdalens Datakonsult AB (KDAB)
Qt-related services and products
http://www.kdab.com/
http://www.kdab.com/products/kd-chart/