00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
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
00075 void paintTo( QPainter& painter,
00076 const QRect* rect = 0 );
00077
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