GSI Object Oriented Online Offline (Go4) GO4-6.4.0
Loading...
Searching...
No Matches
TGo4LabelPainter.h
Go to the documentation of this file.
1// $Id$
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
27class TGo4Label : public TPaveText {
28
29public:
30 TGo4Label() : TPaveText(), fxOwner(nullptr) { SetBit(kMustCleanup); /*SetBit(kCanDelete,kFALSE);*/ }
31
32 TGo4Label(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Option_t *option = "br")
33 : TPaveText(x1, y1, x2, y2, option), fxOwner(nullptr)
34 {
35 SetBit(kMustCleanup); /*SetBit(kCanDelete,kFALSE);*/
36 }
37
38 virtual ~TGo4Label() { fxLastDeleted = this; }
39
40 void SetOwner(TObject *ob) { fxOwner = ob; }
41
42 void Paint(Option_t *opt = "") override;
43
44 void ExecuteEvent(Int_t event, Int_t px, Int_t py) override;
45
47 static const void *fxLastDeleted;
48
49private:
51 TObject *fxOwner{nullptr};
52
53 ClassDefOverride(TGo4Label, 7)
54};
55
63class TGo4LabelConnector : public TLine {
64
65public:
66 TGo4LabelConnector() : TLine(), fxOwner(nullptr) { SetBit(kMustCleanup); }
67
68 TGo4LabelConnector(Double_t x1, Double_t y1, Double_t x2, Double_t y2) : TLine(x1, y1, x2, y2), fxOwner(nullptr)
69 {
70 SetBit(kMustCleanup);
71 }
72
73 virtual ~TGo4LabelConnector() { fxLastDeleted = this; };
74
75 void SetOwner(TObject *ob) { fxOwner = ob; }
76
77 void Paint(Option_t *opt = "") override;
78
80 static const void *fxLastDeleted;
81
82private:
84 TObject *fxOwner{nullptr};
85
86 ClassDefOverride(TGo4LabelConnector, 6)
87};
88
96
97class TGo4LabelPainter : public TNamed, public TAttLine, public TAttFill, public TAttText {
98 public:
100 TGo4LabelPainter(const char *name, const char *title = nullptr);
101 virtual ~TGo4LabelPainter();
102
104 virtual void PaintLabel(Option_t *opt = "");
105
107 virtual void UnPaintLabel(Option_t *opt = "");
108
110 virtual void RePaintLabel(Option_t *opt = "");
111
113 virtual void DisplayToFront(Option_t *opt = "");
114
115 void SetCaption(const char *txt) { fxCaption=txt; }
116 void SetX0(Double_t x = 0.) { fdX0 = x; }
117 void SetY0(Double_t y = 0.) { fdY0 = y; }
118 void SetWidth(Double_t w = 0.) { fdWidth = w; }
119 void SetHeight(Double_t h = 0.) { fdHeight = h; }
120
121 void AddToLabel(const char *txt) { if(fxLabel) fxLabel->AddText(txt); }
122
124 void InitAttributes();
125
127 Double_t GetLabelXlo();
128
130 Double_t GetLabelYlo();
131
133 Double_t GetLabelXup();
134
136 Double_t GetLabelYup();
137
138 private:
141
143 Double_t fdX0{0};
144
146 Double_t fdY0{0};
147
149 Double_t fdWidth{0};
150
152 Double_t fdHeight{0};
153
155 TString fxCaption;
156
158 Bool_t fbIsLabStreamed{kFALSE};
159
161 TGo4Label* CreateCurrentLabel(Double_t x, Double_t y);
162
164 void LabelCoords(Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax);
165
167 Bool_t CheckLabel();
168
169 ClassDefOverride(TGo4LabelPainter,6)
170};
171
172#endif //TGO4LABELPAINTER_H
Connection line for labels that knows its author.
TGo4LabelConnector(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
void Paint(Option_t *opt="") override
static const void * fxLastDeleted
set this to pointer of last deleted instance before
TObject * fxOwner
the owner of this connector line
void SetOwner(TObject *ob)
virtual ~TGo4LabelConnector()
Base class for painters providing a textlabel for additional information.
void SetY0(Double_t y=0.)
virtual void UnPaintLabel(Option_t *opt="")
Erase the label.
Double_t fdHeight
initial height relative to whole pad
Double_t fdX0
initial reference coordinates x
TGo4Label * fxLabel
the label
Double_t fdY0
initial reference coordinates y
Double_t GetLabelYlo()
Reference coordinate y of label box (lower left corner)
Double_t fdWidth
initial width relative to whole pad
Double_t GetLabelXup()
Reference coordinate x of label box (upper right corner)
void InitAttributes()
Initialize the label attributes.
void SetHeight(Double_t h=0.)
void SetWidth(Double_t w=0.)
Double_t GetLabelYup()
Reference coordinate y of label box (upper right corner)
void LabelCoords(Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax)
Evaluate coordinates for new label for given xmin, ymin with respect to pad size.
Bool_t CheckLabel()
Check if label is still existing.
TString fxCaption
Headline for the label.
Bool_t fbIsLabStreamed
Flag to handle streamed label from file correctly.
void SetCaption(const char *txt)
virtual void PaintLabel(Option_t *opt="")
Draw the label.
TGo4Label * CreateCurrentLabel(Double_t x, Double_t y)
Create Label at the window coords.
virtual void DisplayToFront(Option_t *opt="")
pop all components to the front of the pad
virtual void RePaintLabel(Option_t *opt="")
refresh painting of label with current attributes
void AddToLabel(const char *txt)
Double_t GetLabelXlo()
Reference coordinate x of label box (lower left corner)
void SetX0(Double_t x=0.)
Text label that knows its author.
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
void SetOwner(TObject *ob)
static const void * fxLastDeleted
set this to pointer of last deleted instance before
void Paint(Option_t *opt="") override
TGo4Label(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Option_t *option="br")
TObject * fxOwner
the owner of this label
virtual ~TGo4Label()