#ifndef ROOT_TGSpeedo
#define ROOT_TGSpeedo
#ifndef ROOT_TGFrame
#include "TGFrame.h"
#endif
#ifndef ROOT_TGWidget
#include "TGWidget.h"
#endif
#ifndef ROOT_TGPicture
#include "TGPicture.h"
#endif
#ifndef ROOT_TImage
#include "TImage.h"
#endif
class TGSpeedo : public TGFrame, public TGWidget {
public:
enum EGlowColor { kNoglow, kGreen, kOrange, kRed };
protected:
TImage *fImage;
TImage *fImage2;
const TGPicture *fBase;
FontStruct_t fTextFS, fCounterFS;
Int_t fCounter;
TString fPicName;
TString fLabel1;
TString fLabel2;
TString fDisplay1;
TString fDisplay2;
Float_t fAngle, fValue;
Float_t fPeakVal;
Float_t fMeanVal;
Float_t fAngleMin, fAngleMax;
Float_t fScaleMin, fScaleMax;
Float_t fThreshold[3];
EGlowColor fThresholdColor[3];
Bool_t fThresholdActive;
Bool_t fPeakMark;
Bool_t fMeanMark;
virtual void DoRedraw();
void DrawNeedle();
void DrawText();
void Translate(Float_t val, Float_t angle, Int_t *x, Int_t *y);
public:
TGSpeedo(const TGWindow *p = 0, int id = -1);
TGSpeedo(const TGWindow *p, Float_t smin, Float_t smax,
const char *lbl1 = "", const char *lbl2 = "",
const char *dsp1 = "", const char *dsp2 = "", int id = -1);
virtual ~TGSpeedo();
virtual TGDimension GetDefaultSize() const;
virtual Bool_t HandleButton(Event_t *event);
const TGPicture *GetPicture() const { return fBase; }
TImage *GetImage() const { return fImage; }
Float_t GetPeakVal() const { return fPeakVal; }
Float_t GetScaleMin() const { return fScaleMin; }
Float_t GetScaleMax() const { return fScaleMax; }
Bool_t IsThresholdActive() { return fThresholdActive; }
void Build();
void Glow(EGlowColor col = kGreen);
void StepScale(Float_t step);
void SetScaleValue(Float_t val);
void SetScaleValue(Float_t val, Int_t damping);
void SetOdoValue(Int_t val);
void SetDisplayText(const char *text1, const char *text2 = "");
void SetLabelText(const char *text1, const char *text2 = "");
void SetMinMaxScale(Float_t min, Float_t max);
void SetThresholds(Float_t th1 = 0.0, Float_t th2 = 0.0, Float_t th3 = 0.0)
{ fThreshold[0] = th1; fThreshold[1] = th2; fThreshold[2] = th3; }
void SetThresholdColors(EGlowColor col1, EGlowColor col2, EGlowColor col3)
{ fThresholdColor[0] = col1; fThresholdColor[1] = col2; fThresholdColor[2] = col3; }
void EnableThreshold() { fThresholdActive = kTRUE; }
void DisableThreshold() { fThresholdActive = kFALSE; Glow(kNoglow); fClient->NeedRedraw(this);}
void EnablePeakMark() { fPeakMark = kTRUE; }
void DisablePeakMark() { fPeakMark = kFALSE; }
void EnableMeanMark() { fMeanMark = kTRUE; }
void DisableMeanMark() { fMeanMark = kFALSE; }
void ResetPeakVal() { fPeakVal = fValue; fClient->NeedRedraw(this); }
void SetMeanValue(Float_t mean) { fMeanVal = mean; fClient->NeedRedraw(this); }
void OdoClicked() { Emit("OdoClicked()"); }
void LedClicked() { Emit("LedClicked()"); }
ClassDef(TGSpeedo,0)
};
#endif