# KDChartChart.h

Go to the documentation of this file.

    00001 /****************************************************************************
    00002  ** Copyright (C) 2006 Klarälvdalens Datakonsult AB.  All rights reserved.
    00003  **
    00004  ** This file is part of the KD Chart library.
    00005  **
    00006  ** This file may be distributed and/or modified under the terms of the
    00007  ** GNU General Public License version 2 as published by the Free Software
    00008  ** Foundation and appearing in the file LICENSE.GPL included in the
    00009  ** packaging of this file.
    00010  **
    00011  ** Licensees holding valid commercial KD Chart licenses may use this file in
    00012  ** accordance with the KD Chart Commercial License Agreement provided with
    00013  ** the Software.
    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  ** See http://www.kdab.net/kdchart for
    00019  **   information about KDChart Commercial License Agreements.
    00020  **
    00021  ** Contact info@kdab.net if any conditions of this
    00022  ** licensing are not clear to you.
    00023  **
    00024  **********************************************************************/
    00025
    00026 #ifndef KDCHARTCHART_H
    00027 #define KDCHARTCHART_H
    00028
    00029 #include <QWidget>
    00030
    00031 #include "kdchart_export.h"
    00032 #include "KDChartGlobal.h"
    00033
    00041 namespace KDChart {
    00042
    00043     class BackgroundAttributes;
    00044     class FrameAttributes;
    00045     class AbstractDiagram;
    00046     class AbstractCoordinatePlane;
    00047     class HeaderFooter;
    00048     class Legend;
    00049
    00050     typedef QList<AbstractCoordinatePlane*> CoordinatePlaneList;
    00051     typedef QList<HeaderFooter*> HeaderFooterList;
    00052     typedef QList<Legend*> LegendList;
    00053
    00054
    00072     class KDCHART_EXPORT Chart : public QWidget
    00073     {
    00074         Q_OBJECT
    00075         Q_PROPERTY( int globalLeadingTop READ globalLeadingTop WRITE setGlobalLeadingTop )
    00076         Q_PROPERTY( int globalLeadingBottom READ globalLeadingBottom WRITE setGlobalLeadingBottom )
    00077         Q_PROPERTY( int globalLeadingLeft READ globalLeadingLeft WRITE setGlobalLeadingLeft )
    00078         Q_PROPERTY( int globalLeadingRight READ globalLeadingRight WRITE setGlobalLeadingRight )
    00079
    00080         KDCHART_DECLARE_PRIVATE_BASE_POLYMORPHIC_QWIDGET( Chart )
    00081
    00082     public:
    00083         explicit Chart ( QWidget* parent = 0 );
    00084         ~Chart();
    00085
    00098         void setFrameAttributes( const FrameAttributes &a );
    00099         FrameAttributes frameAttributes() const;
    00100
    00114         void setBackgroundAttributes( const BackgroundAttributes &a );
    00115         BackgroundAttributes backgroundAttributes() const;
    00116
    00124         AbstractCoordinatePlane* coordinatePlane();
    00125
    00130         CoordinatePlaneList coordinatePlanes();
    00131
    00138         void addCoordinatePlane( AbstractCoordinatePlane* plane );
    00139
    00157         void replaceCoordinatePlane( AbstractCoordinatePlane* plane,
    00158                                      AbstractCoordinatePlane* oldPlane = 0 );
    00159
    00168         void takeCoordinatePlane( AbstractCoordinatePlane* plane );
    00169
    00170
    00171         void setCoordinatePlaneLayout( QLayout * layout );
    00172         QLayout* coordinatePlaneLayout();
    00173
    00179         HeaderFooter* headerFooter();
    00180
    00185         HeaderFooterList headerFooters();
    00186
    00193         void addHeaderFooter( HeaderFooter* headerFooter );
    00194
    00212         void replaceHeaderFooter ( HeaderFooter* headerFooter,
    00213                                    HeaderFooter* oldHeaderFooter = 0 );
    00214
    00223         void takeHeaderFooter( HeaderFooter* headerFooter );
    00224
    00229         Legend* legend();
    00230
    00235         LegendList legends();
    00236
    00243         void addLegend( Legend* legend );
    00244
    00268         void replaceLegend ( Legend* legend, Legend* oldLegend = 0 );
    00269
    00278         void takeLegend( Legend* legend );
    00279
    00299         void setGlobalLeading( int left, int top, int right, int bottom );
    00300
    00308         void setGlobalLeadingLeft( int leading );
    00309
    00318         int globalLeadingLeft() const;
    00319
    00327         void setGlobalLeadingTop( int leading );
    00328
    00337         int globalLeadingTop() const;
    00338
    00346         void setGlobalLeadingRight( int leading );
    00347
    00356         int globalLeadingRight() const;
    00357
    00365         void setGlobalLeadingBottom( int leading );
    00366
    00375         int globalLeadingBottom() const;
    00376
    00390         void paint( QPainter* painter, const QRect& target );
    00391
    00392         void reLayoutFloatingLegends();
    00393
    00394     Q_SIGNALS:
    00396         void propertiesChanged();
    00397
    00398     protected:
    00402         /* reimp */ void resizeEvent ( QResizeEvent * event );
    00403
    00411         /* reimp */ void paintEvent( QPaintEvent* event );
    00412
    00414         void mousePressEvent( QMouseEvent* event );
    00415     };
    00416
    00417 // Here we have a few docu block to be included into the API documentation:
    00443 }
    00487 #endif