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 #ifndef KDCHARTRELATIVEPOSITION_H 00024 #define KDCHARTRELATIVEPOSITION_H 00025 00026 #include <QDebug> 00027 #include <QMetaType> 00028 #include <Qt> 00029 #include <QPointF> 00030 #include <QSizeF> 00031 #include "KDChartGlobal.h" 00032 00033 namespace KDChart { 00034 00035 class Position; 00036 class PositionPoints; 00037 class Measure; 00038 00055 class KDCHART_EXPORT RelativePosition 00056 { 00057 public: 00058 RelativePosition(); 00059 RelativePosition( const RelativePosition& ); 00060 00061 RelativePosition & operator=( const RelativePosition & other ); 00062 00063 ~RelativePosition(); 00064 00080 void setReferenceArea( QObject* area ); 00081 QObject* referenceArea() const; 00082 00096 void setReferencePoints( const PositionPoints& points ); 00097 const PositionPoints referencePoints() const; 00098 00107 void setReferencePosition( Position position ); 00108 00119 void resetReferencePosition(); 00120 Position referencePosition() const; 00121 00134 void setAlignment( Qt::Alignment flags ); 00135 Qt::Alignment alignment() const; 00136 00149 void setHorizontalPadding( const Measure& padding ); 00150 Measure horizontalPadding() const; 00151 00164 void setVerticalPadding( const Measure& padding ); 00165 Measure verticalPadding() const; 00166 00167 void setRotation( qreal rot ); 00168 qreal rotation() const; 00169 00183 const QPointF referencePoint(qreal* polarDegrees=0) const; 00184 00194 const QPointF calculatedPoint( const QSizeF& autoSize ) const; 00195 00196 bool operator==( const RelativePosition& ) const; 00197 bool operator!=( const RelativePosition & other ) const; 00198 00199 private: 00200 KDCHART_DECLARE_PRIVATE_BASE_VALUE( RelativePosition ) 00201 }; 00202 00203 inline bool RelativePosition::operator!=( const RelativePosition & other ) const { return !operator==( other ); } 00204 } 00205 00206 KDCHART_DECLARE_SWAP_SPECIALISATION( KDChart::RelativePosition ) 00207 00208 Q_DECLARE_TYPEINFO( KDChart::RelativePosition, Q_MOVABLE_TYPE ); 00209 Q_DECLARE_METATYPE( KDChart::RelativePosition ) 00210 00211 #if !defined(QT_NO_DEBUG_STREAM) 00212 KDCHART_EXPORT QDebug operator<<(QDebug, const KDChart::RelativePosition& ); 00213 #endif /* QT_NO_DEBUG_STREAM */ 00214 00215 00216 #endif // KDCHARTRELATIVEPOSITION_H