Logo ROOT   6.16/01
Reference Guide
TText.h
Go to the documentation of this file.
1// @(#)root/graf:$Id$
2// Author: Nicolas Brun 12/12/94
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TText
13#define ROOT_TText
14
15
16#include "TAttText.h"
17#include "TNamed.h"
18#include "TAttBBox2D.h"
19#include "TPoint.h"
20#include "GuiTypes.h"
21
22
23class TText : public TNamed, public TAttText, public TAttBBox2D {
24
25protected:
26 Double_t fX; ///< X position of text (left,center,etc..)
27 Double_t fY; ///< Y position of text (left,center,etc..)
28 void *fWcsTitle; ///<!Used by TMathText
29
30public:
31 // TText status bits
32 enum {
33 kTextNDC = BIT(14) ///< The text position is in the NDC space
34 };
35
36 TText();
37 TText(Double_t x, Double_t y, const char *text);
38 TText(Double_t x, Double_t y, const wchar_t *text);
39 TText(const TText &text);
40 virtual ~TText();
41 void Copy(TObject &text) const;
42 virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
43 virtual TText *DrawText(Double_t x, Double_t y, const char *text);
44 virtual TText *DrawText(Double_t x, Double_t y, const wchar_t *text);
45 virtual TText *DrawTextNDC(Double_t x, Double_t y, const char *text);
46 virtual TText *DrawTextNDC(Double_t x, Double_t y, const wchar_t *text);
47 virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
48
49 virtual void GetControlBox(Int_t x, Int_t y, Double_t theta,
50 Int_t cBoxX[4], Int_t cBoxY[4]);
51 Double_t GetX() const { return fX; }
52 virtual void GetBoundingBox(UInt_t &w, UInt_t &h, Bool_t angle = kFALSE);
53 virtual void GetTextAscentDescent(UInt_t &a, UInt_t &d, const char *text) const;
54 virtual void GetTextAscentDescent(UInt_t &a, UInt_t &d, const wchar_t *text) const;
55 virtual void GetTextExtent(UInt_t &w, UInt_t &h, const char *text) const;
56 virtual void GetTextExtent(UInt_t &w, UInt_t &h, const wchar_t *text) const;
57 virtual void GetTextAdvance(UInt_t &a, const char *text, const Bool_t kern=kTRUE) const;
58 const void * GetWcsTitle(void) const;
59 Double_t GetY() const { return fY; }
60
61 virtual void ls(Option_t *option="") const;
62 virtual void Paint(Option_t *option="");
63 virtual void PaintControlBox(Int_t x, Int_t y, Double_t theta);
64 virtual void PaintText(Double_t x, Double_t y, const char *text);
65 virtual void PaintText(Double_t x, Double_t y, const wchar_t *text);
66 virtual void PaintTextNDC(Double_t u, Double_t v, const char *text);
67 virtual void PaintTextNDC(Double_t u, Double_t v, const wchar_t *text);
68 virtual void Print(Option_t *option="") const;
69 virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
70 virtual void SetMbTitle(const wchar_t *title=L"");
71 virtual void SetNDC(Bool_t isNDC=kTRUE);
72 virtual void SetText(Double_t x, Double_t y, const char *text) {fX=x; fY=y; SetTitle(text);} // *MENU* *ARGS={x=>fX,y=>fY,text=>fTitle}
73 virtual void SetText(Double_t x, Double_t y, const wchar_t *text) {fX=x; fY=y; SetMbTitle(text);}
74 virtual void SetX(Double_t x) { fX = x; } // *MENU*
75 virtual void SetY(Double_t y) { fY = y; } // *MENU*
76
77 virtual Rectangle_t GetBBox();
78 virtual TPoint GetBBoxCenter();
79 virtual void SetBBoxCenter(const TPoint &p);
80 virtual void SetBBoxCenterX(const Int_t x);
81 virtual void SetBBoxCenterY(const Int_t y);
82 virtual void SetBBoxX1(const Int_t x); //Not Implemented
83 virtual void SetBBoxX2(const Int_t x); //Not Implemented
84 virtual void SetBBoxY1(const Int_t y); //Not Implemented
85 virtual void SetBBoxY2(const Int_t y); //Not Implemented
86
87 ClassDef(TText,3) //Text
88};
89
90#endif
SVector< double, 2 > v
Definition: Dict.h:5
#define d(i)
Definition: RSha256.hxx:102
#define h(i)
Definition: RSha256.hxx:106
int Int_t
Definition: RtypesCore.h:41
unsigned int UInt_t
Definition: RtypesCore.h:42
const Bool_t kFALSE
Definition: RtypesCore.h:88
bool Bool_t
Definition: RtypesCore.h:59
double Double_t
Definition: RtypesCore.h:55
const Bool_t kTRUE
Definition: RtypesCore.h:87
const char Option_t
Definition: RtypesCore.h:62
#define ClassDef(name, id)
Definition: Rtypes.h:324
#define BIT(n)
Definition: Rtypes.h:82
Abstract base class for elements drawn in the editor.
Definition: TAttBBox2D.h:19
Text Attributes class.
Definition: TAttText.h:18
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition: TNamed.cxx:164
Mother of all ROOT objects.
Definition: TObject.h:37
Definition: TPoint.h:31
Base class for several text objects.
Definition: TText.h:23
virtual void ls(Option_t *option="") const
List this text with its attributes.
Definition: TText.cxx:672
virtual void SetText(Double_t x, Double_t y, const char *text)
Definition: TText.h:72
virtual TPoint GetBBoxCenter()
Return the point given by Alignment as 'center'.
Definition: TText.cxx:896
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute distance from point px,py to a string.
Definition: TText.cxx:145
Double_t fY
Y position of text (left,center,etc..)
Definition: TText.h:27
const void * GetWcsTitle(void) const
Returns the text as UNICODE.
Definition: TText.cxx:131
virtual void SetText(Double_t x, Double_t y, const wchar_t *text)
Definition: TText.h:73
virtual void SetBBoxX2(const Int_t x)
Set right hand side of BoundingBox to a value (resize in x direction on right)
Definition: TText.cxx:942
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to one event.
Definition: TText.cxx:225
virtual ~TText()
Text default destructor.
Definition: TText.cxx:90
Double_t GetX() const
Definition: TText.h:51
virtual void GetBoundingBox(UInt_t &w, UInt_t &h, Bool_t angle=kFALSE)
Return text size in pixels.
Definition: TText.cxx:474
virtual void SetY(Double_t y)
Definition: TText.h:75
virtual void PaintControlBox(Int_t x, Int_t y, Double_t theta)
Paint the text control box.
Definition: TText.cxx:692
virtual void SetBBoxCenterY(const Int_t y)
Set Y coordinate of the point given by Alignment as 'center'.
Definition: TText.cxx:924
virtual TText * DrawText(Double_t x, Double_t y, const char *text)
Draw this text with new coordinates.
Definition: TText.cxx:176
@ kTextNDC
The text position is in the NDC space.
Definition: TText.h:33
void * fWcsTitle
!Used by TMathText
Definition: TText.h:28
Double_t fX
X position of text (left,center,etc..)
Definition: TText.h:26
virtual void PaintTextNDC(Double_t u, Double_t v, const char *text)
Draw this text with new coordinates in NDC.
Definition: TText.cxx:763
void Copy(TObject &text) const
Copy this text to text.
Definition: TText.cxx:108
virtual void SetBBoxY2(const Int_t y)
Set bottom of BoundingBox to a value (resize in y direction on bottom)
Definition: TText.cxx:959
virtual void PaintText(Double_t x, Double_t y, const char *text)
Draw this text with new coordinates.
Definition: TText.cxx:745
TText()
Text default constructor.
Definition: TText.cxx:60
virtual void GetTextExtent(UInt_t &w, UInt_t &h, const char *text) const
Return text extent for string text.
Definition: TText.cxx:588
virtual void GetTextAscentDescent(UInt_t &a, UInt_t &d, const char *text) const
Return text ascent and descent for string text.
Definition: TText.cxx:524
virtual void SetX(Double_t x)
Definition: TText.h:74
virtual void GetTextAdvance(UInt_t &a, const char *text, const Bool_t kern=kTRUE) const
Return text advance for string text if kern is true (default) kerning is taken into account.
Definition: TText.cxx:616
virtual void SetBBoxY1(const Int_t y)
Set top of BoundingBox to a value (resize in y direction on top)
Definition: TText.cxx:950
virtual void Print(Option_t *option="") const
Dump this text with its attributes.
Definition: TText.cxx:781
virtual void SetNDC(Bool_t isNDC=kTRUE)
Set NDC mode on if isNDC = kTRUE, off otherwise.
Definition: TText.cxx:814
virtual void GetControlBox(Int_t x, Int_t y, Double_t theta, Int_t cBoxX[4], Int_t cBoxY[4])
Return the text control box.
Definition: TText.cxx:424
virtual void SetBBoxX1(const Int_t x)
Set left hand side of BoundingBox to a value (resize in x direction on left)
Definition: TText.cxx:933
Double_t GetY() const
Definition: TText.h:59
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
Definition: TText.cxx:793
virtual void SetBBoxCenterX(const Int_t x)
Set X coordinate of the point given by Alignment as 'center'.
Definition: TText.cxx:916
virtual TText * DrawTextNDC(Double_t x, Double_t y, const char *text)
Draw this text with new coordinates in NDC.
Definition: TText.cxx:202
virtual void SetMbTitle(const wchar_t *title=L"")
Change (i.e. set) the title of the TNamed.
Definition: TText.cxx:823
virtual void SetBBoxCenter(const TPoint &p)
Set the point given by Alignment as 'center'.
Definition: TText.cxx:907
virtual void Paint(Option_t *option="")
Paint this text with its current attributes.
Definition: TText.cxx:681
virtual Rectangle_t GetBBox()
Return the "bounding Box" of the Box.
Definition: TText.cxx:864
TText * text
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17
static constexpr double L
auto * a
Definition: textangle.C:12