library: libGui #include "TGLabel.h"

# TGLabel

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

## class TGLabel : public TGFrame

| Inheritance Chart:
`TObject`
| <- | `TGObject`
| <- | `TGWindow`
`TQObject`
| <- | `TGFrame`
| <- | `TGLabel` |

        protected:

          virtual void DoRedraw()

        public:

                              TGLabel(const TGWindow* p, TGString* text, GContext_t norm = GetDefaultGC()(), FontStruct_t font = GetDefaultFontStruct(), UInt_t options = kChildFrame, Pixel_t back = GetDefaultFrameBackground())
                              TGLabel(const TGWindow* p = 0, const char* text = "0", GContext_t norm = GetDefaultGC()(), FontStruct_t font = GetDefaultFontStruct(), UInt_t options = kChildFrame, Pixel_t back = GetDefaultFrameBackground())
                              TGLabel(const TGLabel&)
                      virtual ~TGLabel()
               static TClass* Class()
                 virtual void Disable()
                 virtual void Enable()
          static FontStruct_t GetDefaultFontStruct()
           static const TGGC& GetDefaultGC() const
          virtual TGDimension GetDefaultSize() const
              const TGString* GetText() const
          virtual const char* GetTitle() const
                       Bool_t HasOwnFont() const
              virtual TClass* IsA() const
                       Bool_t IsDisabled() const
                 virtual void SavePrimitive(ofstream& out, Option_t* option)
                 virtual void SetForegroundColor(Pixel_t fore)
                 virtual void SetText(TGString* newText)
                         void SetText(const char* newText)
                         void SetText(Int_t number)
                 virtual void SetTextColor(Pixel_t color, Bool_t global = kFALSE)
                 virtual void SetTextColor(TColor* color, Bool_t global = kFALSE)
                 virtual void SetTextFont(TGFont* font, Bool_t global = kFALSE)
                 virtual void SetTextFont(FontStruct_t font, Bool_t global = kFALSE)
                 virtual void SetTextFont(const char* fontName, Bool_t global = kFALSE)
                         void SetTextJustify(Int_t tmode)
                 virtual void SetTitle(const char* label)
                 virtual void ShowMembers(TMemberInspector& insp, char* parent)
                 virtual void Streamer(TBuffer& b)
                         void StreamerNVirtual(TBuffer& b)

### Data Members

        protected:

                     TGString* fText          label text
                        UInt_t fTWidth        text width
                        UInt_t fTHeight       text height
                         Int_t fTMode         text drawing mode (ETextJustification)
                        Bool_t fTextChanged   has text changed
                    GContext_t fNormGC        graphics context used for drawing label
                  FontStruct_t fFontStruct    font to draw label
                        Bool_t fHasOwnFont    kTRUE - font defined locally,  kFALSE - globally
                        Bool_t fDisabled      if kTRUE label looks disabled (shaded text)
          static const TGFont* fgDefaultFont
            static const TGGC* fgDefaultGC

## Class Description

     TGLabel

     This class handles GUI labels.

TGLabel(const TGWindow *p, TGString *text, GContext_t norm, FontStruct_t font, UInt_t options, ULong_t back) : TGFrame(p, 1, 1, options, back)

     Create a label GUI object. TGLabel will become the owner of the
     text and will delete it in its dtor.

TGLabel(const TGWindow *p, const char *text, GContext_t norm, FontStruct_t font, UInt_t options, ULong_t back) : TGFrame(p, 1, 1, options, back)

     Create a label GUI object.

~TGLabel()

     Delete label.

void SetText(TGString *new_text)

     Set new text in label. After calling this method one needs to call
     the parents frame's Layout() method to force updating of the label size.
     The new_text is adopted by the TGLabel and will be properly deleted.

void DoRedraw()

     Redraw label widget.

void SetTextFont(FontStruct_t font, Bool_t global)

     Changes text font.
     If global is true font is changed globally.

void SetTextFont(const char *fontName, Bool_t global)

     Changes text font specified by name.
     If global is true font is changed globally.

void SetTextFont(TGFont *font, Bool_t global)

     Changes text font specified by pointer to TGFont object.
     If global is true font is changed globally.

void SetTextColor(Pixel_t color, Bool_t global)

     Changes text color.
     If global is true color is changed globally

void SetTextColor(TColor *color, Bool_t global)

     Changes text color.
     If global is true color is changed globally

void SetTextJustify(Int_t mode)

     Set text justification. Mode is an OR of the bits:
     kTextTop, kTextLeft, kTextLeft, kTextRight, kTextCenterX and
     kTextCenterY.

Bool_t HasOwnFont() const

     Returns kTRUE if text attributes are unique,
     returns kFALSE if text attributes are shared (global).

void SavePrimitive(ofstream &out, Option_t *option)

     Save a label widget as a C++ statement(s) on output stream out.

FontStruct_t GetDefaultFontStruct()

     Static returning label default font struct.

const TGGC& GetDefaultGC()

     Static returning label default graphics context.

### Inline Functions

                TGDimension GetDefaultSize() const
            const TGString* GetText() const
                const char* GetTitle() const
                       void SetText(const char* newText)
                       void SetTitle(const char* label)
                       void SetText(Int_t number)
                       void SetForegroundColor(Pixel_t fore)
                       void Disable()
                       void Enable()
                     Bool_t IsDisabled() const
                    TClass* Class()
                    TClass* IsA() const
                       void ShowMembers(TMemberInspector& insp, char* parent)
                       void Streamer(TBuffer& b)
                       void StreamerNVirtual(TBuffer& b)
                    TGLabel TGLabel(const TGLabel&)

Author: Fons Rademakers 06/01/98
Last update: root/gui:$Name: $:$Id: TGLabel.cxx,v 1.18 2005/05/10 15:11:26 rdm Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *