KDChartWidget.h

Go to the documentation of this file.
00001 /* -*- Mode: C++ -*-
00002    KDChart - a multi-platform charting engine
00003    */
00004 
00005 /****************************************************************************
00006  ** Copyright (C) 2001-2003 Klarälvdalens Datakonsult AB.  All rights reserved.
00007  **
00008  ** This file is part of the KDChart 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 KDChart licenses may use this file in
00016  ** accordance with the KDChart 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.klaralvdalens-datakonsult.se/?page=products for
00023  **   information about KDChart Commercial License Agreements.
00024  **
00025  ** Contact info@klaralvdalens-datakonsult.se if any conditions of this
00026  ** licensing are not clear to you.
00027  **
00028  **********************************************************************/
00029 #ifndef __KDCHARTWIDGET_H__
00030 #define __KDCHARTWIDGET_H__
00031 
00032 #include <KDChartGlobal.h>
00033 #include <KDChartTable.h>
00034 #include <KDChartDataRegion.h>
00035 #include <qwidget.h>
00036 #include <qscrollview.h>
00037 #include <qpixmap.h>
00038 
00046 class KDChartParams;
00047 
00048 class KDCHART_EXPORT KDChartWidget : public QWidget
00049 {
00050     Q_OBJECT
00051     Q_PROPERTY( bool activeData READ isActiveData WRITE setActiveData )
00052     Q_PROPERTY( bool doubleBuffered READ isDoubleBuffered WRITE setDoubleBuffered )
00053 
00054 public:
00055     KDChartWidget( QWidget* parent = 0, const char* name = 0 );
00056     KDChartWidget( KDChartParams* params,
00057                    KDChartTableDataBase* data,
00058                    QWidget* parent = 0, const char* name = 0 );
00059     ~KDChartWidget();
00060 
00061 public slots:
00062     bool isActiveData() const;
00063     bool isDoubleBuffered() const;
00064 
00065     KDChartParams* params() const;
00066     KDChartTableDataBase* data() const;
00067 
00068     const KDChartDataRegionList* dataRegions() const { return &_dataRegions; }
00069 
00070     void setActiveData( bool active );
00071     void setDoubleBuffered( bool doublebuffered );
00072     void setParams( KDChartParams* params );
00073     void setData( KDChartTableDataBase* data );
00074     // use this method to paint to low resolution devices
00075     void paintTo( QPainter& painter,
00076                   const QRect* rect = 0 );
00077     // use this method to paint to high res devices like printers...
00078     void print( QPainter& painter,
00079                 const QRect* rect = 0  );
00080 
00081 
00082 
00083 signals:
00084     void dataLeftClicked( uint row, uint col );
00085     void dataLeftClicked( const QPoint & pnt );
00086     void dataMiddleClicked( uint row, uint col );
00087     void dataMiddleClicked( const QPoint & pnt );
00088     void dataRightClicked( uint row, uint col );
00089     void dataRightClicked( const QPoint & pnt );
00090     void dataLeftPressed( uint row, uint col );
00091     void dataLeftPressed( const QPoint & pnt );
00092     void dataMiddlePressed( uint row, uint col );
00093     void dataMiddlePressed( const QPoint & pnt );
00094     void dataRightPressed( uint row, uint col );
00095     void dataRightPressed( const QPoint & pnt );
00096     void dataLeftReleased( uint row, uint col );
00097     void dataLeftReleased( const QPoint & pnt );
00098     void dataMiddleReleased( uint row, uint col );
00099     void dataMiddleReleased( const QPoint & pnt );
00100     void dataRightReleased( uint row, uint col );
00101     void dataRightReleased( const QPoint & pnt );
00102     void barsDisplayed( int barsDisplayed, int barsLeft );
00103 
00104 protected:
00105     virtual void paintEvent( QPaintEvent* event );
00106     virtual void mousePressEvent( QMouseEvent* event );
00107     virtual void mouseReleaseEvent( QMouseEvent* event );
00108     virtual void resizeEvent( QResizeEvent* event );
00109 
00110 private:
00111     KDChartParams* _params;
00112     KDChartTableDataBase* _data;
00113     bool _activeData;
00114     bool _doubleBuffered;
00115     QPixmap _buffer;
00116     KDChartDataRegion* _mousePressedOnRegion;
00117     KDChartDataRegionList _dataRegions;
00118 };
00119 
00120 #endif

Generated on Wed Jan 26 13:03:16 2011 for KMyMoney by  doxygen 1.5.6