File indexing completed on 2025-01-18 10:12:05
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef ROOT_TGTable
0012 #define ROOT_TGTable
0013
0014 #include "TGCanvas.h"
0015 #include "TGWidget.h"
0016 #include "TGTableHeader.h"
0017
0018 class TGWindow;
0019 class TGString;
0020 class TGToolTip;
0021 class TGPicture;
0022 class TVirtualTableInterface;
0023 class TGTableCell;
0024 class TGTableHeader;
0025 class TGToolTip;
0026 class TGTableFrame;
0027 class TGTableHeaderFrame;
0028 class TGTextButton;
0029 class TGNumberEntryField;
0030 class TGLabel;
0031 class TGTextEntry;
0032 class TTableRange;
0033
0034 class TGTable : public TGCompositeFrame, public TGWidget {
0035
0036 protected:
0037 TObjArray *fRows;
0038 TObjArray *fRowHeaders;
0039 TObjArray *fColumnHeaders;
0040 TGTableHeader *fTableHeader;
0041 Bool_t fReadOnly;
0042 Pixel_t fSelectColor;
0043 Int_t fTMode;
0044 Bool_t fAllData;
0045 TTableRange *fCurrentRange;
0046 TTableRange *fDataRange;
0047 TTableRange *fGotoRange;
0048 TGTableFrame *fTableFrame;
0049 TGCanvas *fCanvas;
0050 UInt_t fCellWidth;
0051 UInt_t fCellHeight;
0052
0053
0054
0055 TGTableHeaderFrame *fCHdrFrame;
0056 TGTableHeaderFrame *fRHdrFrame;
0057 TGHorizontalFrame *fRangeFrame;
0058 TGHorizontalFrame *fTopFrame;
0059 TGHorizontalFrame *fTopExtraFrame;
0060 TGHorizontalFrame *fBottomFrame;
0061 TGHorizontalFrame *fButtonFrame;
0062
0063
0064
0065
0066 TGTextButton *fNextButton;
0067 TGTextButton *fPrevButton;
0068 TGTextButton *fUpdateButton;
0069 TGTextButton *fGotoButton;
0070
0071
0072
0073
0074 TGLabel *fFirstCellLabel;
0075 TGLabel *fRangeLabel;
0076 TGTextEntry *fFirstCellEntry;
0077 TGTextEntry *fRangeEntry;
0078
0079 Pixel_t fOddRowBackground;
0080 Pixel_t fEvenRowBackground;
0081 Pixel_t fHeaderBackground;
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091 TList *fCellHintsList;
0092 TList *fRHdrHintsList;
0093 TList *fCHdrHintsList;
0094 TList *fMainHintsList;
0095
0096
0097
0098
0099 virtual void Init();
0100
0101
0102 protected:
0103 TVirtualTableInterface *fInterface;
0104
0105 void DoRedraw() override;
0106
0107 virtual void Expand(UInt_t nrows, UInt_t ncolumns);
0108 virtual void ExpandColumns(UInt_t ncolumns);
0109 virtual void ExpandRows(UInt_t nrows);
0110
0111 virtual UInt_t GetRHdrHeight() const;
0112 virtual UInt_t GetCHdrWidth() const;
0113
0114 virtual void Shrink(UInt_t nrows, UInt_t ncolumns);
0115 virtual void ShrinkColumns(UInt_t ncolumns);
0116 virtual void ShrinkRows(UInt_t nrows);
0117
0118 virtual void UpdateHeaders(EHeaderType type);
0119 virtual void SetInterface(TVirtualTableInterface *interface,
0120 UInt_t nrows = 50, UInt_t ncolumns = 20);
0121 virtual void ResizeTable(UInt_t nrows, UInt_t ncolumns);
0122
0123 virtual void UpdateRangeFrame();
0124
0125 public:
0126 TGTable(const TGWindow *p = nullptr, Int_t id = 0,
0127 TVirtualTableInterface *interface = nullptr, UInt_t nrows = 50,
0128 UInt_t ncolumns = 20);
0129 ~TGTable() override;
0130
0131 virtual TObjArray *GetRow(UInt_t row);
0132 virtual TObjArray *GetColumn(UInt_t columns);
0133
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143
0144
0145
0146
0147
0148
0149 virtual const TGTableCell* GetCell(UInt_t i, UInt_t j) const;
0150 virtual TGTableCell* GetCell(UInt_t i, UInt_t j);
0151
0152 virtual const TGTableCell* FindCell(TGString label) const;
0153 virtual TGTableCell* FindCell(TGString label);
0154
0155 virtual void Show();
0156
0157
0158
0159
0160
0161
0162
0163
0164
0165
0166
0167
0168
0169
0170
0171
0172
0173
0174
0175
0176
0177
0178
0179
0180
0181
0182 virtual void UpdateView();
0183
0184
0185 virtual UInt_t GetNTableRows() const;
0186 virtual UInt_t GetNDataRows() const;
0187 virtual UInt_t GetNTableColumns() const;
0188 virtual UInt_t GetNDataColumns() const;
0189 virtual UInt_t GetNTableCells() const;
0190 virtual UInt_t GetNDataCells() const;
0191 virtual const TTableRange *GetCurrentRange() const;
0192
0193 virtual TVirtualTableInterface *GetInterface() { return fInterface; }
0194
0195 virtual TGCanvas *GetCanvas() { return fCanvas; }
0196 virtual const TGTableHeaderFrame *GetRHdrFrame() { return fRHdrFrame; }
0197 virtual const TGTableHeaderFrame *GetCHdrFrame() { return fCHdrFrame; }
0198 virtual const TGTableHeader *GetRowHeader(const UInt_t row) const;
0199 virtual TGTableHeader *GetRowHeader(const UInt_t row);
0200 virtual const TGTableHeader *GetColumnHeader(const UInt_t column) const;
0201 virtual TGTableHeader *GetColumnHeader(const UInt_t column);
0202 virtual TGTableHeader *GetTableHeader();
0203
0204
0205
0206
0207
0208 virtual Pixel_t GetRowBackground(UInt_t row) const;
0209 virtual Pixel_t GetHeaderBackground() const ;
0210
0211 virtual void SetOddRowBackground(Pixel_t pixel);
0212 virtual void SetEvenRowBackground(Pixel_t pixel);
0213 virtual void SetHeaderBackground(Pixel_t pixel);
0214 virtual void SetDefaultColors();
0215
0216
0217 virtual void MoveTable(Int_t rows, Int_t columns);
0218 virtual void GotoTableRange(Int_t xtl, Int_t ytl,
0219 Int_t xbr, Int_t ybr);
0220
0221 virtual TGTableCell* operator() (UInt_t row, UInt_t column);
0222
0223
0224 virtual void ScrollCHeaders(Int_t xpos);
0225 virtual void ScrollRHeaders(Int_t ypos);
0226 virtual void NextChunk();
0227 virtual void PreviousChunk();
0228 virtual void UserRangeChange();
0229 virtual void Goto();
0230 virtual void Update();
0231
0232 ClassDefOverride(TGTable, 0)
0233 };
0234
0235 class TTableRange {
0236 public:
0237 UInt_t fXtl;
0238 UInt_t fYtl;
0239 UInt_t fXbr;
0240 UInt_t fYbr;
0241
0242 TTableRange();
0243 virtual ~TTableRange() {}
0244 virtual void Print();
0245
0246 Bool_t operator==(TTableRange &other);
0247
0248 ClassDef(TTableRange, 0)
0249 };
0250
0251 #endif
0252