Warning, file /include/root/TGTab.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TGTab
0013 #define ROOT_TGTab
0014
0015
0016 #include "TGFrame.h"
0017 #include "TGWidget.h"
0018
0019 class TList;
0020 class TGTabElement;
0021 class TGTab;
0022 class TGPicture;
0023
0024 class TGTabLayout : public TGLayoutManager {
0025
0026 protected:
0027 TGTab *fMain;
0028 TList *fList;
0029
0030 private:
0031 TGTabLayout(const TGTabLayout&) = delete;
0032 TGTabLayout& operator=(const TGTabLayout&) = delete;
0033
0034 public:
0035 TGTabLayout(TGTab *main);
0036
0037 void Layout() override;
0038 TGDimension GetDefaultSize() const override;
0039 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
0040
0041 ClassDefOverride(TGTabLayout,0)
0042 };
0043
0044
0045
0046 class TGTab : public TGCompositeFrame, public TGWidget {
0047
0048 protected:
0049 Int_t fCurrent;
0050 UInt_t fTabh;
0051 TGCompositeFrame *fContainer;
0052 TList *fRemoved;
0053 FontStruct_t fFontStruct;
0054 GContext_t fNormGC;
0055 Bool_t fScrolling;
0056
0057 void ChangeTab(Int_t tabIndex, Bool_t emit=kTRUE);
0058
0059 static const TGFont *fgDefaultFont;
0060 static const TGGC *fgDefaultGC;
0061
0062 private:
0063 TGTab(const TGTab&) = delete;
0064 TGTab& operator=(const TGTab&) = delete;
0065
0066 public:
0067 static FontStruct_t GetDefaultFontStruct();
0068 static const TGGC &GetDefaultGC();
0069
0070 TGTab(const TGWindow *p = nullptr, UInt_t w = 1, UInt_t h = 1,
0071 GContext_t norm = GetDefaultGC()(),
0072 FontStruct_t font = GetDefaultFontStruct(),
0073 UInt_t options = kChildFrame,
0074 Pixel_t back = GetDefaultFrameBackground());
0075 ~TGTab() override;
0076
0077 virtual TGCompositeFrame *AddTab(TGString *text);
0078 virtual TGCompositeFrame *AddTab(const char *text);
0079 virtual void AddTab(const char *text, TGCompositeFrame *cf);
0080 virtual void AddTab(TGString *text, TGCompositeFrame *cf);
0081
0082 virtual void NewTab(const char *text = "tab");
0083 virtual void RemoveTab(Int_t tabIndex = -1,
0084 Bool_t storeRemoved = kTRUE);
0085 virtual Bool_t SetTab(Int_t tabIndex, Bool_t emit = kTRUE);
0086 virtual Bool_t SetTab(const char *name, Bool_t emit = kTRUE);
0087 void DrawBorder() override { }
0088
0089 TGCompositeFrame *GetContainer() const { return fContainer; }
0090 Int_t GetCurrent() const { return fCurrent; }
0091 TGCompositeFrame *GetTabContainer(Int_t tabIndex) const;
0092 TGCompositeFrame *GetTabContainer(const char *name) const;
0093 TGTabElement *GetTabTab(Int_t tabIndex) const;
0094 TGTabElement *GetTabTab(const char *name) const;
0095 TGCompositeFrame *GetCurrentContainer() const { return GetTabContainer(fCurrent); }
0096 TGTabElement *GetCurrentTab() const { return GetTabTab(fCurrent); }
0097 UInt_t GetTabHeight() const { return fTabh; }
0098 Int_t GetNumberOfTabs() const;
0099 virtual void SetEnabled(Int_t tabIndex, Bool_t on = kTRUE);
0100 virtual void SetText(const char *text = "tab");
0101 Bool_t IsEnabled(Int_t tabIndex) const;
0102 virtual void SetScrollingEnabled(Bool_t on = kTRUE);
0103 Bool_t IsScrollingEnabled() const;
0104
0105 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
0106
0107 virtual void CloseTab(Int_t id) { Emit("CloseTab(Int_t)", id); }
0108 virtual void Removed(Int_t id) { Emit("Removed(Int_t)", id); }
0109 virtual void Selected(Int_t id) { Emit("Selected(Int_t)", id); }
0110 TGLayoutManager *GetLayoutManager() const override;
0111
0112 ClassDefOverride(TGTab,0)
0113 };
0114
0115
0116
0117 class TGTabElement : public TGFrame {
0118
0119 protected:
0120 TGString *fText;
0121 const TGPicture *fClosePic;
0122 const TGPicture *fClosePicD;
0123 GContext_t fNormGC;
0124 FontStruct_t fFontStruct;
0125 UInt_t fTWidth;
0126 UInt_t fTHeight;
0127 Bool_t fEnabled;
0128 Bool_t fShowClose;
0129 Bool_t fActive;
0130
0131 private:
0132 TGTabElement(const TGTabElement&) = delete;
0133 TGTabElement& operator=(const TGTabElement&) = delete;
0134
0135 public:
0136 TGTabElement(const TGWindow *p = nullptr, TGString *text = nullptr, UInt_t w = 1, UInt_t h = 1,
0137 GContext_t norm = TGTab::GetDefaultGC()(),
0138 FontStruct_t font = TGTab::GetDefaultFontStruct(),
0139 UInt_t options = kRaisedFrame,
0140 Pixel_t back = GetDefaultFrameBackground());
0141 ~TGTabElement() override;
0142
0143 void DrawBorder() override;
0144 TGDimension GetDefaultSize() const override;
0145 const TGString *GetText() const { return fText; }
0146 const char *GetString() const { return fText->GetString(); }
0147 Bool_t HandleButton(Event_t *event) override;
0148 void SetText(TGString *text);
0149 virtual void SetEnabled(Bool_t on = kTRUE) { fEnabled = on; }
0150 Bool_t IsEnabled() const { return fEnabled; }
0151 void SetEditDisabled(UInt_t) override {}
0152 virtual void ShowClose(Bool_t on = kTRUE);
0153 Bool_t IsCloseShown() const { return fShowClose; }
0154 virtual void SetActive(Bool_t on = kTRUE) { fActive = on; }
0155 Bool_t IsActive() const override { return fActive; }
0156
0157 ClassDefOverride(TGTabElement,0)
0158 };
0159
0160 #endif