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