97 fList = fMain->GetList();
104 fHomogeneous = homogeneous;
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%lx",
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) {
230 width = child_width - width;
231 for (col = left; col < right; ++col) {
232 UInt_t extra = width / (right - col);
240 if (top != bottom-1) {
242 for (row = top; row < bottom; ++row) height +=
fRow[row].fDefSize;
248 if (height < child_height) {
249 height = child_height - height;
250 for (row = top; row < bottom; ++row) {
251 UInt_t extra = height / (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) {
280 UInt_t extra = size / (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) {
292 UInt_t extra = size / (nthings - ind);
299 UInt_t ind, nshrink=0, nexpand=0, size=0;
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)) {
308 size = real_size - size;
309 for (ind = 0; ind < nthings; ++ind) {
310 if (thing[ind].fExpand) {
311 UInt_t extra = size / nexpand;
320 if (size > real_size) {
321 UInt_t total_nshrink = nshrink;
322 UInt_t extra = size - real_size;
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;
586 UInt_t cell_width = (right-left-1)*fSep;
587 for (col=left; col < right; ++col)
588 cell_width +=
fCol[col].fRealSize;
590 UInt_t cell_height = (bottom-top-1)*fSep;
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;
612 if (hints & kLHintsFillX)
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;
622 if (hints & kLHintsFillY)
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;
671 UInt_t pad = GetPadLeft()+GetPadRight()+GetPadTop()+GetPadBottom();
673 if (!GetLayoutHints())
return;
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";
725 out <<
", new TGTableLayoutHints(" << GetAttachLeft() <<
"," << GetAttachRight()
726 <<
"," << GetAttachTop() <<
"," << GetAttachBottom()
730 out <<
"," << GetPadLeft() <<
"," << GetPadRight()
731 <<
"," << GetPadTop() <<
"," << GetPadBottom();
virtual TGDimension GetDefaultSize() const
std::cout << fWidth << "x" << fHeight << std::endl;
virtual void SavePrimitive(std::ostream &out, Option_t *="")
Save a primitive as a C++ statement(s) on output stream "out".
UInt_t GetAttachLeft() const
Int_t GetBorderWidth() const
virtual UInt_t GetOptions() const
virtual void MoveResize(Int_t x, Int_t y, UInt_t w=0, UInt_t h=0)
Move and/or resize the frame.
ULong_t GetLayoutHints() const
UInt_t GetAttachTop() const
void FindRowColSizesHomogeneous()
If the table is homogeneous make sure all col/rows are same size as biggest col/row.
virtual void Layout()
Make a table layout of all frames in the list.
void SetRowColSizesInit()
Initialize rows/cols.
UInt_t GetAttachRight() const
void FindRowColSizesSinglyAttached()
Determine the size of rows/cols needed for singly attached children.
void FindRowColSizesMultiplyAttached()
Checks any children which span multiple col/rows.
virtual const char * GetName() const
Return unique name, used in SavePrimitive methods.
UInt_t GetAttachBottom() const
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
void CheckSanity()
Sanity check various values.
virtual UInt_t GetDefaultWidth() const
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 SetRowColSizes()
This gets the new sizes needed to fit the table to the parent frame.
TGDimension GetSize() const
void FindRowColSizes()
Find the sizes of rows and columns needed to statisfy children's layout policies. ...
virtual UInt_t GetDefaultHeight() const
virtual ~TGTableLayout()
TGTableLayout constructor.
Int_t GetPadRight() const
Short_t Max(Short_t a, Short_t b)
void FindRowColSizesInit()
Initialize values needed to determine the size of rows and columns.
virtual TGDimension GetDefaultSize() const
Return default dimension of the table layout.
virtual void SavePrimitive(std::ostream &out, Option_t *="")
Save a primitive as a C++ statement(s) on output stream "out".
int main(int argc, char **argv)
if(line.BeginsWith("/*"))
Int_t GetPadBottom() const