Logo ROOT   6.10/09
Reference Guide
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
TGTextLayout Class Reference

Definition at line 115 of file TGFont.h.

Public Member Functions

 TGTextLayout ()
 
virtual ~TGTextLayout ()
 destructor More...
 
Int_t CharBbox (Int_t index, Int_t *x, Int_t *y, Int_t *w, Int_t *h) const
 Use the information in the TGTextLayout token to return the bounding box for the character specified by index. More...
 
Int_t DistanceToText (Int_t x, Int_t y) const
 Computes the distance in pixels from the given point to the given text layout. More...
 
void DrawText (Drawable_t dst, GContext_t gc, Int_t x, Int_t y, Int_t firstChar, Int_t lastChar) const
 Use the information in the TGTextLayout object to display a multi-line, justified string of text. More...
 
Int_t IntersectText (Int_t x, Int_t y, Int_t w, Int_t h) const
 Determines whether a text layout lies entirely inside, entirely outside, or overlaps a given rectangle. More...
 
Int_t PointToChar (Int_t x, Int_t y) const
 Use the information in the TGTextLayout token to determine the character closest to the given point. More...
 
void ToPostscript (TString *dst) const
 Outputs the contents of a text layout in Postscript format. More...
 
void UnderlineChar (Drawable_t dst, GContext_t gc, Int_t x, Int_t y, Int_t underline) const
 Use the information in the TGTextLayout object to display an underline below an individual character. More...
 
- Public Member Functions inherited from TObject
 TObject ()
 TObject constructor. More...
 
 TObject (const TObject &object)
 TObject copy ctor. More...
 
virtual ~TObject ()
 TObject destructor. More...
 
void AbstractMethod (const char *method) const
 Use this method to implement an "abstract" method that you don't want to leave purely abstract. More...
 
virtual void AppendPad (Option_t *option="")
 Append graphics object to current pad. More...
 
virtual void Browse (TBrowser *b)
 Browse object. May be overridden for another default action. More...
 
virtual const char * ClassName () const
 Returns name of class to which the object belongs. More...
 
virtual void Clear (Option_t *="")
 
virtual TObjectClone (const char *newname="") const
 Make a clone of an object using the Streamer facility. More...
 
virtual Int_t Compare (const TObject *obj) const
 Compare abstract method. More...
 
virtual void Copy (TObject &object) const
 Copy this to obj. More...
 
virtual void Delete (Option_t *option="")
 Delete this object. More...
 
virtual Int_t DistancetoPrimitive (Int_t px, Int_t py)
 Computes distance from point (px,py) to the object. More...
 
virtual void Draw (Option_t *option="")
 Default Draw method for all objects. More...
 
virtual void DrawClass () const
 Draw class inheritance tree of the class to which this object belongs. More...
 
virtual TObjectDrawClone (Option_t *option="") const
 Draw a clone of this object in the current selected pad for instance with: gROOT->SetSelectedPad(gPad). More...
 
virtual void Dump () const
 Dump contents of object on stdout. More...
 
virtual void Error (const char *method, const char *msgfmt,...) const
 Issue error message. More...
 
virtual void Execute (const char *method, const char *params, Int_t *error=0)
 Execute method on this object with the given parameter string, e.g. More...
 
virtual void Execute (TMethod *method, TObjArray *params, Int_t *error=0)
 Execute method on this object with parameters stored in the TObjArray. More...
 
virtual void ExecuteEvent (Int_t event, Int_t px, Int_t py)
 Execute action corresponding to an event at (px,py). More...
 
virtual void Fatal (const char *method, const char *msgfmt,...) const
 Issue fatal error message. More...
 
virtual TObjectFindObject (const char *name) const
 Must be redefined in derived classes. More...
 
virtual TObjectFindObject (const TObject *obj) const
 Must be redefined in derived classes. More...
 
virtual Option_tGetDrawOption () const
 Get option used by the graphics system to draw this object. More...
 
virtual const char * GetIconName () const
 Returns mime type name of object. More...
 
virtual const char * GetName () const
 Returns name of object. More...
 
virtual char * GetObjectInfo (Int_t px, Int_t py) const
 Returns string containing info about the object at position (px,py). More...
 
virtual Option_tGetOption () const
 
virtual const char * GetTitle () const
 Returns title of object. More...
 
