00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef TGO4LABELPAINTER_H
00017 #define TGO4LABELPAINTER_H
00018
00019 #include "TPaveText.h"
00020 #include "TLine.h"
00021 #include "TNamed.h"
00022 #include "TAttLine.h"
00023 #include "TAttFill.h"
00024 #include "TAttText.h"
00025
00033 class TGo4Label : public TPaveText {
00034
00035 public:
00036 TGo4Label(): TPaveText(), fxOwner(0) { SetBit(kMustCleanup);}
00037 TGo4Label(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Option_t* option = "br")
00038 : TPaveText(x1,y1,x2,y2,option),fxOwner(0) { SetBit(kMustCleanup); }
00039
00040 virtual ~TGo4Label(){fxLastDeleted=(char*) this;}
00041 void SetOwner(TObject* ob){fxOwner=ob;}
00042
00043 virtual void Paint(Option_t* opt="");
00044
00045 virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
00046
00048 static char* fxLastDeleted;
00049
00050 private:
00052 TObject* fxOwner;
00053 ClassDef(TGo4Label,7)
00054 };
00055
00063 class TGo4LabelConnector : public TLine {
00064
00065 public:
00066 TGo4LabelConnector(): TLine(), fxOwner(0) { SetBit(kMustCleanup); }
00067 TGo4LabelConnector(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
00068 : TLine(x1,y1,x2,y2),fxOwner(0) { SetBit(kMustCleanup); }
00069
00070 virtual ~TGo4LabelConnector(){fxLastDeleted=(char*) this;};
00071 void SetOwner(TObject* ob){fxOwner=ob;}
00072
00073 virtual void Paint(Option_t* opt="");
00074
00076 static char* fxLastDeleted;
00077
00078 private:
00080 TObject* fxOwner;
00081 ClassDef(TGo4LabelConnector,6)
00082 };
00083
00084
00093 class TGo4LabelPainter : public TNamed, public TAttLine, public TAttFill, public TAttText {
00094 public:
00095 TGo4LabelPainter();
00096 TGo4LabelPainter(const Text_t * name);
00097 TGo4LabelPainter(const Text_t * name, const Text_t * title);
00098 virtual ~TGo4LabelPainter();
00099
00101 virtual void PaintLabel(Option_t* opt="");
00102
00104 virtual void UnPaintLabel(Option_t* opt="");
00105
00107 virtual void RePaintLabel(Option_t* opt="");
00108
00110 virtual void DisplayToFront(Option_t* opt="");
00111
00112 void SetCaption(const Text_t* txt){fxCaption=txt;}
00113 void SetX0(Double_t x=0){fdX0=x;}
00114 void SetY0(Double_t y=0){fdY0=y;}
00115 void SetWidth(Double_t w=0){fdWidth=w;}
00116 void SetHeight(Double_t h=0){fdHeight=h;}
00117
00118 void AddToLabel(const Text_t* txt) { if(fxLabel) fxLabel->AddText(txt); }
00119
00121 void InitAttributes();
00122
00124 Double_t GetLabelXlo();
00125
00127 Double_t GetLabelYlo();
00128
00130 Double_t GetLabelXup();
00131
00133 Double_t GetLabelYup();
00134
00135 private:
00137 TGo4Label* fxLabel;
00138
00140 Double_t fdX0;
00141
00143 Double_t fdY0;
00144
00146 Double_t fdWidth;
00147
00149 Double_t fdHeight;
00150
00152 TString fxCaption;
00153
00155 Bool_t fbIsLabStreamed;
00156
00158 TGo4Label* CreateCurrentLabel(Double_t x, Double_t y);
00159
00161 void LabelCoords(Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax);
00162
00164 Bool_t CheckLabel();
00165
00166 ClassDef(TGo4LabelPainter,6)
00167 };
00168
00169 #endif //TGO4LABELPAINTER_H
00170
00171