GSI Object Oriented Online Offline (Go4)  GO4-6.1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4LabelPainter.h
Go to the documentation of this file.
1 // $Id: TGo4LabelPainter.h 2746 2020-04-16 09:10:17Z linev $
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
14 #ifndef TGO4LABELPAINTER_H
15 #define TGO4LABELPAINTER_H
16 
17 #include "TPaveText.h"
18 #include "TLine.h"
19 
27 class TGo4Label : public TPaveText {
28 
29 public:
30  TGo4Label() : TPaveText(), fxOwner(0) { SetBit(kMustCleanup); /*SetBit(kCanDelete,kFALSE);*/ }
31  TGo4Label(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Option_t *option = "br")
32  : TPaveText(x1, y1, x2, y2, option), fxOwner(0)
33  {
34  SetBit(kMustCleanup); /*SetBit(kCanDelete,kFALSE);*/
35  }
36 
37  virtual ~TGo4Label() { fxLastDeleted = this; }
38 
39  void SetOwner(TObject *ob) { fxOwner = ob; }
40 
41  virtual void Paint(Option_t *opt = "");
42 
43  virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
44 
46  static const void *fxLastDeleted;
47 
48 private:
50  TObject *fxOwner;
51 
52  ClassDef(TGo4Label, 7)
53 };
54 
62 class TGo4LabelConnector : public TLine {
63 
64 public:
65  TGo4LabelConnector() : TLine(), fxOwner(0) { SetBit(kMustCleanup); }
66  TGo4LabelConnector(Double_t x1, Double_t y1, Double_t x2, Double_t y2) : TLine(x1, y1, x2, y2), fxOwner(0)
67  {
68  SetBit(kMustCleanup);
69  }
70 
71  virtual ~TGo4LabelConnector() { fxLastDeleted = this; };
72 
73  void SetOwner(TObject *ob) { fxOwner = ob; }
74 
75  virtual void Paint(Option_t *opt = "");
76 
78  static const void *fxLastDeleted;
79 
80 private:
82  TObject *fxOwner;
83 
84  ClassDef(TGo4LabelConnector, 6)
85 };
86 
95 class TGo4LabelPainter : public TNamed, public TAttLine, public TAttFill, public TAttText {
96  public:
98  TGo4LabelPainter(const char* name, const char* title = 0);
99  virtual ~TGo4LabelPainter();
100 
102  virtual void PaintLabel(Option_t* opt="");
103 
105  virtual void UnPaintLabel(Option_t* opt="");
106 
108  virtual void RePaintLabel(Option_t* opt="");
109 
111  virtual void DisplayToFront(Option_t* opt="");
112 
113  void SetCaption(const char* txt) { fxCaption=txt; }
114  void SetX0(Double_t x=0) { fdX0=x; }
115  void SetY0(Double_t y=0) { fdY0=y; }
116  void SetWidth(Double_t w=0) { fdWidth=w; }
117  void SetHeight(Double_t h=0) { fdHeight=h; }
118 
119  void AddToLabel(const char* txt) { if(fxLabel) fxLabel->AddText(txt); }
120 
122  void InitAttributes();
123 
125  Double_t GetLabelXlo();
126 
128  Double_t GetLabelYlo();
129 
131  Double_t GetLabelXup();
132 
134  Double_t GetLabelYup();
135 
136  private:
139 
141  Double_t fdX0;
142 
144  Double_t fdY0;
145 
147  Double_t fdWidth;
148 
150  Double_t fdHeight;
151 
153  TString fxCaption;
154 
157 
159  TGo4Label* CreateCurrentLabel(Double_t x, Double_t y);
160 
162  void LabelCoords(Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax);
163 
165  Bool_t CheckLabel();
166 
167  ClassDef(TGo4LabelPainter,6)
168 };
169 
170 #endif //TGO4LABELPAINTER_H
static const void * fxLastDeleted
virtual ~TGo4LabelConnector()
virtual void Paint(Option_t *opt="")
TGo4LabelConnector(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
TObject * fxOwner
void SetX0(Double_t x=0)
TGo4Label(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Option_t *option="br")
virtual void UnPaintLabel(Option_t *opt="")
virtual void Paint(Option_t *opt="")
TGo4Label * CreateCurrentLabel(Double_t x, Double_t y)
virtual ~TGo4LabelPainter()
virtual void PaintLabel(Option_t *opt="")
virtual ~TGo4Label()
void SetWidth(Double_t w=0)
static const void * fxLastDeleted
void SetCaption(const char *txt)
void SetY0(Double_t y=0)
void LabelCoords(Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax)
void SetOwner(TObject *ob)
void SetOwner(TObject *ob)
void SetHeight(Double_t h=0)
void AddToLabel(const char *txt)
virtual void DisplayToFront(Option_t *opt="")
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual void RePaintLabel(Option_t *opt="")