virtual UInt_t GetUniqueID () const
 Return the unique object id. More...
 
virtual Bool_t HandleTimer (TTimer *timer)
 Execute action in response of a timer timing out. More...
 
virtual ULong_t Hash () const
 Return hash value for this object. More...
 
virtual void Info (const char *method, const char *msgfmt,...) const
 Issue info message. More...
 
virtual Bool_t InheritsFrom (const char *classname) const
 Returns kTRUE if object inherits from class "classname". More...
 
virtual Bool_t InheritsFrom (const TClass *cl) const
 Returns kTRUE if object inherits from TClass cl. More...
 
virtual void Inspect () const
 Dump contents of this object in a graphics canvas. More...
 
void InvertBit (UInt_t f)
 
virtual Bool_t IsEqual (const TObject *obj) const
 Default equal comparison (objects are equal if they have the same address in memory). More...
 
virtual Bool_t IsFolder () const
 Returns kTRUE in case object contains browsable objects (like containers or lists of other objects). More...
 
Bool_t IsOnHeap () const
 
virtual Bool_t IsSortable () const
 
Bool_t IsZombie () const
 
virtual void ls (Option_t *option="") const
 The ls function lists the contents of a class on stdout. More...
 
void MayNotUse (const char *method) const
 Use this method to signal that a method (defined in a base class) may not be called in a derived class (in principle against good design since a child class should not provide less functionality than its parent, however, sometimes it is necessary). More...
 
virtual Bool_t Notify ()
 This method must be overridden to handle object notification. More...
 
void Obsolete (const char *method, const char *asOfVers, const char *removedFromVers) const
 Use this method to declare a method obsolete. More...
 
void operator delete (void *ptr)
 Operator delete. More...
 
void operator delete[] (void *ptr)
 Operator delete []. More...
 
voidoperator new (size_t sz)
 
voidoperator new (size_t sz, void *vp)
 
voidoperator new[] (size_t sz)
 
voidoperator new[] (size_t sz, void *vp)
 
TObjectoperator= (const TObject &rhs)
 TObject assignment operator. More...
 
virtual void Paint (Option_t *option="")
 This method must be overridden if a class wants to paint itself. More...
 
virtual void Pop ()
 Pop on object drawn in a pad to the top of the display list. More...
 
virtual void Print (Option_t *option="") const
 This method must be overridden when a class wants to print itself. More...
 
virtual Int_t Read (const char *name)
 Read contents of object with specified name from the current directory. More...
 
virtual void RecursiveRemove (TObject *obj)
 Recursively remove this object from a list. More...
 
void ResetBit (UInt_t f)
 
virtual void SaveAs (const char *filename="", Option_t *option="") const
 Save this object in the file specified by filename. More...
 
virtual void SavePrimitive (std::ostream &out, Option_t *option="")
 Save a primitive as a C++ statement(s) on output stream "out". More...
 
void SetBit (UInt_t f, Bool_t set)
 Set or unset the user status bits as specified in f. More...
 
void SetBit (UInt_t f)
 
virtual void SetDrawOption (Option_t *option="")
 Set drawing option for object. More...
 
virtual void SetUniqueID (UInt_t uid)
 Set the unique object id. More...
 
virtual void SysError (const char *method, const char *msgfmt,...) const
 Issue system error message. More...
 
Bool_t TestBit (UInt_t f) const
 
Int_t TestBits (UInt_t f) const
 
virtual void UseCurrentStyle ()
 Set current style settings in this object This function is called when either TCanvas::UseCurrentStyle or TROOT::ForceStyle have been invoked. More...
 
virtual void Warning (const char *method, const char *msgfmt,...) const
 Issue warning message. More...
 
virtual Int_t Write (const char *name=0, Int_t option=0, Int_t bufsize=0)
 Write this object to the current directory. More...
 
virtual Int_t Write (const char *name=0, Int_t option=0, Int_t bufsize=0) const
 Write this object to the current directory. More...
 

Protected Member Functions

 TGTextLayout (const TGTextLayout &tlayout)
 
void operator= (const TGTextLayout &tlayout)
 
- Protected Member Functions inherited from TObject
virtual void DoError (int level, const char *location, const char *fmt, va_list va) const
 Interface to ErrorHandler (protected). More...
 
