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 "KDChartStockBarAttributes.h" 00024 00025 #define d d_func() 00026 00027 using namespace KDChart; 00028 00029 class StockBarAttributes::Private { 00030 public: 00031 Private(); 00032 00033 qreal candlestickWidth; 00034 qreal tickLength; 00035 }; 00036 00037 StockBarAttributes::Private::Private() 00038 : candlestickWidth( 0.3 ) 00039 , tickLength( 0.15 ) 00040 { 00041 } 00042 00043 StockBarAttributes::StockBarAttributes() 00044 : _d( new Private ) 00045 { 00046 } 00047 00048 StockBarAttributes::StockBarAttributes( const StockBarAttributes& r ) 00049 : _d( new Private( *r.d ) ) 00050 { 00051 } 00052 00053 StockBarAttributes &StockBarAttributes::operator= ( const StockBarAttributes& r ) 00054 { 00055 if ( this == &r ) 00056 return *this; 00057 00058 *d = *r.d; 00059 00060 return *this; 00061 } 00062 00063 StockBarAttributes::~StockBarAttributes() 00064 { 00065 delete _d; 00066 } 00067 00073 void StockBarAttributes::setCandlestickWidth( qreal width ) 00074 { 00075 d->candlestickWidth = width; 00076 } 00080 qreal StockBarAttributes::candlestickWidth() const 00081 { 00082 return d->candlestickWidth; 00083 } 00084 00090 void StockBarAttributes::setTickLength( qreal length ) 00091 { 00092 d->tickLength = length; 00093 } 00094 00098 qreal StockBarAttributes::tickLength() const 00099 { 00100 return d->tickLength; 00101 } 00102 00103 bool StockBarAttributes::operator==( const StockBarAttributes& r ) const 00104 { 00105 return candlestickWidth() == r.candlestickWidth() && 00106 tickLength() == r.tickLength(); 00107 }