145 for (i = 0; i <
fNrows; ++i)
fRow[i].fDefSize = 0;
146 for (i = 0; i <
fNcols; ++i)
fCol[i].fDefSize = 0;
158 if (ptr->
fState == 0)
continue;
162 Error(
"FindRowColSizesSinglyAttached",
"didn't get TGTableLayoutHints from %s, layout = 0x%lx",
190 UInt_t max_width = 0, max_height = 0, col, row;
193 for (col = 0; col <
fNcols; ++col)
196 for (row = 0; row <
fNrows; ++row)
200 for (col = 0; col <
fNcols; ++col)
fCol[col].fDefSize = max_width;
201 for (row = 0; row <
fNrows; ++row)
fRow[row].fDefSize = max_height;
213 if (ptr->
fState == 0)
continue;
217 Error(
"FindRowColSizesMultiplyAttached",
"didn't get TGTableLayoutHints");
222 if (left != right-1) {
224 for (col = left; col < right; ++col)
width +=
fCol[col].fDefSize;
230 if (
width < child_width) {
232 for (col = left; col < right; ++col) {
241 if (top != bottom-1) {
243 for (row = top; row < bottom; ++row) height +=
fRow[row].fDefSize;
249 if (height < child_height) {
250 height = child_height - height;
251 for (row = top; row < bottom; ++row) {
252 UInt_t extra = height / (bottom - row);
270 UInt_t ind, nshrink=0, nexpand=0, cur_size=0;
272 for (ind = 0; ind < nthings; ++ind)
273 cur_size += thing[ind].fDefSize;
275 if (cur_size < real_size) {
276 for (ind = 0; ind < nthings; ++ind)
277 if (thing[ind].fExpand) { ++ nexpand;
break; }
280 for (ind = 0; ind < nthings; ++ ind) {
281 UInt_t extra = size / (nthings - ind);
287 if (cur_size > real_size) {
288 for (ind = 0; ind < nthings; ++ind)
289 if (thing[ind].fShrink) { ++ nshrink;
break; }
292 for (ind = 0; ind < nthings; ++ ind) {
293 UInt_t extra = size / (nthings - ind);
300 UInt_t ind, nshrink=0, nexpand=0, size=0;
301 for (ind = 0; ind < nthings; ++ind) {
303 if (thing[ind].fExpand) ++ nexpand;
304 if (thing[ind].fShrink) ++ nshrink;
308 if ((size < real_size) && (nexpand >= 1)) {
309 size = real_size - size;
310 for (ind = 0; ind < nthings; ++ind) {
311 if (thing[ind].fExpand) {
312 UInt_t extra = size / nexpand;
321 if (size > real_size) {
322 UInt_t total_nshrink = nshrink;
323 UInt_t extra = size - real_size;
324 while (total_nshrink > 0 && extra > 0) {
325 nshrink = total_nshrink;
326 for (ind = 0; ind < nthings; ++ind)
327 if (thing[ind].fShrink) {
332 if (thing[ind].fRealSize < 2) {
364 for (col = 0; col <
fNcols; ++col) {
373 for (row = 0; row <
fNrows; ++row) {
389 Error(
"SetRowColSizesInit",
"didn't get TGTableLayoutHints");
418 Error(
"SetRowColSizesInit",
"didn't get TGTableLayoutHints");
426 if (left != right - 1) {
427 for (col = left; col < right; ++col)
fCol[col].fEmpty =
kFALSE;
430 for (col = left; col < right; ++col)
431 if (
fCol[col].fExpand) { has_expand =
kTRUE;
break; }
433 for (col = left; col < right; ++col)
437 for (col = left; col < right; ++col)
438 if (!
fCol[col].fShrink) { has_shrink =
kFALSE;
break;}
440 for (col = left; col < right; ++col)
448 if (top != bottom - 1) {
449 for (row = top; row < bottom; ++row)
fRow[row].fEmpty =
kFALSE;
452 for (row = top; row < bottom; ++row)
453 if (
fRow[row].fExpand) { has_expand =
kTRUE;
break; }
455 for (row = top; row < bottom; ++row)
459 for (row = top; row < bottom; ++row)
460 if (!
fRow[row].fShrink) { has_shrink =
kFALSE;
break;}
462 for (row = top; row < bottom; ++row)
469 for (col = 0; col <
fNcols; ++col) {
470 if (
fCol[col].fEmpty) {
478 for (row = 0; row <
fNrows; ++row) {
479 if (
fRow[row].fEmpty) {
501 Error(
"CheckSanity",
"didn't get TGTableLayoutHints");
512 Error(
"CheckSanity",
"AttachLeft == AttachRight");
516 Error(
"CheckSanity",
"AttachLeft > AttachRight");
520 Error(
"CheckSanity",
"AttachLeft illegal value: %u", left);
522 if (right < 1 || right >
fNcols) {
524 Error(
"CheckSanity",
"AttachRight illegal value: %u", right);
529 Error(
"CheckSanity",
"AttachTop == AttachBottom");
533 Error(
"CheckSanity",
"AttachTop > AttachBottom");
537 Error(
"CheckSanity",
"AttachTop illegal value: %u", top);
539 if (bottom < 1 || bottom >
fNrows) {
541 Error(
"CheckSanity",
"AttachBottom illegal value: %u", bottom);
569 Error(
"TGTableLayout::Layout",
"didn't get TGTableLayoutHints");
581 UInt_t col, cell_x = border_width + left*
fSep;
582 for (col = 0; col < left; ++col) cell_x +=
fCol[col].fRealSize;
585 for (row = 0; row < top; ++row) cell_y +=
fRow[row].fRealSize;
588 for (col=left; col < right; ++col)
589 cell_width +=
fCol[col].fRealSize;
592 for (row=top; row < bottom; ++row)
593 cell_height +=
fRow[row].fRealSize;
603 ww = cell_width - pad_left - pad_right;
607 hh = cell_height - pad_top - pad_bottom;
614 xx = cell_x + pad_left;
616 xx = cell_x + cell_width - pad_right - ww;
618 xx = cell_x + cell_width/2 - ww/2;
620 xx = cell_x + pad_left;
624 yy = cell_y + pad_top;
626 yy = cell_y + cell_height - pad_bottom - hh;
628 yy = cell_y + cell_height/2 - hh/2;
630 yy = cell_y + pad_top;
679 if (hints.
Length() == 0) hints =
"kLHintsLeft";
680 else hints +=
" | kLHintsLeft";
683 if (hints.
Length() == 0) hints =
"kLHintsCenterX";
684 else hints +=
" | kLHintsCenterX";
687 if (hints.
Length() == 0) hints =
"kLHintsRight";
688 else hints +=
" | kLHintsRight";
691 if (hints.
Length() == 0) hints =
"kLHintsTop";
692 else hints +=
" | kLHintsTop";
695 if (hints.
Length() == 0) hints =
"kLHintsCenterY";
696 else hints +=
" | kLHintsCenterY";
699 if (hints.
Length() == 0) hints =
"kLHintsBottom";
700 else hints +=
" | kLHintsBottom";
703 if (hints.
Length() == 0) hints =
"kLHintsExpandX";
704 else hints +=
" | kLHintsExpandX";
707 if (hints.
Length() == 0) hints =
"kLHintsExpandY";
708 else hints +=
" | kLHintsExpandY";
711 if (hints.
Length() == 0) hints =
"kLHintsShrinkX";
712 else hints +=
" | kLHintsShrinkX";
715 if (hints.
Length() == 0) hints =
"kLHintsShrinkY";
716 else hints +=
" | kLHintsShrinkY";
719 if (hints.
Length() == 0) hints =
"kLHintsFillX";
720 else hints +=
" | kLHintsFillX";
723 if (hints.
Length() == 0) hints =
"kLHintsFillY";
724 else hints +=
" | kLHintsFillY";
include TDocParser_001 C image html pict1_TDocParser_001 png width
virtual TList * GetList() const
virtual TGDimension GetDefaultSize() const
std::cout << fWidth << "x" << fHeight << std::endl;
Int_t GetBorderWidth() const
virtual UInt_t GetDefaultWidth() const
virtual UInt_t GetDefaultHeight() const
TGDimension GetSize() 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.
Int_t GetPadRight() const
Int_t GetPadBottom() const
ULong_t GetLayoutHints() const
virtual void SavePrimitive(std::ostream &out, Option_t *="")
Save a primitive 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
virtual TGDimension GetDefaultSize() const
Return default dimension of the table layout.
void FindRowColSizesMultiplyAttached()
Checks any children which span multiple col/rows.
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.
virtual void SavePrimitive(std::ostream &out, Option_t *="")
Save a primitive as a C++ statement(s) on output stream "out".
virtual void Layout()
Make a table layout of all frames in the list.
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.
void FindRowColSizesInit()
Initialize values needed to determine the size of rows and columns.
void CheckSanity()
Sanity check various values.
TGTableLayout(const TGTableLayout &)=delete
void FindRowColSizes()
Find the sizes of rows and columns needed to statisfy children's layout policies.
void SetRowColSizesInit()
Initialize rows/cols.
virtual ~TGTableLayout()
TGTableLayout constructor.
virtual const char * GetName() const
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)