Marsyas  0.2
/home/gperciva/src/marsyas/src/marsyasqt/QtMarPlot.h
00001 //  Graham Percival  <gperciva@uvic.ca>
00002 #ifndef QTMARPLOT_H
00003 #define QTMARPLOT_H
00004 
00005 #include <QWidget>
00006 #include <QPainter>
00007 
00008 #include "MarSystemManager.h"
00009 using namespace Marsyas;
00010 
00011 namespace MarsyasQt
00012 {
00021 class QtMarPlot : public QWidget
00022 {
00023     Q_OBJECT
00024 public:
00025     QtMarPlot(QWidget *parent = 0);
00026     ~QtMarPlot();
00027 
00028     void setPlotName(QString plotName)
00029     {
00030         plotName_ = plotName;
00031     }
00032     void setBackgroundColor(QPalette color)
00033     {
00034         setPalette(color);
00035     }
00036     void setPixelWidth(mrs_natural width)
00037     {
00038         pixelWidth_ = width;
00039     }
00040     void setCenterLine(bool drawCenter)
00041     {
00042         drawCenter_ = drawCenter;
00043     }
00044     void setImpulses(bool drawImpulses)
00045     {
00046         drawImpulses_ = drawImpulses;
00047     }
00048 
00050     void setVertical(mrs_real minVal, mrs_real highVal)
00051     {
00052         minVal_ = minVal;
00053         highVal_ = highVal;
00054     }
00056     void setHorizontal(mrs_natural start, mrs_natural end)
00057     {
00058         startOffset_ = start;
00059         endOffset_ = end;
00060     }
00061 
00062     void setData(realvec getData)
00063     {
00064         data_ = getData;
00065         setHorizontal(0, data_.getSize()-1);
00066         update();
00067     }
00068 
00069 protected:
00070     void paintEvent(QPaintEvent *event);
00071 
00072     QString plotName_;
00073     mrs_real minVal_, highVal_;
00074     mrs_natural startOffset_, endOffset_;
00075     mrs_natural pixelWidth_;
00076     bool drawCenter_;
00077     bool drawImpulses_;
00078 
00079     realvec data_;
00080 };
00081 
00082 } //namespace
00083 #endif
00084