00001 /* -*- Mode: C++ -*- 00002 KDChart - a multi-platform charting engine 00003 */ 00004 00005 /**************************************************************************** 00006 ** Copyright (C) 2005-2007 Klarälvdalens Datakonsult AB. All rights reserved. 00007 ** 00008 ** This file is part of the KD Chart library. 00009 ** 00010 ** This file may be distributed and/or modified under the terms of the 00011 ** GNU General Public License version 2 as published by the Free Software 00012 ** Foundation and appearing in the file LICENSE.GPL included in the 00013 ** packaging of this file. 00014 ** 00015 ** Licensees holding valid commercial KD Chart licenses may use this file in 00016 ** accordance with the KD Chart Commercial License Agreement provided with 00017 ** the Software. 00018 ** 00019 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00020 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00021 ** 00022 ** See http://www.kdab.net/kdchart for 00023 ** information about KD Chart Commercial License Agreements. 00024 ** 00025 ** Contact info@kdab.net if any conditions of this 00026 ** licensing are not clear to you. 00027 ** 00028 **********************************************************************/ 00029 00030 #ifndef KDCHARTRELATIVEPOSITION_H 00031 #define KDCHARTRELATIVEPOSITION_H 00032 00033 #include <QDebug> 00034 #include <QMetaType> 00035 #include <Qt> 00036 #include <QPointF> 00037 #include <QSizeF> 00038 #include "KDChartGlobal.h" 00039 00040 namespace KDChart { 00041 00042 class Position; 00043 class PositionPoints; 00044 class Measure; 00045 00062 class KDCHART_EXPORT RelativePosition 00063 { 00064 public: 00065 RelativePosition(); 00066 RelativePosition( const RelativePosition& ); 00067 00068 RelativePosition & operator=( const RelativePosition & other ); 00069 00070 ~RelativePosition(); 00071 00087 void setReferenceArea( QObject* area ); 00088 QObject* referenceArea() const; 00089 00103 void setReferencePoints( const PositionPoints& points ); 00104 const PositionPoints referencePoints() const; 00105 00114 void setReferencePosition( Position position ); 00115 00126 void resetReferencePosition(); 00127 Position referencePosition() const; 00128 00141 void setAlignment( Qt::Alignment flags ); 00142 Qt::Alignment alignment() const; 00143 00156 void setHorizontalPadding( const Measure& padding ); 00157 Measure horizontalPadding() const; 00158 00171 void setVerticalPadding( const Measure& padding ); 00172 Measure verticalPadding() const; 00173 00174 void setRotation( qreal rot ); 00175 qreal rotation() const; 00176 00190 const QPointF referencePoint(qreal* polarDegrees=0) const; 00191 00201 const QPointF calculatedPoint( const QSizeF& autoSize ) const; 00202 00203 bool operator==( const RelativePosition& ) const; 00204 bool operator!=( const RelativePosition & other ) const; 00205 00206 private: 00207 KDCHART_DECLARE_PRIVATE_BASE_VALUE( RelativePosition ) 00208 }; 00209 00210 inline bool RelativePosition::operator!=( const RelativePosition & other ) const { return !operator==( other ); } 00211 } 00212 00213 KDCHART_DECLARE_SWAP_SPECIALISATION( KDChart::RelativePosition ) 00214 00215 Q_DECLARE_TYPEINFO( KDChart::RelativePosition, Q_MOVABLE_TYPE ); 00216 Q_DECLARE_METATYPE( KDChart::RelativePosition ) 00217 00218 #if !defined(QT_NO_DEBUG_STREAM) 00219 KDCHART_EXPORT QDebug operator<<(QDebug, const KDChart::RelativePosition& ); 00220 #endif /* QT_NO_DEBUG_STREAM */ 00221 00222 00223 #endif // KDCHARTRELATIVEPOSITION_H