maliakal_d 9f851d6156 Creating Classes, Libraries and Functions for the Common SLS Detector GUI
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@1 af1100a4-978c-4157-bff7-07162d2ba061
2012-05-21 16:00:26 +00:00

60 lines
1.2 KiB
C++

/**
* @author Ian Johnson
* @version 1.0
*/
#ifndef SLSQT1DZOOMER_H
#define SLSQT1DZOOMER_H
#include <qwt_plot_zoomer.h>
#include <qwt_plot_panner.h>
class SlsQtH1D;
class SlsQt1DZoomer:public QwtPlotZoomer{
private:
double x0,x1,y0,y1;
double firstXgt0,firstYgt0;
bool xIsLog,yIsLog;
public:
SlsQt1DZoomer(QwtPlotCanvas *canvas):QwtPlotZoomer(canvas){
setTrackerMode(AlwaysOn);
xIsLog=yIsLog=0;
}
double x() {return x0;}
double x_firstGreaterThan0() {return firstXgt0;}
double w() {return x1-x0;}
double y() {return y0;}
double y_firstGreaterThan0() {return firstYgt0;}
double h() {return y1-y0;}
void SetZoomBase(double xmin,double ymin,double x_width, double y_width);
void SetZoomBase(SlsQtH1D* h);
void ExtendZoomBase(SlsQtH1D* h);
void ResetZoomBase();
bool IsLogX(){ return xIsLog;}
bool IsLogY(){ return yIsLog;}
bool SetLogX(bool yes) { return xIsLog=yes;}
bool SetLogY(bool yes) { return yIsLog=yes;}
virtual QwtText trackerText(const QwtDoublePoint &pos) const{
QColor bg(Qt::white);
#if QT_VERSION >= 0x040300
bg.setAlpha(200);
#endif
QwtText text = QwtPlotZoomer::trackerText(pos);
text.setBackgroundBrush( QBrush( bg ));
return text;
}
};
#endif