library: libGraf #include "TText.h"

# TText

class description - source file - inheritance tree (.ps)

## class TText : public TNamed, public TAttText

| Inheritance Chart:

`TObject`

<-

`TNamed`

`TAttText`

<-

`TText`

<-

`TLatex` |

`TLink` |

        public:

                          TText()
                          TText(Double_t x, Double_t y, const char* text)
                          TText(const TText& text)
                  virtual ~TText()
           static TClass* Class()
             virtual void Copy(TObject& text) const
            virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
           virtual TText* DrawText(Double_t x, Double_t y, const char* text)
           virtual TText* DrawTextNDC(Double_t x, Double_t y, const char* text)
             virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
             virtual void GetBoundingBox(UInt_t& w, UInt_t& h)
             virtual void GetControlBox(Int_t x, Int_t y, Double_t theta, Int_t* cBoxX, Int_t* cBoxY)
             virtual void GetTextExtent(UInt_t& w, UInt_t& h, const char* text) const
                 Double_t GetX() const
                 Double_t GetY() const
          virtual TClass* IsA() const
             virtual void ls(Option_t* option) const
                   TText& operator=(const TText&)
             virtual void Paint(Option_t* option)
             virtual void PaintControlBox(Int_t x, Int_t y, Double_t theta)
             virtual void PaintText(Double_t x, Double_t y, const char* text)
             virtual void PaintTextNDC(Double_t u, Double_t v, const char* text)
             virtual void Print(Option_t* option) const
             virtual void SavePrimitive(ofstream& out, Option_t* option)
             virtual void SetNDC(Bool_t isNDC = kTRUE)
             virtual void SetText(Double_t x, Double_t y, const char* text)
             virtual void SetX(Double_t x)
             virtual void SetY(Double_t y)
             virtual void ShowMembers(TMemberInspector& insp, char* parent)
             virtual void Streamer(TBuffer& b)
                     void StreamerNVirtual(TBuffer& b)

### Data Members

        protected:

          Double_t fX  X position of text (left,center,etc..)
          Double_t fY  Y position of text (left,center,etc..)

        public:

          static const enum TText:: kTextNDC

## Class Description

       TText is the base class for several text objects.
       See TAttText for a list of text attributes or fonts,
       and also for a discussion on text speed and font quality.

      By default, the text is drawn in the pad coordinates system.
      One can draw in NDC coordinates [0,1] if the function SetNDC
      is called for a TText object.

TText(): TNamed(), TAttText()

    *-*-*-*-*-*-*-*-*-*-*Text default constructor*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
    *-*                  ========================

TText(Double_t x, Double_t y, const char *text) : TNamed("",text), TAttText()

    *-*-*-*-*-*-*-*-*-*-*Text normal constructor*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
    *-*                  =======================

~TText()

    *-*-*-*-*-*-*-*-*-*-*Text default destructor*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
    *-*                  =======================

TText(const TText &text) : TNamed(text), TAttText(text)

void Copy(TObject &obj) const

    *-*-*-*-*-*-*-*-*-*-*Copy this text to text*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
    *-*                  ======================

Int_t DistancetoPrimitive(Int_t px, Int_t py)

     Compute distance from point px,py to a string.
     The rectangle surrounding this string is evaluated.
     If the point (px,py) is in the rectangle, the distance is set to zero.

TText* DrawText(Double_t x, Double_t y, const char *text)

    *-*-*-*-*-*-*-*-*-*-*Draw this text with new coordinates*-*-*-*-*-*-*-*-*-*
    *-*                  ===================================

TText* DrawTextNDC(Double_t x, Double_t y, const char *text)

    *-*-*-*-*-*-*-*-*-*-*Draw this text with new coordinates in NDC*-*-*-*-*-*
    *-*                  ==========================================

void ExecuteEvent(Int_t event, Int_t px, Int_t py)

    *-*-*-*-*-*-*-*-*-*-*Execute action corresponding to one event*-*-*-*
    *-*                  =========================================
      This member function must be implemented to realize the action
      corresponding to the mouse click on the object in the window

void GetControlBox(Int_t x, Int_t y, Double_t theta, Int_t CBoxX[4], Int_t CBoxY[4])

     Return the text control box. The text position coordinates is (x,y) and
     the text angle is theta. The control box coordinates are returned in CBoxX
     and CBoxY.

void GetBoundingBox(UInt_t &w, UInt_t &h)

     Return text size in pixels

void GetTextExtent(UInt_t &w, UInt_t &h, const char *text) const

     Return text extent for string text
      in w return total text width
      in h return text height

void ls(Option_t *) const

    *-*-*-*-*-*-*-*-*-*-*-*List this text with its attributes*-*-*-*-*-*-*-*-*
    *-*                    ==================================

void Paint(Option_t *)

    *-*-*-*-*-*-*-*-*-*-*Paint this text with its current attributes*-*-*-*-*-*-*
    *-*                  ===========================================

void PaintControlBox(Int_t x, Int_t y, Double_t theta)

     Paint the text control box. (x,y) are the coordinates where the control
     box should be painted and theta is the angle of the box.

void PaintText(Double_t x, Double_t y, const char *text)

    *-*-*-*-*-*-*-*-*-*-*Draw this text with new coordinates*-*-*-*-*-*-*-*-*-*
    *-*                  ===================================

void PaintTextNDC(Double_t u, Double_t v, const char *text)

    *-*-*-*-*-*-*-*-*-*-*Draw this text with new coordinates in NDC*-*-*-*-*-*-*
    *-*                  ==========================================

void Print(Option_t *) const

    *-*-*-*-*-*-*-*-*-*-*Dump this text with its attributes*-*-*-*-*-*-*-*-*-*
    *-*                  ==================================

void SavePrimitive(ofstream &out, Option_t *)

     Save primitive as a C++ statement(s) on output stream out

void SetNDC(Bool_t isNDC)

     Set NDC mode on if isNDC = kTRUE, off otherwise

void Streamer(TBuffer &R__b)

     Stream an object of class TText.

### Inline Functions

               Double_t GetX() const
               Double_t GetY() const
                   void SetText(Double_t x, Double_t y, const char* text)
                   void SetX(Double_t x)
                   void SetY(Double_t y)
                TClass* Class()
                TClass* IsA() const
                   void ShowMembers(TMemberInspector& insp, char* parent)
                   void StreamerNVirtual(TBuffer& b)
                 TText& operator=(const TText&)

Author: Nicolas Brun 12/12/94
Last update: root/graf:$Name: $:$Id: TText.cxx,v 1.17 2003/10/23 09:36:25 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *