GSI Object Oriented Online Offline (Go4)  GO4-5.3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4LabelPainter.h
Go to the documentation of this file.
1 // $Id: TGo4LabelPainter.h 1855 2016-02-29 12:56:48Z adamczew $
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 für 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 #include "TNamed.h"
20 #include "TAttLine.h"
21 #include "TAttFill.h"
22 #include "TAttText.h"
23 
31 class TGo4Label : public TPaveText {
32 
33  public:
34  TGo4Label(): TPaveText(), fxOwner(0) { SetBit(kMustCleanup); /*SetBit(kCanDelete,kFALSE);*/}
35  TGo4Label(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Option_t* option = "br")
36  : TPaveText(x1,y1,x2,y2,option),fxOwner(0) { SetBit(kMustCleanup); /*SetBit(kCanDelete,kFALSE);*/}
37 
38  virtual ~TGo4Label(){fxLastDeleted=(char*) this;}
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 char* fxLastDeleted;
47 
48  private:
50  TObject* fxOwner;
51  ClassDef(TGo4Label,7)
52 };
53 
61 class TGo4LabelConnector : public TLine {
62 
63  public:
64  TGo4LabelConnector(): TLine(), fxOwner(0) { SetBit(kMustCleanup); }
65  TGo4LabelConnector(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
66  : TLine(x1,y1,x2,y2),fxOwner(0) { SetBit(kMustCleanup); }
67 
68  virtual ~TGo4LabelConnector(){fxLastDeleted=(char*) this;};
69  void SetOwner(TObject* ob){fxOwner=ob;}
70 
71  virtual void Paint(Option_t* opt="");
72 
74  static char* fxLastDeleted;
75 
76  private:
78  TObject* fxOwner;
79  ClassDef(TGo4LabelConnector,6)
80 };
81 
82 
91 class TGo4LabelPainter : public TNamed, public TAttLine, public TAttFill, public TAttText {
92  public:
94  TGo4LabelPainter(const char* name, const char* title = 0);
95  virtual ~TGo4LabelPainter();
96 
98  virtual void PaintLabel(Option_t* opt="");
99 
101  virtual void UnPaintLabel(Option_t* opt="");
102 
104  virtual void RePaintLabel(Option_t* opt="");
105 
107  virtual void DisplayToFront(Option_t* opt="");
108 
109  void SetCaption(const char* txt) { fxCaption=txt; }
110  void SetX0(Double_t x=0) { fdX0=x; }
111  void SetY0(Double_t y=0) { fdY0=y; }
112  void SetWidth(Double_t w=0) { fdWidth=w; }
113  void SetHeight(Double_t h=0) { fdHeight=h; }
114 
115  void AddToLabel(const char* txt) { if(fxLabel) fxLabel->AddText(txt); }
116 
118  void InitAttributes();
119 
121  Double_t GetLabelXlo();
122 
124  Double_t GetLabelYlo();
125 
127  Double_t GetLabelXup();
128 
130  Double_t GetLabelYup();
131 
132  private:
135 
137  Double_t fdX0;
138 
140  Double_t fdY0;
141 
143  Double_t fdWidth;
144 
146  Double_t fdHeight;
147 
149  TString fxCaption;
150 
153 
155  TGo4Label* CreateCurrentLabel(Double_t x, Double_t y);
156 
158  void LabelCoords(Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax);
159 
161  Bool_t CheckLabel();
162 
163  ClassDef(TGo4LabelPainter,6)
164 };
165 
166 #endif //TGO4LABELPAINTER_H
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)
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)
static char * fxLastDeleted
void SetOwner(TObject *ob)
static char * fxLastDeleted
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="")