144 for (i = 0; i <
fNrows; ++i)
fRow[i].fDefSize = 0;
145 for (i = 0; i <
fNcols; ++i)
fCol[i].fDefSize = 0;
157 if (ptr->
fState == 0)
continue;
161 Error(
"FindRowColSizesSinglyAttached",
"didn't get TGTableLayoutHints from %s, layout = 0x%zx",
189 UInt_t max_width = 0, max_height = 0, col, row;
192 for (col = 0; col <
fNcols; ++col)
195 for (row = 0; row <
fNrows; ++row)
199 for (col = 0; col <
fNcols; ++col)
fCol[col].fDefSize = max_width;
200 for (row = 0; row <
fNrows; ++row)
fRow[row].fDefSize = max_height;
212 if (ptr->
fState == 0)
continue;
216 Error(
"FindRowColSizesMultiplyAttached",
"didn't get TGTableLayoutHints");
221 if (left != right-1) {
223 for (col = left; col < right; ++col)
width +=
fCol[col].fDefSize;
229 if (
width < child_width) {
231 for (col = left; col < right; ++col) {
240 if (top != bottom-1) {
242 for (row = top; row < bottom; ++row)
height +=
fRow[row].fDefSize;
248 if (
height < child_height) {
250 for (row = top; row < bottom; ++row) {
269 UInt_t ind, nshrink=0, nexpand=0, cur_size=0;
271 for (ind = 0; ind < nthings; ++ind)
272 cur_size += thing[ind].fDefSize;
274 if (cur_size < real_size) {
275 for (ind = 0; ind < nthings; ++ind)
276 if (thing[ind].fExpand) { ++ nexpand;
break; }
279 for (ind = 0; ind < nthings; ++ ind) {
286 if (cur_size > real_size) {
287 for (ind = 0; ind < nthings; ++ind)
288 if (thing[ind].fShrink) { ++ nshrink;
break; }
291 for (ind = 0; ind < nthings; ++ ind) {
300 for (ind = 0; ind < nthings; ++ind) {
302 if (thing[ind].fExpand) ++ nexpand;
303 if (thing[ind].fShrink) ++ nshrink;
307 if ((
size < real_size) && (nexpand >= 1)) {
309 for (ind = 0; ind < nthings; ++ind) {
310 if (thing[ind].fExpand) {
320 if (
size > real_size) {
321 UInt_t total_nshrink = nshrink;
323 while (total_nshrink > 0 && extra > 0) {
324 nshrink = total_nshrink;
325 for (ind = 0; ind < nthings; ++ind)
326 if (thing[ind].fShrink) {
331 if (thing[ind].fRealSize < 2) {
363 for (col = 0; col <
fNcols; ++col) {
372 for (row = 0; row <
fNrows; ++row) {
388 Error(
"SetRowColSizesInit",
"didn't get TGTableLayoutHints");
417 Error(
"SetRowColSizesInit",
"didn't get TGTableLayoutHints");
425 if (left != right - 1) {
426 for (col = left; col < right; ++col)
fCol[col].fEmpty =
kFALSE;
429 for (col = left; col < right; ++col)
430 if (
fCol[col].fExpand) { has_expand =
kTRUE;
break; }
432 for (col = left; col < right; ++col)
436 for (col = left; col < right; ++col)
437 if (!
fCol[col].fShrink) { has_shrink =
kFALSE;
break;}
439 for (col = left; col < right; ++col)
447 if (top != bottom - 1) {
448 for (row = top; row < bottom; ++row)
fRow[row].fEmpty =
kFALSE;
451 for (row = top; row < bottom; ++row)
452 if (
fRow[row].fExpand) { has_expand =
kTRUE;
break; }
454 for (row = top; row < bottom; ++row)
458 for (row = top; row < bottom; ++row)
459 if (!
fRow[row].fShrink) { has_shrink =
kFALSE;
break;}
461 for (row = top; row < bottom; ++row)
468 for (col = 0; col <
fNcols; ++col) {
469 if (
fCol[col].fEmpty) {
477 for (row = 0; row <
fNrows; ++row) {
478 if (
fRow[row].fEmpty) {
500 Error(
"CheckSanity",
"didn't get TGTableLayoutHints");
511 Error(
"CheckSanity",
"AttachLeft == AttachRight");
515 Error(
"CheckSanity",
"AttachLeft > AttachRight");
519 Error(
"CheckSanity",
"AttachLeft illegal value: %u", left);
521 if (right < 1 || right >
fNcols) {
523 Error(
"CheckSanity",
"AttachRight illegal value: %u", right);
528 Error(
"CheckSanity",
"AttachTop == AttachBottom");
532 Error(
"CheckSanity",
"AttachTop > AttachBottom");
536 Error(
"CheckSanity",
"AttachTop illegal value: %u", top);
538 if (bottom < 1 || bottom >
fNrows) {
540 Error(
"CheckSanity",
"AttachBottom illegal value: %u", bottom);
568 Error(
"TGTableLayout::Layout",
"didn't get TGTableLayoutHints");
580 UInt_t col, cell_x = border_width + left*
fSep;
581 for (col = 0; col < left; ++col) cell_x +=
fCol[col].fRealSize;
584 for (row = 0; row < top; ++row) cell_y +=
fRow[row].fRealSize;
587 for (col=left; col < right; ++col)
588 cell_width +=
fCol[col].fRealSize;
591 for (row=top; row < bottom; ++row)
592 cell_height +=
fRow[row].fRealSize;
602 ww = cell_width - pad_left - pad_right;
606 hh = cell_height - pad_top - pad_bottom;
613 xx = cell_x + pad_left;
615 xx = cell_x + cell_width - pad_right - ww;
617 xx = cell_x + cell_width/2 - ww/2;
619 xx = cell_x + pad_left;
623 yy = cell_y + pad_top;
625 yy = cell_y + cell_height - pad_bottom - hh;
627 yy = cell_y + cell_height/2 - hh/2;
629 yy = cell_y + pad_top;
678 if (hints.
Length() == 0) hints =
"kLHintsLeft";
679 else hints +=
" | kLHintsLeft";
682 if (hints.
Length() == 0) hints =
"kLHintsCenterX";
683 else hints +=
" | kLHintsCenterX";
686 if (hints.
Length() == 0) hints =
"kLHintsRight";
687 else hints +=
" | kLHintsRight";
690 if (hints.
Length() == 0) hints =
"kLHintsTop";
691 else hints +=
" | kLHintsTop";
694 if (hints.
Length() == 0) hints =
"kLHintsCenterY";
695 else hints +=
" | kLHintsCenterY";
698 if (hints.
Length() == 0) hints =
"kLHintsBottom";
699 else hints +=
" | kLHintsBottom";
702 if (hints.
Length() == 0) hints =
"kLHintsExpandX";
703 else hints +=
" | kLHintsExpandX";
706 if (hints.
Length() == 0) hints =
"kLHintsExpandY";
707 else hints +=
" | kLHintsExpandY";
710 if (hints.
Length() == 0) hints =
"kLHintsShrinkX";
711 else hints +=
" | kLHintsShrinkX";
714 if (hints.
Length() == 0) hints =
"kLHintsShrinkY";
715 else hints +=
" | kLHintsShrinkY";
718 if (hints.
Length() == 0) hints =
"kLHintsFillX";
719 else hints +=
" | kLHintsFillX";
722 if (hints.
Length() == 0) hints =
"kLHintsFillY";
723 else hints +=
" | kLHintsFillY";
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
The base class for composite widgets (menu bars, list boxes, etc.).
virtual TList * GetList() const
virtual TGDimension GetDefaultSize() const
std::cout << fWidth << "x" << fHeight << std::endl;
void MoveResize(Int_t x, Int_t y, UInt_t w=0, UInt_t h=0) override
Move and/or resize the frame.
Int_t GetBorderWidth() const
virtual UInt_t GetDefaultWidth() const
virtual UInt_t GetDefaultHeight() const
TGDimension GetSize() const
virtual UInt_t GetOptions() const
Int_t GetPadRight() const
Int_t GetPadBottom() const
ULong_t GetLayoutHints() const
This class describes layout hints used by the TGTableLayout class.
void SavePrimitive(std::ostream &out, Option_t *="") override
Save layout hints as a C++ statement(s) on output stream out.
UInt_t GetAttachLeft() const
UInt_t GetAttachTop() const
UInt_t GetAttachBottom() const
UInt_t GetAttachRight() const
A layout manager, which places child frames in a table arranged in rows and columns,...
Bool_t fHomogeneous
all cols/rows same size
void FindRowColSizesMultiplyAttached()
Checks any children which span multiple col/rows.
~TGTableLayout() override
TGTableLayout constructor.
void FindRowColSizesHomogeneous()
If the table is homogeneous make sure all col/rows are same size as biggest col/row.
void SetRowColSizes()
This gets the new sizes needed to fit the table to the parent frame.
TableData_t * fRow
info about each row
void Layout() override
Make a table layout of all frames in the list.
Int_t fHints
layout hints (currently not used)
static void SetRowColResize(UInt_t real_size, UInt_t nthings, TableData_t *thing, Bool_t homogeneous)
If main frame is bigger or smaller than all children, expand/shrink to fill.
void FindRowColSizesSinglyAttached()
Determine the size of rows/cols needed for singly attached children.
UInt_t fNcols
number of columns
void FindRowColSizesInit()
Initialize values needed to determine the size of rows and columns.
Int_t fSep
interval between frames
void CheckSanity()
Sanity check various values.
UInt_t fNrows
number of rows
TableData_t * fCol
info about each column
TList * fList
list of frames to arrange
void SavePrimitive(std::ostream &out, Option_t *="") override
Save a primitive as a C++ statement(s) on output stream "out".
TGCompositeFrame * fMain
container frame
TGTableLayout(const TGTableLayout &)=delete
TGDimension GetDefaultSize() const override
Return default dimension of the table layout.
void FindRowColSizes()
Find the sizes of rows and columns needed to satisfy children's layout policies.
void SetRowColSizesInit()
Initialize rows/cols.
const char * GetName() const override
Return unique name, used in SavePrimitive methods.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
UInt_t fDefSize
Default size of col/rows.
UInt_t fRealSize
Real size of col/rows (eg, if table resize)