Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
pavetext.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_graphics
3/// \notebook
4/// \preview Draw a pave text.
5/// The text lines are added in order using the AddText method
6/// Line separator can be added using AddLine.
7///
8/// AddText returns a TText corresponding to the line added to the pave. This
9/// return value can be used to modify the text attributes.
10///
11/// Once the TPaveText is build the text of each line can be retrieved as a
12/// TText with GetLine and GetLineWith wich is also useful to modify the text
13/// attributes of a line.
14///
15/// \macro_image
16/// \macro_code
17///
18/// \author Olivier Couet
19
21{
22 TCanvas *c = new TCanvas("c");
23 TPaveText *pt = new TPaveText(.05, .1, .95, .8);
24
25 pt->AddText("A TPaveText can contain severals line of text.");
26 pt->AddText("They are added to the pave using the AddText method.");
27 pt->AddLine(.0, .5, 1., .5);
28 pt->AddText("Even complex TLatex formulas can be added:");
29 TText *t1 = pt->AddText("F(t) = #sum_{i=-#infty}^{#infty}A(i)cos#[]{#frac{i}{t+i}}");
30
31 t1->SetTextColor(kBlue);
32
33 pt->Draw();
34
35 TText *t2 = pt->GetLineWith("Even");
36 t2->SetTextColor(kOrange + 1);
37
38 return c;
39}
#define c(i)
Definition RSha256.hxx:101
@ kOrange
Definition Rtypes.h:67
@ kBlue
Definition Rtypes.h:66
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
The Canvas class.
Definition TCanvas.h:23
A Pave (see TPave) with text, lines or/and boxes inside.
Definition TPaveText.h:21
virtual TText * AddText(Double_t x1, Double_t y1, const char *label)
Add a new Text line to this pavetext at given coordinates.
virtual TLine * AddLine(Double_t x1=0, Double_t y1=0, Double_t x2=0, Double_t y2=0)
Add a new graphics line to this pavetext.
void Draw(Option_t *option="") override
Draw this pavetext with its current attributes.
virtual TText * GetLineWith(const char *text) const
Get Pointer to first containing string text in this pavetext.
Base class for several text objects.
Definition TText.h:22
TPaveText * pt
auto * t1
Definition textangle.C:20