00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_TGTab
00013 #define ROOT_TGTab
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef ROOT_TGFrame
00033 #include "TGFrame.h"
00034 #endif
00035 #ifndef ROOT_TGWidget
00036 #include "TGWidget.h"
00037 #endif
00038
00039 class TList;
00040 class TGTabElement;
00041 class TGTab;
00042 class TGPicture;
00043
00044 class TGTabLayout : public TGLayoutManager {
00045
00046 protected:
00047 TGTab *fMain;
00048 TList *fList;
00049
00050 private:
00051 TGTabLayout(const TGTabLayout&);
00052 TGTabLayout& operator=(const TGTabLayout&);
00053
00054 public:
00055 TGTabLayout(TGTab *main);
00056
00057 virtual void Layout();
00058 virtual TGDimension GetDefaultSize() const;
00059 virtual void SavePrimitive(ostream &out, Option_t *option = "");
00060
00061 ClassDef(TGTabLayout,0)
00062 };
00063
00064
00065
00066 class TGTab : public TGCompositeFrame, public TGWidget {
00067
00068 protected:
00069 Int_t fCurrent;
00070 UInt_t fTabh;
00071 TGCompositeFrame *fContainer;
00072 TList *fRemoved;
00073 FontStruct_t fFontStruct;
00074 GContext_t fNormGC;
00075
00076 void ChangeTab(Int_t tabIndex, Bool_t emit=kTRUE);
00077
00078 static const TGFont *fgDefaultFont;
00079 static const TGGC *fgDefaultGC;
00080
00081 private:
00082 TGTab(const TGTab&);
00083 TGTab& operator=(const TGTab&);
00084
00085 public:
00086 static FontStruct_t GetDefaultFontStruct();
00087 static const TGGC &GetDefaultGC();
00088
00089 TGTab(const TGWindow *p = 0, UInt_t w = 1, UInt_t h = 1,
00090 GContext_t norm = GetDefaultGC()(),
00091 FontStruct_t font = GetDefaultFontStruct(),
00092 UInt_t options = kChildFrame,
00093 Pixel_t back = GetDefaultFrameBackground());
00094 virtual ~TGTab();
00095
00096 virtual TGCompositeFrame *AddTab(TGString *text);
00097 virtual TGCompositeFrame *AddTab(const char *text);
00098 virtual void AddTab(const char *text, TGCompositeFrame *cf);
00099 virtual void AddTab(TGString *text, TGCompositeFrame *cf);
00100
00101 virtual void NewTab(const char *text = "tab");
00102 virtual void RemoveTab(Int_t tabIndex = -1,
00103 Bool_t storeRemoved = kTRUE);
00104 virtual Bool_t SetTab(Int_t tabIndex, Bool_t emit = kTRUE);
00105 virtual Bool_t SetTab(const char *name, Bool_t emit = kTRUE);
00106 virtual void DrawBorder() { }
00107
00108 TGCompositeFrame *GetContainer() const { return fContainer; }
00109 Int_t GetCurrent() const { return fCurrent; }
00110 TGCompositeFrame *GetTabContainer(Int_t tabIndex) const;
00111 TGCompositeFrame *GetTabContainer(const char *name) const;
00112 TGTabElement *GetTabTab(Int_t tabIndex) const;
00113 TGTabElement *GetTabTab(const char *name) const;
00114 TGCompositeFrame *GetCurrentContainer() const { return GetTabContainer(fCurrent); }
00115 TGTabElement *GetCurrentTab() const { return GetTabTab(fCurrent); }
00116 UInt_t GetTabHeight() const { return fTabh; }
00117 Int_t GetNumberOfTabs() const;
00118 virtual void SetEnabled(Int_t tabIndex, Bool_t on = kTRUE);
00119 virtual void SetText(const char *text = "tab");
00120 Bool_t IsEnabled(Int_t tabIndex) const;
00121
00122 virtual void SavePrimitive(ostream &out, Option_t *option = "");
00123
00124 virtual void CloseTab(Int_t id) { Emit("CloseTab(Int_t)", id); }
00125 virtual void Removed(Int_t id) { Emit("Removed(Int_t)", id); }
00126 virtual void Selected(Int_t id) { Emit("Selected(Int_t)", id); }
00127 virtual TGLayoutManager *GetLayoutManager() const;
00128
00129 ClassDef(TGTab,0)
00130 };
00131
00132
00133
00134 class TGTabElement : public TGFrame {
00135
00136 protected:
00137 TGString *fText;
00138 const TGPicture *fClosePic;
00139 const TGPicture *fClosePicD;
00140 GContext_t fNormGC;
00141 FontStruct_t fFontStruct;
00142 UInt_t fTWidth;
00143 UInt_t fTHeight;
00144 Bool_t fEnabled;
00145 Bool_t fShowClose;
00146 Bool_t fActive;
00147
00148 private:
00149 TGTabElement(const TGTabElement&);
00150 TGTabElement& operator=(const TGTabElement&);
00151
00152 public:
00153 TGTabElement(const TGWindow *p = 0, TGString *text = 0, UInt_t w = 1, UInt_t h = 1,
00154 GContext_t norm = TGTab::GetDefaultGC()(),
00155 FontStruct_t font = TGTab::GetDefaultFontStruct(),
00156 UInt_t options = kRaisedFrame,
00157 Pixel_t back = GetDefaultFrameBackground());
00158 virtual ~TGTabElement();
00159
00160 virtual void DrawBorder();
00161 virtual TGDimension GetDefaultSize() const;
00162 const TGString *GetText() const { return fText; }
00163 const char *GetString() const { return fText->GetString(); }
00164 virtual Bool_t HandleButton(Event_t *event);
00165 void SetText(TGString *text);
00166 virtual void SetEnabled(Bool_t on = kTRUE) { fEnabled = on; }
00167 Bool_t IsEnabled() const { return fEnabled; }
00168 virtual void SetEditDisabled(UInt_t) {}
00169 virtual void ShowClose(Bool_t on = kTRUE);
00170 Bool_t IsCloseShown() const { return fShowClose; }
00171 virtual void SetActive(Bool_t on = kTRUE) { fActive = on; }
00172 Bool_t IsActive() const { return fActive; }
00173
00174 ClassDef(TGTabElement,0)
00175 };
00176
00177 #endif