ROOT  6.06/09
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 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TText //
19 // //
20 // Text. //
21 // //
22 //////////////////////////////////////////////////////////////////////////
23 
24 
25 #ifndef ROOT_TAttText
26 #include "TAttText.h"
27 #endif
28 #ifndef ROOT_TNamed
29 #include "TNamed.h"
30 #endif
31 #ifndef ROOT_TAttBBox2D
32 #include "TAttBBox2D.h"
33 #endif
34 #ifndef ROOT_TPoint
35 #include "TPoint.h"
36 #endif
37 #ifndef ROOT_GuiTypes
38 #include "GuiTypes.h"
39 #endif
40 
41 
42 class TText : public TNamed, public TAttText, public TAttBBox2D {
43 
44 protected:
45  Double_t fX; // X position of text (left,center,etc..)
46  Double_t fY; // Y position of text (left,center,etc..)
47  void *fWcsTitle; //!Used by TMathText
48 
49 public:
50  // TText status bits
51  enum { kTextNDC = BIT(14) };
52 
53  TText();
54  TText(Double_t x, Double_t y, const char *text);
55  TText(Double_t x, Double_t y, const wchar_t *text);
56  TText(const TText &text);
57  virtual ~TText();
58  void Copy(TObject &text) const;
59  virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
60  virtual TText *DrawText(Double_t x, Double_t y, const char *text);
61  virtual TText *DrawText(Double_t x, Double_t y, const wchar_t *text);
62  virtual TText *DrawTextNDC(Double_t x, Double_t y, const char *text);
63  virtual TText *DrawTextNDC(Double_t x, Double_t y, const wchar_t *text);
64  virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
65 
66  virtual void GetControlBox(Int_t x, Int_t y, Double_t theta,
67  Int_t cBoxX[4], Int_t cBoxY[4]);
68  Double_t GetX() const { return fX; }
69  virtual void GetBoundingBox(UInt_t &w, UInt_t &h, Bool_t angle = kFALSE);
70  virtual void GetTextAscentDescent(UInt_t &a, UInt_t &d, const char *text) const;
71  virtual void GetTextAscentDescent(UInt_t &a, UInt_t &d, const wchar_t *text) const;
72  virtual void GetTextExtent(UInt_t &w, UInt_t &h, const char *text) const;
73  virtual void GetTextExtent(UInt_t &w, UInt_t &h, const wchar_t *text) const;
74  virtual void GetTextAdvance(UInt_t &a, const char *text, const Bool_t kern=kTRUE) const;
75  const void * GetWcsTitle(void) const;
76  Double_t GetY() const { return fY; }
77 
78  virtual void ls(Option_t *option="") const;
79  virtual void Paint(Option_t *option="");
80  virtual void PaintControlBox(Int_t x, Int_t y, Double_t theta);
81  virtual void PaintText(Double_t x, Double_t y, const char *text);
82  virtual void PaintText(Double_t x, Double_t y, const wchar_t *text);
83  virtual void PaintTextNDC(Double_t u, Double_t v, const char *text);
84  virtual void PaintTextNDC(Double_t u, Double_t v, const wchar_t *text);
85  virtual void Print(Option_t *option="") const;
86  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
87  virtual void SetMbTitle(const wchar_t *title=L""); // *MENU*
88  virtual void SetNDC(Bool_t isNDC=kTRUE);
89  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}
90  virtual void SetText(Double_t x, Double_t y, const wchar_t *text) {fX=x; fY=y; SetMbTitle(text);}
91  virtual void SetX(Double_t x) { fX = x; } // *MENU*
92  virtual void SetY(Double_t y) { fY = y; } // *MENU*
93 
94  virtual Rectangle_t GetBBox();
95  virtual TPoint GetBBoxCenter();
96  virtual void SetBBoxCenter(const TPoint &p);
97  virtual void SetBBoxCenterX(const Int_t x);
98  virtual void SetBBoxCenterY(const Int_t y);
99  virtual void SetBBoxX1(const Int_t x); //Not Implemented
100  virtual void SetBBoxX2(const Int_t x); //Not Implemented
101  virtual void SetBBoxY1(const Int_t y); //Not Implemented
102  virtual void SetBBoxY2(const Int_t y); //Not Implemented
103 
104  ClassDef(TText,3) //Text
105 };
106 
107 #endif
virtual void SetBBoxCenterY(const Int_t y)
Set Y coordinate of the point given by Alignment as 'center'.
Definition: TText.cxx:919
ClassDef(TAttBBox2D, 0)
const char Option_t
Definition: RtypesCore.h:62
RooArgList L(const RooAbsArg &v1)
virtual void SetMbTitle(const wchar_t *title=L"")
Change (i.e. set) the title of the TNamed.
Definition: TText.cxx:818
virtual void SetX(Double_t x)
Definition: TText.h:91
#define BIT(n)
Definition: Rtypes.h:120
TH1 * h
Definition: legend2.C:5
Double_t GetY() const
Definition: TText.h:76
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:419
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TArc * a
Definition: textangle.C:12
const Bool_t kFALSE
Definition: Rtypes.h:92
virtual void Paint(Option_t *option="")
Paint this text with its current attributes.
Definition: TText.cxx:676
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
Definition: TText.cxx:788
virtual void PaintTextNDC(Double_t u, Double_t v, const char *text)
Draw this text with new coordinates in NDC.
Definition: TText.cxx:758
virtual ~TText()
Text default destructor.
Definition: TText.cxx:89
virtual void SetBBoxY1(const Int_t y)
Set top of BoundingBox to a value (resize in y direction on top)
Definition: TText.cxx:945
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:937
virtual TPoint GetBBoxCenter()
Return the point given by Alignment as 'center'.
Definition: TText.cxx:891
Double_t x[n]
Definition: legend1.C:17
virtual void SetText(Double_t x, Double_t y, const char *text)
Definition: TText.h:89
virtual void Print(Option_t *option="") const
Dump this text with its attributes.
Definition: TText.cxx:776
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:33
virtual TText * DrawTextNDC(Double_t x, Double_t y, const char *text)
Draw this text with new coordinates in NDC.
Definition: TText.cxx:197
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:928
virtual void GetTextAscentDescent(UInt_t &a, UInt_t &d, const char *text) const
Return text ascent and descent for string text.
Definition: TText.cxx:519
virtual void PaintControlBox(Int_t x, Int_t y, Double_t theta)
Paint the text control box.
Definition: TText.cxx:687
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute distance from point px,py to a string.
Definition: TText.cxx:140
virtual void ls(Option_t *option="") const
List this text with its attributes.
Definition: TText.cxx:667
Base class for several text objects.
Definition: TText.h:42
virtual void SetNDC(Bool_t isNDC=kTRUE)
Set NDC mode on if isNDC = kTRUE, off otherwise.
Definition: TText.cxx:809
char * out
Definition: TBase64.cxx:29
virtual void SetText(Double_t x, Double_t y, const wchar_t *text)
Definition: TText.h:90
Definition: TPoint.h:33
virtual void SetBBoxY2(const Int_t y)
Set bottom of BoundingBox to a value (resize in y direction on bottom)
Definition: TText.cxx:954
virtual Rectangle_t GetBBox()
Return the "bounding Box" of the Box.
Definition: TText.cxx:859
SVector< double, 2 > v
Definition: Dict.h:5
void Copy(TObject &text) const
Copy this text to text.
Definition: TText.cxx:107
Text Attributes class.
Definition: TAttText.h:32
Double_t fY
Definition: TText.h:46
unsigned int UInt_t
Definition: RtypesCore.h:42
virtual void GetTextExtent(UInt_t &w, UInt_t &h, const char *text) const
Return text extent for string text.
Definition: TText.cxx:583
double Double_t
Definition: RtypesCore.h:55
TText * text
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to one event.
Definition: TText.cxx:220
Double_t y[n]
Definition: legend1.C:17
Mother of all ROOT objects.
Definition: TObject.h:58
void * fWcsTitle
Definition: TText.h:47
virtual void SetBBoxCenter(const TPoint &p)
Set the point given by Alignment as 'center'.
Definition: TText.cxx:902
Abstract base class for elements drawn in the editor.
Definition: TAttBBox2D.h:23
virtual void SetBBoxCenterX(const Int_t x)
Set X coordinate of the point given by Alignment as 'center'.
Definition: TText.cxx:911
virtual TText * DrawText(Double_t x, Double_t y, const char *text)
Draw this text with new coordinates.
Definition: TText.cxx:171
virtual void SetY(Double_t y)
Definition: TText.h:92
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:611
const Bool_t kTRUE
Definition: Rtypes.h:91
virtual void SetTitle(const char *title="")
Change (i.e. set) the title of the TNamed.
Definition: TNamed.cxx:152
virtual void PaintText(Double_t x, Double_t y, const char *text)
Draw this text with new coordinates.
Definition: TText.cxx:740
Double_t GetX() const
Definition: TText.h:68
Double_t fX
Definition: TText.h:45
virtual void GetBoundingBox(UInt_t &w, UInt_t &h, Bool_t angle=kFALSE)
Return text size in pixels.
Definition: TText.cxx:469
const void * GetWcsTitle(void) const
Returns the text as UNICODE.
Definition: TText.cxx:126