library: libGui #include "TGTab.h"

# TGTab

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

## class TGTab : public TGCompositeFrame, public TGWidget

| Inheritance Chart:
`TObject`
| <- | `TGObject`
| <- | `TGWindow`
`TQObject`
| <- | `TGFrame`
| <- | `TGCompositeFrame`
`TGWidget`
| <- | `TGTab` |

        protected:

          void ChangeTab(Int_t tabIndex)

        public:

                                    TGTab(const TGWindow* p = 0, UInt_t w = 1, UInt_t h = 1, GContext_t norm = GetDefaultGC()(), FontStruct_t font = GetDefaultFontStruct(), UInt_t options = kChildFrame, Pixel_t back = GetDefaultFrameBackground())
                                    TGTab(const TGTab&)
                            virtual ~TGTab()
          virtual TGCompositeFrame* AddTab(TGString* text)
          virtual TGCompositeFrame* AddTab(const char* text)
                     static TClass* Class()
                       virtual void DrawBorder()
                  TGCompositeFrame* GetContainer() const
                              Int_t GetCurrent() const
                  TGCompositeFrame* GetCurrentContainer() const
                      TGTabElement* GetCurrentTab() const
                static FontStruct_t GetDefaultFontStruct()
                 static const TGGC& GetDefaultGC() const
                              Int_t GetNumberOfTabs() const
                  TGCompositeFrame* GetTabContainer(Int_t tabIndex) const
                  TGCompositeFrame* GetTabContainer(const char* name) const
                             UInt_t GetTabHeight() const
                      TGTabElement* GetTabTab(Int_t tabIndex) const
                      TGTabElement* GetTabTab(const char* name) const
                    virtual TClass* IsA() const
                             Bool_t IsEnabled(Int_t tabIndex) const
                       virtual void RemoveTab(Int_t tabIndex)
                       virtual void SavePrimitive(ofstream& out, Option_t* option)
                       virtual void Selected(Int_t id)
                       virtual void SetEnabled(Int_t tabIndex, Bool_t on = kTRUE)
                     virtual Bool_t SetTab(Int_t tabIndex)
                     virtual Bool_t SetTab(const char* name)
                       virtual void ShowMembers(TMemberInspector& insp, char* parent)
                       virtual void Streamer(TBuffer& b)
                               void StreamerNVirtual(TBuffer& b)

### Data Members

        protected:

                         Int_t fCurrent       index of current tab
                        UInt_t fTabh          tab height
             TGCompositeFrame* fContainer     main container
                        TList* fRemoved       list of removed tabs
                  FontStruct_t fFontStruct    font
                    GContext_t fNormGC        drawing context
          static const TGFont* fgDefaultFont
            static const TGGC* fgDefaultGC

## Class Description

     TGTab, TGTabElement, TGTabLayout

     A tab widget contains a set of composite frames each with a little
     tab with a name (like a set of folders with tabs).

     The TGTab is user callable. The TGTabElement and TGTabLayout are
     service classes of the tab widget.

     Clicking on a tab will bring the associated composite frame to the
     front and generate the following event:
     kC_COMMAND, kCM_TAB, tab id, 0.

TGTab(const TGWindow *p, UInt_t w, UInt_t h, GContext_t norm, FontStruct_t font, UInt_t options, ULong_t back) : TGCompositeFrame(p, w, h, options, back)

     Create tab widget.

~TGTab()

     Delete tab widget. This deletes the tab windows and the containers.
     The tab string is deleted by the TGTabElement dtor.

TGCompositeFrame* AddTab(TGString *text)

     Add a tab to the tab widget. Returns the new container, which
     is owned by the tab widget. The text is adopted by the tab widget.

TGCompositeFrame* AddTab(const char *text)

     Add a tab to the tab widget. Returns the new container. The container
     is owned by the tab widget.

void RemoveTab(Int_t tabIndex)

     Remove container and tab of tab with index tabIndex.
     Does NOT remove the container contents!

void SetEnabled(Int_t tabIndex, Bool_t on)

     Enabled or disable tab.

Bool_t IsEnabled(Int_t tabIndex) const

     Returns true if tab is enabled.

void ChangeTab(Int_t tabIndex)

     Make tabIdx the current tab. Utility method called by SetTab and
     HandleButton().

Bool_t SetTab(Int_t tabIndex)

     Brings the composite frame with the index tabIndex to the
     front and generate the following event if the front tab has changed:
     kC_COMMAND, kCM_TAB, tab id, 0.
     Returns kFALSE if tabIndex is a not valid index

Bool_t SetTab(const char *name)

     Brings the composite frame with the name to the
     front and generate the following event if the front tab has changed:
     kC_COMMAND, kCM_TAB, tab id, 0.
     Returns kFALSE if tab with name does not exist.

TGCompositeFrame* GetTabContainer(Int_t tabIndex) const

     Return container of tab with index tabIndex.
     Returns 0 in case tabIndex is out of range.

TGCompositeFrame* GetTabContainer(const char *name) const

     Return the tab container of tab with string name.
     Returns 0 in case name is not found.

TGTabElement* GetTabTab(Int_t tabIndex) const

     Return the tab element of tab with index tabIndex.
     Returns 0 in case tabIndex is out of range.

TGTabElement* GetTabTab(const char *name) const

     Return the tab element of tab with string name.
     Returns 0 in case name is not found.

Int_t GetNumberOfTabs() const

     Return number of tabs.

FontStruct_t GetDefaultFontStruct()

const TGGC& GetDefaultGC()

void SavePrimitive(ofstream &out, Option_t *option)

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

### Inline Functions

                         void DrawBorder()
            TGCompositeFrame* GetContainer() const
                        Int_t GetCurrent() const
            TGCompositeFrame* GetCurrentContainer() const
                TGTabElement* GetCurrentTab() const
                       UInt_t GetTabHeight() const
                         void Selected(Int_t id)
                      TClass* Class()
                      TClass* IsA() const
                         void ShowMembers(TMemberInspector& insp, char* parent)
                         void Streamer(TBuffer& b)
                         void StreamerNVirtual(TBuffer& b)
                        TGTab TGTab(const TGTab&)

Author: Fons Rademakers 13/01/98
Last update: root/gui:$Name: $:$Id: TGTab.cxx,v 1.20 2005/04/19 09:10:59 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *