kchart

KDChartWidget.h
Go to the documentation of this file.
1/*
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 <tqwidget.h>
36#include <tqscrollview.h>
37#include <tqpixmap.h>
38
45
46class KDChartParams;
47
48class KDCHART_EXPORT KDChartWidget : public TQWidget
49{
50 TQ_OBJECT
51
52 TQ_PROPERTY( bool activeData READ isActiveData WRITE setActiveData )
53 TQ_PROPERTY( bool doubleBuffered READ isDoubleBuffered WRITE setDoubleBuffered )
54
55public:
56 KDChartWidget( TQWidget* parent = 0, const char* name = 0 );
59 TQWidget* parent = 0, const char* name = 0 );
61
62public slots:
63 bool isActiveData() const;
64 bool isDoubleBuffered() const;
65
66 KDChartParams* params() const;
68
69 const KDChartDataRegionList* dataRegions() const { return &_dataRegions; }
70
71 void setActiveData( bool active );
72 void setDoubleBuffered( bool doublebuffered );
75 // use this method to paint to low resolution devices
76 void paintTo( TQPainter& painter,
77 const TQRect* rect = 0 );
78 // use this method to paint to high res devices like printers...
79 void print( TQPainter& painter,
80 const TQRect* rect = 0 );
81
82
83
84signals:
85 void dataLeftClicked( uint row, uint col );
86 void dataLeftClicked( const TQPoint & pnt );
87 void dataMiddleClicked( uint row, uint col );
88 void dataMiddleClicked( const TQPoint & pnt );
89 void dataRightClicked( uint row, uint col );
90 void dataRightClicked( const TQPoint & pnt );
91 void dataLeftPressed( uint row, uint col );
92 void dataLeftPressed( const TQPoint & pnt );
93 void dataMiddlePressed( uint row, uint col );
94 void dataMiddlePressed( const TQPoint & pnt );
95 void dataRightPressed( uint row, uint col );
96 void dataRightPressed( const TQPoint & pnt );
97 void dataLeftReleased( uint row, uint col );
98 void dataLeftReleased( const TQPoint & pnt );
99 void dataMiddleReleased( uint row, uint col );
100 void dataMiddleReleased( const TQPoint & pnt );
101 void dataRightReleased( uint row, uint col );
102 void dataRightReleased( const TQPoint & pnt );
103 void barsDisplayed( int barsDisplayed, int barsLeft );
104
105protected:
106 virtual void paintEvent( TQPaintEvent* event );
107 virtual void mousePressEvent( TQMouseEvent* event );
108 virtual void mouseReleaseEvent( TQMouseEvent* event );
109 virtual void resizeEvent( TQResizeEvent* event );
110
111private:
112 KDChartParams* _params;
114 bool _activeData;
115 bool _doubleBuffered;
116 TQPixmap _buffer;
117 KDChartDataRegion* _mousePressedOnRegion;
118 KDChartDataRegionList _dataRegions;
119};
120
121#endif
The collection class used by KD Chart to store data region information.
Bundles the display parameters of a chart.
KD Chart's build-in table data for an easy way of storing data values.
void dataMiddleClicked(uint row, uint col)
This signal is emitted when a data item was clicked onto with the middle mouse button.
KDChartWidget(TQWidget *parent=0, const char *name=0)
Default Constructor.
void dataMiddleClicked(const TQPoint &pnt)
This signal is emitted when a data item was clicked onto with the middle mouse button.
void dataLeftClicked(uint row, uint col)
This signal is emitted when a data item was clicked onto with the left mouse button.
bool isDoubleBuffered() const
Returns whether the widget uses double-buffering for drawing.
KDChartTableDataBase * data() const
Returns a pointer to the current data table.
void dataRightClicked(uint row, uint col)
This signal is emitted when a data item was clicked onto with the right mouse button.
void setData(KDChartTableDataBase *data)
Set an entire new data table.
void setParams(KDChartParams *params)
Set an entire new parameter set.
void setActiveData(bool active)
If active is true, this widget reports mouse presses, releases and clicks on the data segments it dis...
void dataLeftClicked(const TQPoint &pnt)
This signal is emitted when a data item was clicked onto with the left mouse button.
void barsDisplayed(int barsDisplayed, int barsLeft)
This signal is emitted when drawing of a bar chart is done.
void dataRightClicked(const TQPoint &pnt)
This signal is emitted when a data item was clicked onto with the right mouse button.
void setDoubleBuffered(bool doublebuffered)
If doublebuffered is true, the widget will double-buffer everything while drawing which reduces flick...
KDChartParams * params() const
Returns a pointer to the current parameter set.
bool isActiveData() const
Returns true if the widget is configured to report mouse events.