# KDChartFrameAttributes.cpp

Go to the documentation of this file.

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