00001
00002
00014 #ifndef _QtViewWidget_H_
00015 #define _QtViewWidget_H_
00016
00017 #include "QtViewImp.h"
00018
00019 #include <qpixmap.h>
00020 #include <qwidget.h>
00021
00022 class QPaintEvent;
00023
00024 namespace hippodraw {
00025
00037 class MDL_QTHIPPOPLOT_API QtViewWidget : public QtViewImp, public QWidget
00038 {
00040 QtViewWidget ( const QtViewWidget & );
00041
00043 int toCanvasX ( double dx ) const;
00044
00046 int toCanvasY ( double dy ) const;
00047
00054 #if QT_VERSION < 0x040000
00055 void transformAndFill ( QPointArray & array,
00056 #else
00057 void transformAndFill ( QPolygon & array,
00058 #endif
00059 const std::vector < double > & x,
00060 const std::vector < double > & y,
00061 int (QtViewWidget::* xfunc ) ( double ) const,
00062 int (QtViewWidget::* yfunc ) ( double ) const );
00063
00066 void drawMethod ( const std::vector< double > & x,
00067 const std::vector< double > & y,
00068 int opt1,
00069 int opt2 );
00070
00077 void drawViewMethod ( const std::vector< double > & x,
00078 const std::vector< double > & y,
00079 int opt1,
00080 int opt2 );
00081
00082 QPixmap offscr;
00083 int double_buffer;
00084
00085 public:
00086
00089 QtViewWidget ( QWidget * parent = 0,
00090 const char * name = 0,
00091 Qt::WFlags wflags = 0 );
00092
00094 virtual ~QtViewWidget ();
00095
00102 void setPlotter ( PlotterBase * );
00103
00105 virtual QSize sizeHint () const;
00106
00109 virtual void draw ( QPainter & );
00110
00112 virtual void paintEvent ( QPaintEvent * );
00113
00114 virtual void update ( const Observable * );
00115
00119 virtual void setGeometry ( int x, int y, int w, int h );
00120
00124 virtual void setGeometry ( const QRect & );
00125
00126 virtual Rect getDrawRect () const;
00127
00129 void setDrawRect ( const QRect & rect );
00130
00132 virtual void setDrawRect ( float x, float y, float width, float height );
00133
00136 virtual void resizeEvent ( QResizeEvent * event );
00137
00139 int toViewX ( double datX ) const;
00140
00142 int toViewY ( double datY ) const;
00143
00144 virtual void fillPickedPoint ( double x, double y,
00145 std::vector < double > & picked ) const;
00146
00147 virtual void setDoubleBuffering( unsigned dblbuf);
00148
00153 virtual void mousePressEvent ( QMouseEvent * e );
00154
00155 };
00156
00157 }
00158
00159 #endif // _QtViewWidget_H_