00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_TGSpeedo
00013 #define ROOT_TGSpeedo
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef ROOT_TGFrame
00033 #include "TGFrame.h"
00034 #endif
00035 #ifndef ROOT_TGWidget
00036 #include "TGWidget.h"
00037 #endif
00038 #ifndef ROOT_TGPicture
00039 #include "TGPicture.h"
00040 #endif
00041 #ifndef ROOT_TImage
00042 #include "TImage.h"
00043 #endif
00044
00045
00046 class TGSpeedo : public TGFrame, public TGWidget {
00047
00048 public:
00049 enum EGlowColor { kNoglow, kGreen, kOrange, kRed };
00050
00051 protected:
00052 TImage *fImage;
00053 TImage *fImage2;
00054 const TGPicture *fBase;
00055 FontStruct_t fTextFS, fCounterFS;
00056 Int_t fCounter;
00057 TString fPicName;
00058 TString fLabel1;
00059 TString fLabel2;
00060 TString fDisplay1;
00061 TString fDisplay2;
00062 Float_t fAngle, fValue;
00063 Float_t fPeakVal;
00064 Float_t fMeanVal;
00065 Float_t fAngleMin, fAngleMax;
00066 Float_t fScaleMin, fScaleMax;
00067 Float_t fThreshold[3];
00068 EGlowColor fThresholdColor[3];
00069 Bool_t fThresholdActive;
00070 Bool_t fPeakMark;
00071 Bool_t fMeanMark;
00072
00073 virtual void DoRedraw();
00074 void DrawNeedle();
00075 void DrawText();
00076 void Translate(Float_t val, Float_t angle, Int_t *x, Int_t *y);
00077
00078 public:
00079 TGSpeedo(const TGWindow *p = 0, int id = -1);
00080 TGSpeedo(const TGWindow *p, Float_t smin, Float_t smax,
00081 const char *lbl1 = "", const char *lbl2 = "",
00082 const char *dsp1 = "", const char *dsp2 = "", int id = -1);
00083 virtual ~TGSpeedo();
00084
00085 virtual TGDimension GetDefaultSize() const;
00086 virtual Bool_t HandleButton(Event_t *event);
00087
00088 const TGPicture *GetPicture() const { return fBase; }
00089 TImage *GetImage() const { return fImage; }
00090 Float_t GetPeakVal() const { return fPeakVal; }
00091 Float_t GetScaleMin() const { return fScaleMin; }
00092 Float_t GetScaleMax() const { return fScaleMax; }
00093 Bool_t IsThresholdActive() { return fThresholdActive; }
00094
00095 void Build();
00096 void Glow(EGlowColor col = kGreen);
00097 void StepScale(Float_t step);
00098 void SetScaleValue(Float_t val);
00099 void SetScaleValue(Float_t val, Int_t damping);
00100 void SetOdoValue(Int_t val);
00101 void SetDisplayText(const char *text1, const char *text2 = "");
00102 void SetLabelText(const char *text1, const char *text2 = "");
00103 void SetMinMaxScale(Float_t min, Float_t max);
00104 void SetThresholds(Float_t th1 = 0.0, Float_t th2 = 0.0, Float_t th3 = 0.0)
00105 { fThreshold[0] = th1; fThreshold[1] = th2; fThreshold[2] = th3; }
00106 void SetThresholdColors(EGlowColor col1, EGlowColor col2, EGlowColor col3)
00107 { fThresholdColor[0] = col1; fThresholdColor[1] = col2; fThresholdColor[2] = col3; }
00108 void EnableThreshold() { fThresholdActive = kTRUE; }
00109 void DisableThreshold() { fThresholdActive = kFALSE; Glow(kNoglow); fClient->NeedRedraw(this);}
00110 void EnablePeakMark() { fPeakMark = kTRUE; }
00111 void DisablePeakMark() { fPeakMark = kFALSE; }
00112 void EnableMeanMark() { fMeanMark = kTRUE; }
00113 void DisableMeanMark() { fMeanMark = kFALSE; }
00114 void ResetPeakVal() { fPeakVal = fValue; fClient->NeedRedraw(this); }
00115 void SetMeanValue(Float_t mean) { fMeanVal = mean; fClient->NeedRedraw(this); }
00116
00117 void OdoClicked() { Emit("OdoClicked()"); }
00118 void LedClicked() { Emit("LedClicked()"); }
00119
00120 ClassDef(TGSpeedo,0)
00121 };
00122
00123 #endif