home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / KDChartWidget.h < prev    next >
Encoding:
C/C++ Source or Header  |  2007-05-30  |  4.0 KB  |  121 lines

  1. /* -*- Mode: C++ -*-
  2.    KDChart - a multi-platform charting engine
  3.    */
  4.  
  5. /****************************************************************************
  6.  ** Copyright (C) 2001-2003 Klar├ñlvdalens Datakonsult AB.  All rights reserved.
  7.  **
  8.  ** This file is part of the KDChart library.
  9.  **
  10.  ** This file may be distributed and/or modified under the terms of the
  11.  ** GNU General Public License version 2 as published by the Free Software
  12.  ** Foundation and appearing in the file LICENSE.GPL included in the
  13.  ** packaging of this file.
  14.  **
  15.  ** Licensees holding valid commercial KDChart licenses may use this file in
  16.  ** accordance with the KDChart Commercial License Agreement provided with
  17.  ** the Software.
  18.  **
  19.  ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  20.  ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  21.  **
  22.  ** See http://www.klaralvdalens-datakonsult.se/?page=products for
  23.  **   information about KDChart Commercial License Agreements.
  24.  **
  25.  ** Contact info@klaralvdalens-datakonsult.se if any conditions of this
  26.  ** licensing are not clear to you.
  27.  **
  28.  **********************************************************************/
  29. #ifndef __KDCHARTWIDGET_H__
  30. #define __KDCHARTWIDGET_H__
  31.  
  32. #include <KDChartGlobal.h>
  33. #include <KDChartTable.h>
  34. #include <KDChartDataRegion.h>
  35. #include <qwidget.h>
  36. #include <qscrollview.h>
  37. #include <qpixmap.h>
  38.  
  39. /**
  40.   \file KDChartWidget.h
  41.  
  42.   \brief Provids the entry point into the charting that most
  43.   people will want to use.
  44.   */
  45.  
  46. class KDChartParams;
  47.  
  48. class KDCHART_EXPORT KDChartWidget : public QWidget
  49. {
  50.     Q_OBJECT
  51.     Q_PROPERTY( bool activeData READ isActiveData WRITE setActiveData )
  52.     Q_PROPERTY( bool doubleBuffered READ isDoubleBuffered WRITE setDoubleBuffered )
  53.  
  54. public:
  55.     KDChartWidget( QWidget* parent = 0, const char* name = 0 );
  56.     KDChartWidget( KDChartParams* params,
  57.                    KDChartTableDataBase* data,
  58.                    QWidget* parent = 0, const char* name = 0 );
  59.     ~KDChartWidget();
  60.  
  61. public slots:
  62.     bool isActiveData() const;
  63.     bool isDoubleBuffered() const;
  64.  
  65.     KDChartParams* params() const;
  66.     KDChartTableDataBase* data() const;
  67.  
  68.     const KDChartDataRegionList* dataRegions() const { return &_dataRegions; }
  69.  
  70.     void setActiveData( bool active );
  71.     void setDoubleBuffered( bool doublebuffered );
  72.     void setParams( KDChartParams* params );
  73.     void setData( KDChartTableDataBase* data );
  74.     // use this method to paint to low resolution devices
  75.     void paintTo( QPainter& painter,
  76.                   const QRect* rect = 0 );
  77.     // use this method to paint to high res devices like printers...
  78.     void print( QPainter& painter,
  79.                 const QRect* rect = 0  );
  80.  
  81.  
  82.  
  83. signals:
  84.     void dataLeftClicked( uint row, uint col );
  85.     void dataLeftClicked( const QPoint & pnt );
  86.     void dataMiddleClicked( uint row, uint col );
  87.     void dataMiddleClicked( const QPoint & pnt );
  88.     void dataRightClicked( uint row, uint col );
  89.     void dataRightClicked( const QPoint & pnt );
  90.     void dataLeftPressed( uint row, uint col );
  91.     void dataLeftPressed( const QPoint & pnt );
  92.     void dataMiddlePressed( uint row, uint col );
  93.     void dataMiddlePressed( const QPoint & pnt );
  94.     void dataRightPressed( uint row, uint col );
  95.     void dataRightPressed( const QPoint & pnt );
  96.     void dataLeftReleased( uint row, uint col );
  97.     void dataLeftReleased( const QPoint & pnt );
  98.     void dataMiddleReleased( uint row, uint col );
  99.     void dataMiddleReleased( const QPoint & pnt );
  100.     void dataRightReleased( uint row, uint col );
  101.     void dataRightReleased( const QPoint & pnt );
  102.     void barsDisplayed( int barsDisplayed, int barsLeft );
  103.  
  104. protected:
  105.     virtual void paintEvent( QPaintEvent* event );
  106.     virtual void mousePressEvent( QMouseEvent* event );
  107.     virtual void mouseReleaseEvent( QMouseEvent* event );
  108.     virtual void resizeEvent( QResizeEvent* event );
  109.  
  110. private:
  111.     KDChartParams* _params;
  112.     KDChartTableDataBase* _data;
  113.     bool _activeData;
  114.     bool _doubleBuffered;
  115.     QPixmap _buffer;
  116.     KDChartDataRegion* _mousePressedOnRegion;
  117.     KDChartDataRegionList _dataRegions;
  118. };
  119.  
  120. #endif
  121.