void MakeZombie ()
 

Protected Attributes

LayoutChunk_t * fChunks
 
const TGFontfFont
 
Int_t fNumChunks
 
const char * fString
 
Int_t fWidth
 

Friends

class TGFont
 

Additional Inherited Members

- Public Types inherited from TObject
enum  { kIsOnHeap = 0x01000000, kNotDeleted = 0x02000000, kZombie = 0x04000000, kBitMask = 0x00ffffff }
 
enum  { kSingleKey = BIT(0), kOverwrite = BIT(1), kWriteDelete = BIT(2) }
 
enum  EStatusBits {
  kCanDelete = BIT(0), kMustCleanup = BIT(3), kObjInCanvas = BIT(3), kIsReferenced = BIT(4),
  kHasUUID = BIT(5), kCannotPick = BIT(6), kNoContextMenu = BIT(8), kInvalidObject = BIT(13)
}
 
- Static Public Member Functions inherited from TObject
static Long_t GetDtorOnly ()
 Return destructor only flag. More...
 
static Bool_t GetObjectStat ()
 Get status of object stat flag. More...
 
static void SetDtorOnly (void *obj)
 Set destructor only flag. More...
 
static void SetObjectStat (Bool_t stat)
 Turn on/off tracking of objects in the TObjectTable. More...
 

#include <TGFont.h>

Inheritance diagram for TGTextLayout:
[legend]

Constructor & Destructor Documentation

◆ TGTextLayout() [1/2]

TGTextLayout::TGTextLayout ( const TGTextLayout tlayout)
protected

◆ TGTextLayout() [2/2]

TGTextLayout::TGTextLayout ( )
inline

Definition at line 130 of file TGFont.h.

◆ ~TGTextLayout()

TGTextLayout::~TGTextLayout ( )
virtual

destructor

Definition at line 885 of file TGFont.cxx.

Member Function Documentation

◆ CharBbox()

Int_t TGTextLayout::CharBbox ( Int_t  index,
Int_t x,
Int_t y,
Int_t w,
Int_t h 
) const

Use the information in the TGTextLayout token to return the bounding box for the character specified by index.

The width of the bounding box is the advance width of the character, and does not include and left- or right-bearing. Any character that extends partially outside of the text layout is considered to be truncated at the edge. Any character which is located completely outside of the text layout is considered to be zero-width and pegged against the edge.

The height of the bounding box is the line height for this font, extending from the top of the ascent to the bottom of the descent. Information about the actual height of the individual letter is not available.

A text layout that contains no characters is considered to contain a single zero-width placeholder character.

The return value is 0 if the index did not specify a character in the text layout, or non-zero otherwise. In that case, *bbox is filled with the bounding box of the character.

layout – Layout information, from a previous call to ComputeTextLayout(). index – The index of the character whose bbox is desired. x, y – Filled with the upper-left hand corner, in pixels, of the bounding box for the character specified by index, if non-NULL. w, h – Filled with the width and height of the bounding box for the character specified by index, if non-NULL.

Definition at line 1094 of file TGFont.cxx.

◆ DistanceToText()

Int_t TGTextLayout::DistanceToText ( Int_t  x,
Int_t  y 
) const

Computes the distance in pixels from the given point to the given text layout.

Non-displaying space characters that occur at the end of individual lines in the text layout are ignored for hit detection purposes.

The return value is 0 if the point (x, y) is inside the text layout. If the point isn't inside the text layout then the return value is the distance in pixels from the point to the text item.

x, y – Coordinates of point to check, with respect to the upper-left corner of the text layout (in pixels).

Definition at line 1176 of file TGFont.cxx.

◆ DrawText()

void TGTextLayout::DrawText ( Drawable_t  dst,
GContext_t  gc,
Int_t  x,
Int_t  y,
Int_t  firstChar,
Int_t  lastChar 
) const

Use the information in the TGTextLayout object to display a multi-line, justified string of text.

This procedure is useful for simple widgets that need to display single-font, multi-line text and want TGFont to handle the details.

dst – Window or pixmap in which to draw. gc – Graphics context to use for drawing text. x, y – Upper-left hand corner of rectangle in which to draw (pixels). firstChar – The index of the first character to draw from the given text item. 0 specfies the beginning. lastChar – The index just after the last character to draw from the given text item. A number < 0 means to draw all characters.

