171 fRowHeaders(0), fColumnHeaders(0), fReadOnly(
kFALSE), fSelectColor(0),
172 fTMode(0), fAllData(kFALSE), fTableFrame(0), fCanvas(0), fCellWidth(80),
173 fCellHeight(25), fInterface(interface)
179 fCellHintsList =
new TList(hints);
180 fRHdrHintsList =
new TList(hints);
181 fCHdrHintsList =
new TList(hints);
182 fMainHintsList =
new TList(hints);
190 fCurrentRange->fXbr = ncolumns;
191 fCurrentRange->fYbr = nrows;
195 if(fInterface) SetInterface(fInterface, nrows, ncolumns);
276 "UserRangeChange()");
287 "UserRangeChange()");
314 for(i = 0; i < nrows; i++) {
320 for(i = 0; i < ncolumns; i++) {
329 for (i = 0; i < nrows; i++) {
332 for (j = 0; j < ncolumns; j++) {
349 for (i = 0; i < nrows; i++) {
353 for (j = 0; j < ncolumns; j++) {
414 sbar->
Connect(
"PositionChanged(Int_t)",
"TGTable",
this,
"ScrollRHeaders(Int_t)");
416 sbar->
Connect(
"PositionChanged(Int_t)",
"TGTable",
this,
"ScrollCHeaders(Int_t)");
459 for (i = 0; i < ncolumns; i++) {
466 for (i = 0; i < ntrows; i++) {
468 for (j = 0; j < ncolumns; j++) {
497 for (i = 0; i < nrows; i++) {
504 for (j = 0; j < ntcolumns ; j++) {
528 for (
Int_t i = 0; i < ncolumns; i++) {
541 for (
Int_t i = 0; i < nrows; i++) {
561 UInt_t i = 0, j = 0, k = 0;
564 Info(
"TGTable::ShrinkColumns",
"Cannot shrink smaller than 1" 565 " column, adjusting");
576 for (i = 0; i < ntrows; i++) {
577 for (j = 0; j < ncolumns; j++) {
578 k = ntcolumns - ncolumns + j;
591 for (j = 0; j < ncolumns; j++) {
617 Info(
"TGTable::ShrinkRows",
"Cannot shrink smaller than 1 row, adjusting");
628 for (i = 0; i < nrows; i++) {
629 for (j = 0; j < ntcolumns ; j++) {
630 if (
GetRow(ntrows - nrows + i)) {
662 UInt_t max = 0, i = 0, d = 0;
665 for (i = 0; i < max; i++) {
672 for (i = 0; i < max; i++) {
731 if (newnrows != oldnrows){
732 if (newnrows > oldnrows) {
739 if (newncolumns != oldncolumns){
740 if (newncolumns > oldncolumns) {
748 if ((newncolumns != oldncolumns) || (newnrows != oldnrows)) {
759 newnrows, newncolumns));
762 for (i = 0; i < (
Int_t)newnrows; i++) {
766 for (j = 0; j < (
Int_t)newncolumns; j++) {
823 for(
UInt_t ui = 0; ui < nrows; ui++) {
930 for (i = 0; i < nrows; i++) {
931 for (j = 0; j < ncolumns; j++) {
954 std::ios_base::fmtflags org_flags = std::cout.flags();
956 for (j = 0; j < ncolumns + 1; j++) {
959 if (hdr) std::cout <<
" " << std::setw(12) << std::right
963 if (hdr) std::cout <<
" " << std::setw(12) << std::right
967 std::cout << std::endl;
969 for (i = 0; i < nrows; i++) {
970 for (j = 0; j < ncolumns + 1; j++) {
973 if (hdr) std::cout <<
" " << std::setw(12) << std::right
977 if (cell) std::cout <<
" " << std::setw(12) << std::right
981 std::cout << std::endl;
984 std::cout.flags(org_flags);
1080 for (i = 0; i < nrows; i++) {
1081 for (j = 0; j < ncolumns; j++) {
1247 for (i = 0; i < nrows; i++) {
1248 for (j = 0; j < ncolumns; j++) {
1275 for (i = 0; i < nrows; i++) {
1276 for (j = 0; j < ncolumns; j++) {
1302 for (i = 0; i < nrows; i++) {
1310 for (j = 0; j < ncolumns; j++) {
1352 if(xtl == xbr || ytl == ybr) {
1353 Error(
"TGTable::GotoTableRange",
"x or y range = 0");
1361 Info(
"TGTable::GotoTableRange",
"Swapping x-range boundries");
1367 Info(
"TGTable::GotoTableRange",
"Swapping y-range boundries");
1373 if((xtl < 0) || (xbr < 0)) {
1374 Info(
"TGTable::GotoTableRange",
"Column boundry out of bounds, adjusting");
1383 if((ytl < 0) || (ybr < 0)) {
1384 Info(
"TGTable::GotoTableRange",
"Row boundry out of bounds, adjusting");
1394 Info(
"TGTable::GotoTableRange",
"Left Column boundry out of bounds, " 1397 xtl = xbr - ncolumns;
1401 Info(
"TGTable::GotoTableRange",
"Right column boundry out of" 1402 " bounds, set to 0");
1406 Info(
"TGTable::GotoTableRange",
"Bottom row boundry out of bounds, " 1413 Info(
"TGTable::GotoTableRange",
"Top row boundry out of bounds, " 1504 if(!topleft.Contains(
","))
return;
1508 TString jtl = topleft(pos+1, topleft.Length());
1519 if(!range.Contains(
"x"))
return;
1522 pos = range.
First(
'x');
1524 TString jr = range(pos+1, range.Length());
1567 std::cout <<
"Range = (" <<
fXtl <<
"," <<
fYtl <<
")->(" 1568 <<
fXbr <<
"," <<
fYbr <<
")" << std::endl;
TGHorizontalFrame * fTopFrame
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
virtual TObjArray * GetColumn(UInt_t columns)
Return a pointer to a TObjArray that contains pointers to all the cells in column.
virtual const TGTableCell * FindCell(TGString label) const
Const version of FindCell().
virtual void SetLabel(const char *label)
Set the label of this cell to label.
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
virtual UInt_t GetNDataColumns() const
Return the amount of columns in the data source.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
virtual UInt_t GetNColumns()=0
virtual UInt_t GetOptions() const
virtual Pixel_t GetHeaderBackground() const
Get the background color of headers.
TGTableFrame * fTableFrame
virtual void SetAlignment(ETextJustification mode=kTextLeft)
Sets the alignment of the text entry.
TGHorizontalFrame(const TGWindow *p=0, UInt_t w=1, UInt_t h=1, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
virtual void Show()
Show the contents of the TGTable in stdout.
virtual void SetHeaderBackground(Pixel_t pixel)
Set the background color for the headers.
TGTableHeaderFrame * fCHdrFrame
virtual TGTableCell * operator()(UInt_t row, UInt_t column)
Operator for easy cell acces.
virtual void Update()
Update the range of the available data and refresh the current view.
virtual void Expand(UInt_t nrows, UInt_t ncolumns)
Expand a TGTable by nrows and ncolumns.
virtual void DoRedraw()
Redraw the TGTable.
static Pixel_t GetWhitePixel()
Get white pixel value.
TGTextButton * fNextButton
virtual void NextChunk()
Move the table to the next chunk of the data set with the same size.
virtual UInt_t GetNTableCells() const
Return the amount of cells in the table.
virtual UInt_t GetNTableColumns() const
Return the amount of columns in the table.
virtual void SetContainer(TGFrame *f)
virtual void UpdateHeaders(EHeaderType type)
Update the labels of the headers of the given type.
virtual TObjArray * GetRow(UInt_t row)
Get row.
virtual void SetLayoutManager(TGLayoutManager *l)
Set the layout manager for the composite frame.
virtual void GotoTableRange(Int_t xtl, Int_t ytl, Int_t xbr, Int_t ybr)
Move and resize the table to the specified range.
virtual void RemoveAll()
Remove all frames from composite frame.
virtual UInt_t GetWidth() const
TGFrame * GetContainer() const
Pixel_t fHeaderBackground
TObject * At(Int_t idx) const
virtual void PreviousChunk()
Move the table to the previous chunk of the data set with the same size.
TGHorizontalFrame * fBottomFrame
virtual UInt_t GetNDataRows() const
Return the amount of rows in the data source.
virtual void Layout()
Layout the elements of the composite frame.
void SetCanvas(TGCanvas *canvas)
TGTableHeaderFrame * fRHdrFrame
TGLabel * fFirstCellLabel
TGHorizontalFrame * fButtonFrame
virtual ~TGTable()
TGTable destructor.
Bool_t operator==(TTableRange &other)
Operator to determine if 2 ranges are equal.
virtual void SetEvenRowBackground(Pixel_t pixel)
Set the background color for all even numbered rows.
Bool_t IsAlnum() const
Returns true if all characters in string are alphanumeric.
TGTableHeader * fTableHeader
virtual void ScrollCHeaders(Int_t xpos)
Scroll the column headers horizontally.
virtual void Shrink(UInt_t nrows, UInt_t ncolumns)
Shrink the TGTable by nrows and ncolumns.
Pixel_t fOddRowBackground
virtual void DrawRegion(Int_t x, Int_t y, UInt_t w, UInt_t h)
Draw a region of container in viewport.
virtual void SetOddRowBackground(Pixel_t pixel)
Set the background color for all odd numbered rows.
virtual void SetBackgroundColor(Pixel_t back)
Set background color (override from TGWindow base class).
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Adding a frame to a canvas is actually adding the frame to the viewport container.
Ssiz_t First(char c) const
Find first occurrence of a character c.
virtual TGTableHeader * GetTableHeader()
Return a pointer to the table header.
virtual void ScrollRHeaders(Int_t ypos)
Scroll the row headers vertically.
virtual const char * GetColumnHeader(UInt_t column)=0
static ULong_t RGB2Pixel(Int_t r, Int_t g, Int_t b)
Convert r,g,b to graphics system dependent pixel value.
virtual void UpdateView()
Update and layout the visible part of the TGTable.
TGViewPort * GetViewPort() const
virtual void MoveTable(Int_t rows, Int_t columns)
Move and layout the table to the specified range.
TGTextButton * fUpdateButton
TGFrame * GetFrame() const
virtual void SetDefaultColors()
Set the background color for all rows and headers to their defaults.
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot...
virtual void ExpandRows(UInt_t nrows)
Expand the rows of a TGTable by nrows.
virtual void SetInterface(TVirtualTableInterface *interface, UInt_t nrows=50, UInt_t ncolumns=20)
Set the interface that the TGTable uses to interface.
TVirtualTableInterface * fInterface
virtual void MapSubwindows()
Map all canvas sub windows.
virtual TObject * RemoveAt(Int_t idx)
Remove object at index idx.
virtual const char * GetValueAsString(UInt_t row, UInt_t column)=0
virtual void UserRangeChange()
Slot used when the text in one of the range frame text entries changes.
virtual void ExpandColumns(UInt_t ncolumns)
Expand the columns of a TGTable by ncolumns.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
TGHScrollBar * GetHScrollbar() const
virtual void ChangeOptions(UInt_t options)
Change composite frame options. Options is an OR of the EFrameTypes.
virtual UInt_t GetNRows()=0
TTableRange * fCurrentRange
virtual UInt_t GetNTableRows() const
Return the amount of rows in the table.
virtual void AddAt(TObject *obj, Int_t idx)
Add object at position ids.
TObjArray * fColumnHeaders
virtual void Move(Int_t x, Int_t y)
Move frame.
const char * GetString() const
const char * GetText() const
Pixel_t fEvenRowBackground
virtual void SetWidth(UInt_t w)
virtual void ShrinkColumns(UInt_t ncolumns)
Shrink the columns of the TGTable by ncolumns.
virtual UInt_t GetHeight() const
virtual UInt_t GetCHdrWidth() const
Get the current width of the column header frame.
TTableRange()
TTableRange constuctor.
virtual TGString * GetLabel() const
virtual void ShrinkRows(UInt_t nrows)
Shrink the rows of the TGTable by nrows.
virtual void Expand(Int_t newSize)
Expand or shrink the array to newSize elements.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
TGTextButton * fPrevButton
virtual const TGTableHeader * GetRowHeader(const UInt_t row) const
Const version of GetRowHeader();.
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
virtual void UpdateRangeFrame()
Update the range shown in the range frame.
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
TGTextEntry * fFirstCellEntry
virtual Pixel_t GetRowBackground(UInt_t row) const
Get the background collor for row.
virtual void Layout()
Create layout for canvas.
virtual void Add(TObject *obj)
virtual void Print()
Print the values of a range.
virtual void Goto()
Slot used by the Goto button and whenever return is pressed in on of the text entries in the range fr...
Int_t Atoi() const
Return integer value of string.
virtual UInt_t GetNDataCells() const
Return the amount of cell in the data source.
virtual const char * GetRowHeader(UInt_t row)=0
virtual const TGTableHeader * GetColumnHeader(const UInt_t column) const
Const version of GetColumnHeader();.
virtual void SetText(const char *text, Bool_t emit=kTRUE)
Sets text entry to text, clears the selection and moves the cursor to the end of the line...
TGHorizontalFrame * fRangeFrame
TGTextButton * fGotoButton
virtual const TTableRange * GetCurrentRange() const
Return the current range of the TGTable.
virtual void Init()
Initialise the TGTable.
TGHorizontalFrame * fTopExtraFrame
TGTextEntry * fRangeEntry
TGVScrollBar * GetVScrollbar() const
virtual void DestroyWindow()
virtual const TGTableCell * GetCell(UInt_t i, UInt_t j) const
Const version of GetCell().
virtual void SetWindowName(const char *name=0)
Set window name.
virtual void ResizeTable(UInt_t nrows, UInt_t ncolumns)
Resize the table to newnrows and newncolumns and add all the frames to their parent frames...
virtual UInt_t GetRHdrHeight() const
Get the current height of the row header frame.
const char * Data() const