KD Chart 2
[rev.2.5]
|
00001 /**************************************************************************** 00002 ** Copyright (C) 2001-2012 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 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 // KD Chart 3.0: leading is inter-line distance of text. this here is MARGIN or SPACING. 00073 Q_PROPERTY( int globalLeadingTop READ globalLeadingTop WRITE setGlobalLeadingTop ) 00074 Q_PROPERTY( int globalLeadingBottom READ globalLeadingBottom WRITE setGlobalLeadingBottom ) 00075 Q_PROPERTY( int globalLeadingLeft READ globalLeadingLeft WRITE setGlobalLeadingLeft ) 00076 Q_PROPERTY( int globalLeadingRight READ globalLeadingRight WRITE setGlobalLeadingRight ) 00077 Q_PROPERTY( bool useNewLayoutSystem READ useNewLayoutSystem WRITE setUseNewLayoutSystem ) 00078 00079 KDCHART_DECLARE_PRIVATE_BASE_POLYMORPHIC_QWIDGET( Chart ) 00080 00081 public: 00082 explicit Chart ( QWidget* parent = 0 ); 00083 ~Chart(); 00084 00093 bool useNewLayoutSystem() const; 00094 void setUseNewLayoutSystem( bool value ); 00095 00108 void setFrameAttributes( const FrameAttributes &a ); 00109 FrameAttributes frameAttributes() const; 00110 00124 void setBackgroundAttributes( const BackgroundAttributes &a ); 00125 BackgroundAttributes backgroundAttributes() const; 00126 00134 AbstractCoordinatePlane* coordinatePlane(); 00135 00140 CoordinatePlaneList coordinatePlanes(); 00141 00148 void addCoordinatePlane( AbstractCoordinatePlane* plane ); 00149 00159 void insertCoordinatePlane( int index, AbstractCoordinatePlane* plane ); 00160 00178 void replaceCoordinatePlane( AbstractCoordinatePlane* plane, 00179 AbstractCoordinatePlane* oldPlane = 0 ); 00180 00189 void takeCoordinatePlane( AbstractCoordinatePlane* plane ); 00190 00196 void setCoordinatePlaneLayout( QLayout * layout ); 00197 QLayout* coordinatePlaneLayout(); 00198 00204 HeaderFooter* headerFooter(); 00205 00210 HeaderFooterList headerFooters(); 00211 00218 void addHeaderFooter( HeaderFooter* headerFooter ); 00219 00237 void replaceHeaderFooter ( HeaderFooter* headerFooter, 00238 HeaderFooter* oldHeaderFooter = 0 ); 00239 00248 void takeHeaderFooter( HeaderFooter* headerFooter ); 00249 00254 Legend* legend(); 00255 00260 LegendList legends(); 00261 00268 void addLegend( Legend* legend ); 00269 00293 void replaceLegend ( Legend* legend, Legend* oldLegend = 0 ); 00294 00303 void takeLegend( Legend* legend ); 00304 00324 void setGlobalLeading( int left, int top, int right, int bottom ); 00325 00333 void setGlobalLeadingLeft( int leading ); 00334 00343 int globalLeadingLeft() const; 00344 00352 void setGlobalLeadingTop( int leading ); 00353 00362 int globalLeadingTop() const; 00363 00371 void setGlobalLeadingRight( int leading ); 00372 00381 int globalLeadingRight() const; 00382 00390 void setGlobalLeadingBottom( int leading ); 00391 00400 int globalLeadingBottom() const; 00401 00415 void paint( QPainter* painter, const QRect& target ); 00416 00417 void reLayoutFloatingLegends(); 00418 00419 Q_SIGNALS: 00421 void propertiesChanged(); 00422 void finishedDrawing(); 00423 00424 protected: 00428 /* reimp */ void resizeEvent ( QResizeEvent * event ); 00429 00437 /* reimp */ void paintEvent( QPaintEvent* event ); 00438 00440 void mousePressEvent( QMouseEvent* event ); 00442 void mouseDoubleClickEvent( QMouseEvent* event ); 00444 void mouseMoveEvent( QMouseEvent* event ); 00446 void mouseReleaseEvent( QMouseEvent* event ); 00448 bool event( QEvent* event ); 00449 }; 00450 00451 // Here we have a few docu block to be included into the API documentation: 00477 } 00543 #endif