Definition at line 908 of file TGFont.cxx.

◆ IntersectText()

Int_t TGTextLayout::IntersectText ( Int_t  x,
Int_t  y,
Int_t  w,
Int_t  h 
) const

Determines whether a text layout lies entirely inside, entirely outside, or overlaps a given rectangle.

Non-displaying space characters that occur at the end of individual lines in the text layout are ignored for intersection calculations.

The return value is -1 if the text layout is entirely outside of the rectangle, 0 if it overlaps, and 1 if it is entirely inside of the rectangle.

x, y – Upper-left hand corner, in pixels, of rectangular area to compare with text layout. Coordinates are with respect to the upper-left hand corner of the text layout itself. w, h – The width and height of the above rectangular area, in pixels.

Definition at line 1242 of file TGFont.cxx.

◆ operator=()

void TGTextLayout::operator= ( const TGTextLayout tlayout)
protected

◆ PointToChar()

Int_t TGTextLayout::PointToChar ( Int_t  x,
Int_t  y 
) const

Use the information in the TGTextLayout token to determine the character closest to the given point.

The point must be specified with respect to the upper-left hand corner of the text layout, which is considered to be located at (0, 0).

Any point whose y-value is less that 0 will be considered closest to the first character in the text layout; any point whose y-value is greater than the height of the text layout will be considered closest to the last character in the text layout.

Any point whose x-value is less than 0 will be considered closest to the first character on that line; any point whose x-value is greater than the width of the text layout will be considered closest to the last character on that line.

The return value is the index of the character that was closest to the point. Given a text layout with no characters, the value 0 will always be returned, referring to a hypothetical zero-width placeholder character.

Definition at line 988 of file TGFont.cxx.

◆ ToPostscript()

void TGTextLayout::ToPostscript ( TString result) const

Outputs the contents of a text layout in Postscript format.

The set of lines in the text layout will be rendered by the user supplied Postscript function. The function should be of the form:

justify x y string  function  --

Justify is -1, 0, or 1, depending on whether the following string should be left, center, or right justified, x and y is the location for the origin of the string, string is the sequence of characters to be printed, and function is the name of the caller-provided function; the function should leave nothing on the stack.

The meaning of the origin of the string (x and y) depends on the justification. For left justification, x is where the left edge of the string should appear. For center justification, x is where the center of the string should appear. And for right justification, x is where the right edge of the string should appear. This behavior is necessary because, for example, right justified text on the screen is justified with screen metrics. The same string needs to be justified with printer metrics on the printer to appear in the correct place with respect to other similarly justified strings. In all circumstances, y is the location of the baseline for the string.

result is modified to hold the Postscript code that will render the text layout.

Definition at line 1319 of file TGFont.cxx.

◆ UnderlineChar()

void TGTextLayout::UnderlineChar ( Drawable_t  dst,
GContext_t  gc,
Int_t  x,
Int_t  y,
Int_t  underline 
) const

Use the information in the TGTextLayout object to display an underline below an individual character.

This procedure does not draw the text, just the underline.

This procedure is useful for simple widgets that need to display single-font, multi-line text with an individual character underlined and want TGFont to handle the details. To display larger amounts of underlined text, construct and use an underlined font.

dst – Window or pixmap in which to draw. gc – Graphics context to use for drawing text. x, y – Upper-left hand corner of rectangle in which to draw (pixels). underline – Index of the single character to underline, or -1 for no underline.

Definition at line 955 of file TGFont.cxx.

Friends And Related Function Documentation

◆ TGFont

friend class TGFont
friend

Definition at line 117 of file TGFont.h.

Member Data Documentation

◆ fChunks

LayoutChunk_t* TGTextLayout::fChunks
protected

Definition at line 124 of file TGFont.h.

◆ fFont

const TGFont* TGTextLayout::fFont
protected

Definition at line 120 of file TGFont.h.

◆ fNumChunks

Int_t TGTextLayout::fNumChunks
protected

Definition at line 123 of file TGFont.h.

◆ fString

const char* TGTextLayout::fString
protected

Definition at line 121 of file TGFont.h.

◆ fWidth

Int_t TGTextLayout::fWidth
protected

Definition at line 122 of file TGFont.h.


The documentation for this class was generated from the following files: