KDChartChart.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 KDCHARTCHART_H
00024 #define KDCHARTCHART_H
00025 
00026 #include <QWidget>
00027 
00028 #include "kdchart_export.h"
00029 #include "KDChartGlobal.h"
00030 
00038 namespace KDChart {
00039 
00040     class BackgroundAttributes;
00041     class FrameAttributes;
00042     class AbstractDiagram;
00043     class AbstractCoordinatePlane;
00044     class HeaderFooter;
00045     class Legend;
00046 
00047     typedef QList<AbstractCoordinatePlane*> CoordinatePlaneList;
00048     typedef QList<HeaderFooter*> HeaderFooterList;
00049     typedef QList<Legend*> LegendList;
00050 
00051 
00069     class KDCHART_EXPORT Chart : public QWidget
00070     {
00071         Q_OBJECT
00072         Q_PROPERTY( int globalLeadingTop READ globalLeadingTop WRITE setGlobalLeadingTop )
00073         Q_PROPERTY( int globalLeadingBottom READ globalLeadingBottom WRITE setGlobalLeadingBottom )
00074         Q_PROPERTY( int globalLeadingLeft READ globalLeadingLeft WRITE setGlobalLeadingLeft )
00075         Q_PROPERTY( int globalLeadingRight READ globalLeadingRight WRITE setGlobalLeadingRight )
00076 
00077         KDCHART_DECLARE_PRIVATE_BASE_POLYMORPHIC_QWIDGET( Chart )
00078 
00079     public:
00080         explicit Chart ( QWidget* parent = 0 );
00081         ~Chart();
00082 
00095         void setFrameAttributes( const FrameAttributes &a );
00096         FrameAttributes frameAttributes() const;
00097 
00111         void setBackgroundAttributes( const BackgroundAttributes &a );
00112         BackgroundAttributes backgroundAttributes() const;
00113 
00121         AbstractCoordinatePlane* coordinatePlane();
00122 
00127         CoordinatePlaneList coordinatePlanes();
00128 
00135         void addCoordinatePlane( AbstractCoordinatePlane* plane );
00136 
00154         void replaceCoordinatePlane( AbstractCoordinatePlane* plane,
00155                                      AbstractCoordinatePlane* oldPlane = 0 );
00156 
00165         void takeCoordinatePlane( AbstractCoordinatePlane* plane );
00166 
00172         void setCoordinatePlaneLayout( QLayout * layout );
00173         QLayout* coordinatePlaneLayout();
00174 
00180         HeaderFooter* headerFooter();
00181 
00186         HeaderFooterList headerFooters();
00187 
00194         void addHeaderFooter( HeaderFooter* headerFooter );
00195 
00213         void replaceHeaderFooter ( HeaderFooter* headerFooter,
00214                                    HeaderFooter* oldHeaderFooter = 0 );
00215 
00224         void takeHeaderFooter( HeaderFooter* headerFooter );
00225 
00230         Legend* legend();
00231 
00236         LegendList legends();
00237 
00244         void addLegend( Legend* legend );
00245 
00269         void replaceLegend ( Legend* legend, Legend* oldLegend = 0 );
00270 
00279         void takeLegend( Legend* legend );
00280 
00300         void setGlobalLeading( int left, int top, int right, int bottom );
00301 
00309         void setGlobalLeadingLeft( int leading );
00310 
00319         int globalLeadingLeft() const;
00320 
00328         void setGlobalLeadingTop( int leading );
00329 
00338         int globalLeadingTop() const;
00339 
00347         void setGlobalLeadingRight( int leading );
00348 
00357         int globalLeadingRight() const;
00358 
00366         void setGlobalLeadingBottom( int leading );
00367 
00376         int globalLeadingBottom() const;
00377 
00391         void paint( QPainter* painter, const QRect& target );
00392 
00393         void reLayoutFloatingLegends();
00394 
00395     Q_SIGNALS:
00397         void propertiesChanged();
00398 
00399     protected:
00403         /* reimp */ void resizeEvent ( QResizeEvent * event );
00404 
00412         /* reimp */ void paintEvent( QPaintEvent* event );
00413 
00415         void mousePressEvent( QMouseEvent* event );
00417         void mouseDoubleClickEvent( QMouseEvent* event );
00419         void mouseMoveEvent( QMouseEvent* event );
00421         void mouseReleaseEvent( QMouseEvent* event );
00423         bool event( QEvent* event );
00424     };
00425 
00426 // Here we have a few docu block to be included into the API documentation:
00452 }
00518 #endif