#ifndef ROOT_TGTab
#define ROOT_TGTab
#ifndef ROOT_TGFrame
#include "TGFrame.h"
#endif
#ifndef ROOT_TGWidget
#include "TGWidget.h"
#endif
class TList;
class TGTabElement;
class TGTab;
class TGPicture;
class TGTabLayout : public TGLayoutManager {
protected:
TGTab *fMain;
TList *fList;
private:
TGTabLayout(const TGTabLayout&);
TGTabLayout& operator=(const TGTabLayout&);
public:
TGTabLayout(TGTab *main);
virtual void Layout();
virtual TGDimension GetDefaultSize() const;
virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
ClassDef(TGTabLayout,0)
};
class TGTab : public TGCompositeFrame, public TGWidget {
protected:
Int_t fCurrent;
UInt_t fTabh;
TGCompositeFrame *fContainer;
TList *fRemoved;
FontStruct_t fFontStruct;
GContext_t fNormGC;
void ChangeTab(Int_t tabIndex, Bool_t emit=kTRUE);
static const TGFont *fgDefaultFont;
static const TGGC *fgDefaultGC;
private:
TGTab(const TGTab&);
TGTab& operator=(const TGTab&);
public:
static FontStruct_t GetDefaultFontStruct();
static const TGGC &GetDefaultGC();
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());
virtual ~TGTab();
virtual TGCompositeFrame *AddTab(TGString *text);
virtual TGCompositeFrame *AddTab(const char *text);
virtual void AddTab(const char *text, TGCompositeFrame *cf);
virtual void AddTab(TGString *text, TGCompositeFrame *cf);
virtual void NewTab(const char *text = "tab");
virtual void RemoveTab(Int_t tabIndex = -1,
Bool_t storeRemoved = kTRUE);
virtual Bool_t SetTab(Int_t tabIndex, Bool_t emit = kTRUE);
virtual Bool_t SetTab(const char *name, Bool_t emit = kTRUE);
virtual void DrawBorder() { }
TGCompositeFrame *GetContainer() const { return fContainer; }
Int_t GetCurrent() const { return fCurrent; }
TGCompositeFrame *GetTabContainer(Int_t tabIndex) const;
TGCompositeFrame *GetTabContainer(const char *name) const;
TGTabElement *GetTabTab(Int_t tabIndex) const;
TGTabElement *GetTabTab(const char *name) const;
TGCompositeFrame *GetCurrentContainer() const { return GetTabContainer(fCurrent); }
TGTabElement *GetCurrentTab() const { return GetTabTab(fCurrent); }
UInt_t GetTabHeight() const { return fTabh; }
Int_t GetNumberOfTabs() const;
virtual void SetEnabled(Int_t tabIndex, Bool_t on = kTRUE);
virtual void SetText(const char *text = "tab");
Bool_t IsEnabled(Int_t tabIndex) const;
virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
virtual void CloseTab(Int_t id) { Emit("CloseTab(Int_t)", id); }
virtual void Removed(Int_t id) { Emit("Removed(Int_t)", id); }
virtual void Selected(Int_t id) { Emit("Selected(Int_t)", id); }
virtual TGLayoutManager *GetLayoutManager() const;
ClassDef(TGTab,0)
};
class TGTabElement : public TGFrame {
protected:
TGString *fText;
const TGPicture *fClosePic;
const TGPicture *fClosePicD;
GContext_t fNormGC;
FontStruct_t fFontStruct;
UInt_t fTWidth;
UInt_t fTHeight;
Bool_t fEnabled;
Bool_t fShowClose;
Bool_t fActive;
private:
TGTabElement(const TGTabElement&);
TGTabElement& operator=(const TGTabElement&);
public:
TGTabElement(const TGWindow *p = 0, TGString *text = 0, UInt_t w = 1, UInt_t h = 1,
GContext_t norm = TGTab::GetDefaultGC()(),
FontStruct_t font = TGTab::GetDefaultFontStruct(),
UInt_t options = kRaisedFrame,
Pixel_t back = GetDefaultFrameBackground());
virtual ~TGTabElement();
virtual void DrawBorder();
virtual TGDimension GetDefaultSize() const;
const TGString *GetText() const { return fText; }
const char *GetString() const { return fText->GetString(); }
virtual Bool_t HandleButton(Event_t *event);
void SetText(TGString *text);
virtual void SetEnabled(Bool_t on = kTRUE) { fEnabled = on; }
Bool_t IsEnabled() const { return fEnabled; }
virtual void SetEditDisabled(UInt_t) {}
virtual void ShowClose(Bool_t on = kTRUE);
Bool_t IsCloseShown() const { return fShowClose; }
virtual void SetActive(Bool_t on = kTRUE) { fActive = on; }
Bool_t IsActive() const { return fActive; }
ClassDef(TGTabElement,0)
};
#endif