KDChartAbstractAreaBase.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 ** Copyright (C) 2001-2010 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 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 KDCHARTABSTRACTAREABASE_H
00024 #define KDCHARTABSTRACTAREABASE_H
00025 
00026 #include <QPointF>
00027 #include <QSizeF>
00028 #include <QRectF>
00029 
00030 #include "KDChartGlobal.h"
00031 #include "KDChartLayoutItems.h"
00032 #include "KDChartRelativePosition.h"
00033 #include "KDChartAbstractAreaBase.h"
00034 
00035 
00036 class QPainter;
00037 class QString;
00038 namespace KDChart {
00039     class TextAttributes;
00040     class BackgroundAttributes;
00041     class FrameAttributes;
00042     class PaintContext;
00043 
00044 
00062 class KDCHART_EXPORT AbstractAreaBase
00063 {
00064     Q_DISABLE_COPY( AbstractAreaBase )
00065     KDCHART_DECLARE_PRIVATE_BASE_POLYMORPHIC( AbstractAreaBase )
00066 
00067 protected:
00068     AbstractAreaBase();
00069     virtual ~AbstractAreaBase() ;
00070 
00071 public:
00072 //    virtual AbstractAreaBase * clone() const = 0;
00073 
00077     bool compare( const AbstractAreaBase* other )const;
00078 
00079     void alignToReferencePoint( const RelativePosition& position );
00080 
00081     void setFrameAttributes( const FrameAttributes &a );
00082     FrameAttributes frameAttributes() const;
00083 
00084     void setBackgroundAttributes( const BackgroundAttributes &a );
00085     BackgroundAttributes backgroundAttributes() const;
00086 
00087     virtual void paintBackground( QPainter& painter, const QRect& rectangle );
00088     virtual void paintFrame( QPainter& painter, const QRect& rectangle );
00089 
00090     static void paintBackgroundAttributes( QPainter& painter, const QRect& rectangle,
00091         const KDChart::BackgroundAttributes& attributes );
00092     static void paintFrameAttributes( QPainter& painter, const QRect& rectangle,
00093         const KDChart::FrameAttributes& attributes );
00094 
00100     void getFrameLeadings(int& left, int& top, int& right, int& bottom ) const;
00101 
00102 
00103 protected:
00109     QRect innerRect() const;
00110 
00116     virtual QRect areaGeometry() const = 0;
00117 
00124     virtual void positionHasChanged();
00125 
00126 }; // End of class AbstractAreaBase
00127 
00128 }
00129 #endif // KDCHARTABSTRACTAREABASE_H