library: libGui #include "TGButton.h"

# TGTextButton

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

## class TGTextButton : public TGButton

| Inheritance Chart:
`TObject`
| <- | `TGObject`
| <- | `TGWindow`
`TQObject`
| <- | `TGFrame`
`TGWidget`
| <- | `TGButton`
| <- | `TGTextButton` |
<- |
`TGCheckButton` | <- |
`TGColorSelect` |
`TGedSelect` | <- |
`TGedMarkerSelect` |
`TGedPatternSelect` |
`TGRadioButton` |

        protected:

          virtual void DoRedraw()
                  void Init()

        public:

                              TGTextButton(const TGWindow* p, TGHotString* s, Int_t id = -1, GContext_t norm = GetDefaultGC()(), FontStruct_t font = GetDefaultFontStruct(), UInt_t option = kRaisedFrame|kDoubleBorder)
                              TGTextButton(const TGWindow* p = 0, const char* s = "0", Int_t id = -1, GContext_t norm = GetDefaultGC()(), FontStruct_t font = GetDefaultFontStruct(), UInt_t option = kRaisedFrame|kDoubleBorder)
                              TGTextButton(const TGWindow* p, const char* s, const char* cmd, Int_t id = -1, GContext_t norm = GetDefaultGC()(), FontStruct_t font = GetDefaultFontStruct(), UInt_t option = kRaisedFrame|kDoubleBorder)
                              TGTextButton(const TGTextButton&)
                      virtual ~TGTextButton()
               static TClass* Class()
          static FontStruct_t GetDefaultFontStruct()
          virtual TGDimension GetDefaultSize() const
                      TString GetString() const
           const TGHotString* GetText() const
          virtual const char* GetTitle() const
               virtual Bool_t HandleKey(Event_t* event)
                       Bool_t HasOwnFont() const
              virtual TClass* IsA() const
                 virtual void SavePrimitive(ofstream& out, Option_t* option)
                 virtual void SetFont(FontStruct_t font, Bool_t global = kFALSE)
                 virtual void SetFont(const char* fontName, Bool_t global = kFALSE)
                 virtual void SetForegroundColor(Pixel_t fore)
                 virtual void SetText(TGHotString* new_label)
                 virtual void SetText(const TString& new_label)
                 virtual void SetTextColor(Pixel_t color, 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:

                  TGHotString* fLabel         button text
                         Int_t fTMode         text drawing mode (ETextJustification)
                         Int_t fHKeycode      hotkey
                  FontStruct_t fFontStruct    font to draw text
                        Bool_t fHasOwnFont    kTRUE - font defined locally,  kFALSE - globally
          static const TGFont* fgDefaultFont

## Class Description

     TGButton, TGTextButton, TGPictureButton, TGCheckButton and
     TGRadioButton

     This header defines all GUI button widgets.

     TGButton is a button abstract base class. It defines general button
     behaviour.

     Selecting a text or picture button will generate the event:
     kC_COMMAND, kCM_BUTTON, button id, user data.

     Selecting a check button will generate the event:
     kC_COMMAND, kCM_CHECKBUTTON, button id, user data.

     Selecting a radio button will generate the event:
     kC_COMMAND, kCM_RADIOBUTTON, button id, user data.

     If a command string has been specified (via SetCommand()) then this
     command string will be executed via the interpreter whenever a
     button is selected. A command string can contain the macros:
     $MSG   -- kC_COMMAND, kCM[CHECK|RADIO]BUTTON packed message
               (use GET_MSG() and GET_SUBMSG() to unpack)
     $PARM1 -- button id
     $PARM2 -- user data pointer
     Before executing these macros are expanded into the respective
     Long_t's

TGTextButton(const TGWindow *p, TGHotString *s, Int_t id, GContext_t norm, FontStruct_t font, UInt_t options) : TGButton(p, id, norm, options)

     Create a text button widget. The hotstring will be adopted and deleted
     by the text button.

TGTextButton(const TGWindow *p, const char *s, Int_t id, GContext_t norm, FontStruct_t font, UInt_t options) : TGButton(p, id, norm, options)

     Create a text button widget.

TGTextButton(const TGWindow *p, const char *s, const char *cmd, Int_t id, GContext_t norm, FontStruct_t font, UInt_t options) : TGButton(p, id, norm, options)

     Create a text button widget and set cmd string at same time.

void Init()

     Common initialization used by the different ctors.

~TGTextButton()

     Delete a text button widget.

void SetText(TGHotString *new_label)

     Set new button text.

void SetText(const TString &new_label)

     Set new button text.

void DoRedraw()

     Draw the text button.

Bool_t HandleKey(Event_t *event)

     Handle key event. This function will be called when the hotkey is hit.

FontStruct_t GetDefaultFontStruct()

void SetFont(FontStruct_t font, Bool_t global)

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

void SetFont(const char *fontName, Bool_t global)

     Changes text font specified by name.
     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.

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 text button widget as a C++ statement(s) on output stream out

### Inline Functions

                   TGDimension GetDefaultSize() const
            const TGHotString* GetText() const
                   const char* GetTitle() const
                       TString GetString() const
                          void SetTextJustify(Int_t tmode)
                          void SetTitle(const char* label)
                          void SetForegroundColor(Pixel_t fore)
                       TClass* Class()
                       TClass* IsA() const
                          void ShowMembers(TMemberInspector& insp, char* parent)
                          void Streamer(TBuffer& b)
                          void StreamerNVirtual(TBuffer& b)
                  TGTextButton TGTextButton(const TGTextButton&)

Author: Fons Rademakers 06/01/98
Last update: root/gui:$Name: $:$Id: TGButton.cxx,v 1.58 2005/06/24 20:30:12 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *