Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
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
20class TPoint;
21
22class TText : public TNamed, public TAttText, public TAttBBox2D {
23
24protected:
25 Double_t fX{0}; ///< X position of text (left,center,etc..)
26 Double_t fY{0}; ///< Y position of text (left,center,etc..)
27 void *fWcsTitle{nullptr}; ///<!Used by TMathText
28
29public:
30 // TText status bits
31 enum {
32 kTextNDC = BIT(14) ///< The text position is in the NDC space
33 };
34
35 TText() {} // NOLINT: not allowed to use = default because of TObject::kIsOnHeap detection, see ROOT-10300
36 TText(Double_t x, Double_t y, const char *text);
37 TText(Double_t x, Double_t y, const wchar_t *text);
38 TText(const TText &text);
39 ~TText() override;
40
41 TText &operator=(const TText &src);
42
43 void Copy(TObject &text) const override;
45 virtual TText *DrawText(Double_t x, Double_t y, const char *text);
46 virtual TText *DrawText(Double_t x, Double_t y, const wchar_t *text);
47 virtual TText *DrawTextNDC(Double_t x, Double_t y, const char *text);
48 virtual TText *DrawTextNDC(Double_t x, Double_t y, const wchar_t *text);
49 void ExecuteEvent(Int_t event, Int_t px, Int_t py) override;
50
51 virtual void GetControlBox(Int_t x, Int_t y, Double_t theta,
52 Int_t cBoxX[4], Int_t cBoxY[4]);
53 Double_t GetX() const { return fX; }
54 virtual void GetBoundingBox(UInt_t &w, UInt_t &h, Bool_t angle = kFALSE);
55 virtual void GetTextAscentDescent(UInt_t &a, UInt_t &d, const char *text) const;
56 virtual void GetTextAscentDescent(UInt_t &a, UInt_t &d, const wchar_t *text) const;
57 virtual void GetTextExtent(UInt_t &w, UInt_t &h, const char *text) const;
58 virtual void GetTextExtent(UInt_t &w, UInt_t &h, const wchar_t *text) const;
59 virtual void GetTextAdvance(UInt_t &a, const char *text, const Bool_t kern=kTRUE) const;
60 const void * GetWcsTitle(void) const;
61 Double_t GetY() const { return fY; }
62
63 void ls(Option_t *option="") const override;
64 void Paint(Option_t *option="") override;
65 virtual void PaintControlBox(Int_t x, Int_t y, Double_t theta);
66 virtual void PaintText(Double_t x, Double_t y, const char *text);
67 virtual void PaintText(Double_t x, Double_t y, const wchar_t *text);
68 virtual void PaintTextNDC(Double_t u, Double_t v, const char *text);
69 virtual void PaintTextNDC(Double_t u, Double_t v, const wchar_t *text);
70 void Print(Option_t *option="") const override;
71 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
72 virtual void SetMbTitle(const wchar_t *title=L"");
73 virtual void SetNDC(Bool_t isNDC=kTRUE);
74 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}
75 virtual void SetText(Double_t x, Double_t y, const wchar_t *text) {fX=x; fY=y; SetMbTitle(text);}
76 virtual void SetX(Double_t x) { fX = x; } // *MENU*
77 virtual void SetY(Double_t y) { fY = y; } // *MENU*
78
79 Rectangle_t GetBBox() override;
81 void SetBBoxCenter(const TPoint &p) override;
82 void SetBBoxCenterX(const Int_t x) override;
83 void SetBBoxCenterY(const Int_t y) override;
84 void SetBBoxX1(const Int_t) override; //Not Implemented
85 void SetBBoxX2(const Int_t) override; //Not Implemented
86 void SetBBoxY1(const Int_t) override; //Not Implemented
87 void SetBBoxY2(const Int_t) override; //Not Implemented
88
90};
91
92#endif
#define d(i)
Definition RSha256.hxx:102
#define a(i)
Definition RSha256.hxx:99
#define h(i)
Definition RSha256.hxx:106
int Int_t
Signed integer 4 bytes (int).
Definition RtypesCore.h:59
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
Definition RtypesCore.h:60
bool Bool_t
Boolean (0=false, 1=true) (bool).
Definition RtypesCore.h:77
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
double Double_t
Double 8 bytes.
Definition RtypesCore.h:73
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
const char Option_t
Option string (const char).
Definition RtypesCore.h:80
#define BIT(n)
Definition Rtypes.h:91
#define ClassDefOverride(name, id)
Definition Rtypes.h:348
Abstract base class for elements drawn in the editor.
Definition TAttBBox2D.h:19
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition TNamed.cxx:173
TNamed()
Definition TNamed.h:38
TObject()
TObject constructor.
Definition TObject.h:259
virtual void GetControlBox(Int_t x, Int_t y, Double_t theta, Int_t cBoxX[4], Int_t cBoxY[4])
virtual void SetText(Double_t x, Double_t y, const char *text)
Definition TText.h:74
TText(Double_t x, Double_t y, const char *text)
virtual void GetTextAdvance(UInt_t &a, const char *text, const Bool_t kern=kTRUE) const
Double_t fY
Y position of text (left,center,etc..).
Definition TText.h:26
const void * GetWcsTitle(void) const
void SetBBoxCenter(const TPoint &p) override
Rectangle_t GetBBox() override
void Copy(TObject &text) const override
Copy this to obj.
TText & operator=(const TText &src)
TText(Double_t x, Double_t y, const wchar_t *text)
virtual void PaintTextNDC(Double_t u, Double_t v, const char *text)
virtual void SetText(Double_t x, Double_t y, const wchar_t *text)
Definition TText.h:75
TText(const TText &text)
virtual void SetNDC(Bool_t isNDC=kTRUE)
virtual void PaintText(Double_t x, Double_t y, const char *text)
virtual void GetTextExtent(UInt_t &w, UInt_t &h, const char *text) const
virtual TText * DrawText(Double_t x, Double_t y, const wchar_t *text)
Double_t GetX() const
Definition TText.h:53
virtual void SetY(Double_t y)
Definition TText.h:77
virtual void GetTextAscentDescent(UInt_t &a, UInt_t &d, const wchar_t *text) const
virtual void SetMbTitle(const wchar_t *title=L"")
void * fWcsTitle
!Used by TMathText
Definition TText.h:27
Double_t fX
X position of text (left,center,etc..).
Definition TText.h:25
~TText() override
virtual void GetTextAscentDescent(UInt_t &a, UInt_t &d, const char *text) const
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
virtual void PaintText(Double_t x, Double_t y, const wchar_t *text)
void ls(Option_t *option="") const override
List TNamed name and title.
virtual void GetBoundingBox(UInt_t &w, UInt_t &h, Bool_t angle=kFALSE)
TText()
Definition TText.h:35
virtual TText * DrawTextNDC(Double_t x, Double_t y, const wchar_t *text)
virtual TText * DrawTextNDC(Double_t x, Double_t y, const char *text)
void SetBBoxY2(const Int_t) override
virtual void PaintControlBox(Int_t x, Int_t y, Double_t theta)
@ kTextNDC
The text position is in the NDC space.
Definition TText.h:32
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Computes distance from point (px,py) to the object.
TPoint GetBBoxCenter() override
virtual void SetX(Double_t x)
Definition TText.h:76
void Paint(Option_t *option="") override
This method must be overridden if a class wants to paint itself.
void SetBBoxCenterY(const Int_t y) override
void Print(Option_t *option="") const override
Print TNamed name and title.
virtual void PaintTextNDC(Double_t u, Double_t v, const wchar_t *text)
void SetBBoxY1(const Int_t) override
void SetBBoxX2(const Int_t) override
void SetBBoxCenterX(const Int_t x) override
Double_t GetY() const
Definition TText.h:61
virtual TText * DrawText(Double_t x, Double_t y, const char *text)
void SetBBoxX1(const Int_t) override
virtual void GetTextExtent(UInt_t &w, UInt_t &h, const wchar_t *text) const
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Execute action corresponding to an event at (px,py).
TText * text
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
Rectangle structure (maps to the X11 XRectangle structure).
Definition GuiTypes.h:362