Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGTableLayout.cxx
Go to the documentation of this file.
1// @(#)root/gui:$Id$
2// Author: Brett Viren 04/15/2001
3
4/*************************************************************************
5 * Copyright (C) 2001, Brett Viren *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11/**************************************************************************
12
13 This source is based on Xclass95, a Win95-looking GUI toolkit.
14 Copyright (C) 1996, 1997 David Barth, Ricky Ralston, Hector Peraza.
15
16 Xclass95 is free software; you can redistribute it and/or
17 modify it under the terms of the GNU Library General Public
18 License as published by the Free Software Foundation; either
19 version 2 of the License, or (at your option) any later version.
20
21**************************************************************************/
22/**************************************************************************
23
24 The Layout algorithm was largely translated from GTK's gtktable.c
25 source. That source is also distributed under LGPL.
26
27**************************************************************************/
28
29
30/** \class TGTableLayout
31 \ingroup guiwidgets
32
33A layout manager, which places child frames in a table arranged in
34rows and columns, making it easy to align many widgets next each to
35other horizontally and vertically. It uses TGTableLayoutHints
36(not TGLayoutHints!!!) and works like TGMatrixLayout with the
37addition that:
38 - Child frames can span more than one column/row.
39 - Child frames can resize with the frame.
40 - Column and row sizes are not fixed nor (optionally) homogeneous.
41 - The number of columns and rows must be fully specified in the constructor.
42The gaps between all rows or columns can be specified by 'sep'
43parameter in the constructor. All rows and columns will have the
44same size (set by widest and the highest child frame) if the
45parameter 'homogeneous' is set to kTRUE.
46
47
48\class TGTableLayoutHints
49\ingroup guiwidgets
50
51This class describes layout hints used by the TGTableLayout class.
52It specifies the column/row division number on which to attach the
53child frame. This number starts from 0 and goes to #%_columns/#%_rows
54respectively (0 indicates the first row/column).
55
56Below are described all parameters of TGTableLayoutHints constructor
57 - attach_left - the column to the left of the widget;
58 - attach_right - the column to the right of the widget;
59 - attach_top - the row above the widget;
60 - attach_bottom - the row below the widget;
61 - hints - layout hints (combination of ELayoutHints)
62
63The next parameters determine the extra padding added around the
64child frame. By default these are 0.
65 - padleft - determines the extra padding added on the left
66 - padright - determines the extra padding added on the right
67 - padtop - determines the extra padding added on the top
68 - padbottom - determines the extra padding added on the bottom
69
70*/
71
72
73#include "TGTableLayout.h"
74#include "TGFrame.h"
75#include "TList.h"
76#include "Rtypes.h"
77
78#include <iostream>
79
80
81
82////////////////////////////////////////////////////////////////////////////////
83/// TGTableLayout constructor.
84/// Note:
85/// - Number of rows first, number of Columns second
86/// - homogeneous == true means all table cells are the same size,
87/// set by the widest and the highest child frame.
88/// - s gives the amount of separation in pixels between cells
89/// - h are the hints, see TGTableLayoutHints.
90
104
105////////////////////////////////////////////////////////////////////////////////
106/// TGTableLayout constructor.
107
109{
110 if (fRow) delete [] fRow;
111 if (fCol) delete [] fCol;
112}
113
114////////////////////////////////////////////////////////////////////////////////
115/// Find the sizes of rows and columns needed to satisfy
116/// children's layout policies.
117
119{
120 // This is equiv. to GTK's requisition stage
121
127}
128
129////////////////////////////////////////////////////////////////////////////////
130/// Initialize values needed to determine the size of rows and columns.
131
133{
134 if (fRow) delete [] fRow;
135 if (fCol) delete [] fCol;
136 fRow = new TableData_t[fNrows];
137 fCol = new TableData_t[fNcols];
138
139 // Find max of each row and column
140
141 UInt_t i;
142 for (i = 0; i < fNrows; ++i) fRow[i].fDefSize = 0;
143 for (i = 0; i < fNcols; ++i) fCol[i].fDefSize = 0;
144}
145
146////////////////////////////////////////////////////////////////////////////////
147/// Determine the size of rows/cols needed for singly attached children.
148
150{
151 TIter next(fList);
152 TGFrameElement *ptr;
153
154 while ((ptr = (TGFrameElement *) next())) {
155 if (ptr->fState == 0) continue;
157 dynamic_cast<TGTableLayoutHints*>(ptr->fLayout);
158 if (!layout) {
159 Error("FindRowColSizesSinglyAttached", "didn't get TGTableLayoutHints from %s, layout = 0x%zx",
160 ptr->fFrame->GetName(), (size_t)ptr->fLayout);
161 return;
162 }
163 UInt_t col = layout->GetAttachLeft();
164 if (col == (layout->GetAttachRight() - 1))
165 fCol[col].fDefSize = std::max(fCol[col].fDefSize,
166 ptr->fFrame->GetDefaultWidth() +
167 layout->GetPadLeft() +
168 layout->GetPadRight());
169
170 UInt_t row = layout->GetAttachTop();
171 if (row == (layout->GetAttachBottom() - 1))
172 fRow[row].fDefSize = std::max(fRow[row].fDefSize,
173 ptr->fFrame->GetDefaultHeight() +
174 layout->GetPadTop() +
175 layout->GetPadBottom());
176 }
177}
178
179////////////////////////////////////////////////////////////////////////////////
180/// If the table is homogeneous make sure all col/rows are same
181/// size as biggest col/row.
182
184{
185 if (!fHomogeneous) return;
186
187 UInt_t max_width = 0, max_height = 0, col, row;
188
189 // find max
190 for (col = 0; col < fNcols; ++col)
191 max_width = std::max(max_width,fCol[col].fDefSize);
192
193 for (row = 0; row < fNrows; ++row)
194 max_height = std::max(max_height,fRow[row].fDefSize);
195
196 // set max
197 for (col = 0; col < fNcols; ++col) fCol[col].fDefSize = max_width;
198 for (row = 0; row < fNrows; ++row) fRow[row].fDefSize = max_height;
199}
200
201////////////////////////////////////////////////////////////////////////////////
202/// Checks any children which span multiple col/rows.
203
205{
206 TIter next(fList);
207 TGFrameElement *ptr;
208
209 while ((ptr = (TGFrameElement *) next())) {
210 if (ptr->fState == 0) continue;
212 dynamic_cast<TGTableLayoutHints*>(ptr->fLayout);
213 if (!layout) {
214 Error("FindRowColSizesMultiplyAttached", "didn't get TGTableLayoutHints");
215 return;
216 }
217 UInt_t left = layout->GetAttachLeft();
218 UInt_t right = layout->GetAttachRight();
219 if (left != right-1) { // child spans multi-columns
220 UInt_t width = 0, col;
221 for (col = left; col < right; ++col) width += fCol[col].fDefSize;
222
223 // If more space needed, divide space evenly among the columns
225 layout->GetPadLeft() + layout->GetPadRight();
226
227 if (width < child_width) {
229 for (col = left; col < right; ++col) {
230 UInt_t extra = width / (right - col);
231 fCol[col].fDefSize += extra;
232 width -= extra;
233 }
234 }
235 }
236 UInt_t top = layout->GetAttachTop();
237 UInt_t bottom = layout->GetAttachBottom();
238 if (top != bottom-1) { // child spans multi-rows
239 UInt_t height = 0, row;
240 for (row = top; row < bottom; ++row) height += fRow[row].fDefSize;
241
242 // If more space needed, divide space evenly among the rows
244 layout->GetPadTop() + layout->GetPadBottom();
245
246 if (height < child_height) {
248 for (row = top; row < bottom; ++row) {
249 UInt_t extra = height / (bottom - row);
250 fRow[row].fDefSize += extra;
251 height -= extra;
252 }
253 }
254 }
255 }
256}
257
258////////////////////////////////////////////////////////////////////////////////
259/// If main frame is bigger or smaller than all children,
260/// expand/shrink to fill. This is symmetric under row<-->col
261/// switching so it is abstracted out to a normal function to save typing.
262
265{
266 if (homogeneous) {
268
269 for (ind = 0; ind < nthings; ++ind)
270 cur_size += thing[ind].fDefSize;
271
272 if (cur_size < real_size) {
273 for (ind = 0; ind < nthings; ++ind)
274 if (thing[ind].fExpand) { ++ nexpand; break; }
275 if (nexpand > 0) {
277 for (ind = 0; ind < nthings; ++ ind) {
278 UInt_t extra = size / (nthings - ind);
279 thing[ind].fRealSize = std::max(1U, extra);
280 size -= extra;
281 }
282 }
283 }
284 if (cur_size > real_size) {
285 for (ind = 0; ind < nthings; ++ind)
286 if (thing[ind].fShrink) { ++ nshrink; break; }
287 if (nshrink > 0) {
289 for (ind = 0; ind < nthings; ++ ind) {
290 UInt_t extra = size / (nthings - ind);
291 thing[ind].fRealSize = std::max(1U, extra);
292 size -= extra;
293 }
294 }
295 }
296 } else {
297 UInt_t ind, nshrink=0, nexpand=0, size=0;
298 for (ind = 0; ind < nthings; ++ind) {
299 size += thing[ind].fDefSize;
300 if (thing[ind].fExpand) ++ nexpand;
301 if (thing[ind].fShrink) ++ nshrink;
302 }
303
304 // Did main frame expand?
305 if ((size < real_size) && (nexpand >= 1)) {
306 size = real_size - size;
307 for (ind = 0; ind < nthings; ++ind) {
308 if (thing[ind].fExpand) {
309 UInt_t extra = size / nexpand;
310 thing[ind].fRealSize += extra;
311 size -= extra;
312 --nexpand;
313 }
314 }
315 }
316
317 // Did main frame shrink?
318 if (size > real_size) {
320 UInt_t extra = size - real_size;
321 while (total_nshrink > 0 && extra > 0) {
323 for (ind = 0; ind < nthings; ++ind)
324 if (thing[ind].fShrink) {
325 UInt_t size2 = thing[ind].fRealSize;
326 thing[ind].fRealSize = std::max(1U,thing[ind].fRealSize - extra / nshrink);
327 extra -= size2 - thing[ind].fRealSize;
328 --nshrink;
329 if (thing[ind].fRealSize < 2) {
330 total_nshrink -= 1;
331 thing[ind].fShrink = kFALSE;
332 }
333 }
334 }
335 }
336 } // not homogeneous
337}
338
339////////////////////////////////////////////////////////////////////////////////
340/// This gets the new sizes needed to fit the table to the parent
341/// frame. To be called after FindRowColSizes.
342
353
354////////////////////////////////////////////////////////////////////////////////
355/// Initialize rows/cols. By default they do not expand and they
356/// do shrink. What the children want determine what the rows/cols do.
357
359{
360 UInt_t col;
361 for (col = 0; col < fNcols; ++col) {
362 fCol[col].fRealSize = fCol[col].fDefSize;
363 fCol[col].fNeedExpand = kFALSE;
364 fCol[col].fNeedShrink = kTRUE;
365 fCol[col].fExpand = kFALSE;
366 fCol[col].fShrink = kTRUE;
367 fCol[col].fEmpty = kTRUE;
368 }
369 UInt_t row;
370 for (row = 0; row < fNrows; ++row) {
371 fRow[row].fRealSize = fRow[row].fDefSize;
372 fRow[row].fNeedExpand = kFALSE;
373 fRow[row].fNeedShrink = kTRUE;
374 fRow[row].fExpand = kFALSE;
375 fRow[row].fShrink = kTRUE;
376 fRow[row].fEmpty = kTRUE;
377 }
378
379 // Check single row/col children for expand/shrink-ability
380 TIter next(fList);
381 TGFrameElement *ptr;
382 while ((ptr = (TGFrameElement*) next())) {
384 dynamic_cast<TGTableLayoutHints*>(ptr->fLayout);
385 if (!layout) {
386 Error("SetRowColSizesInit", "didn't get TGTableLayoutHints");
387 return;
388 }
389 ULong_t hints = layout->GetLayoutHints();
390
391 // columns
392 if (layout->GetAttachLeft() == layout->GetAttachRight()-1) {
393 if (hints & kLHintsExpandX)
394 fCol[layout->GetAttachLeft()].fExpand = kTRUE;
395 if (!(hints & kLHintsShrinkX))
396 fCol[layout->GetAttachLeft()].fShrink = kFALSE;
397 fCol[layout->GetAttachLeft()].fEmpty = kFALSE;
398 }
399 // rows
400 if (layout->GetAttachTop() == layout->GetAttachBottom()-1) {
401 if (hints & kLHintsExpandY)
402 fRow[layout->GetAttachTop()].fExpand = kTRUE;
403 if (!(hints & kLHintsShrinkY))
404 fRow[layout->GetAttachTop()].fShrink = kFALSE;
405 fRow[layout->GetAttachTop()].fEmpty = kFALSE;
406 }
407 }
408
409 // Do same for children of spanning multiple col/rows
410 next.Reset();
411 while ((ptr = (TGFrameElement*) next())) {
413 dynamic_cast<TGTableLayoutHints*>(ptr->fLayout);
414 if (!layout) {
415 Error("SetRowColSizesInit", "didn't get TGTableLayoutHints");
416 return;
417 }
418 ULong_t hints = layout->GetLayoutHints();
419
420 // columns
421 UInt_t left = layout->GetAttachLeft();
422 UInt_t right = layout->GetAttachRight();
423 if (left != right - 1) {
424 for (col = left; col < right; ++col) fCol[col].fEmpty = kFALSE;
426 if (hints & kLHintsExpandX) {
427 for (col = left; col < right; ++col)
428 if (fCol[col].fExpand) { has_expand = kTRUE; break; }
429 if (!has_expand)
430 for (col = left; col < right; ++col)
431 fCol[col].fNeedExpand = kTRUE;
432 }
433 if (!(hints & kLHintsShrinkX)) {
434 for (col = left; col < right; ++col)
435 if (!fCol[col].fShrink) { has_shrink = kFALSE; break;}
436 if (has_shrink)
437 for (col = left; col < right; ++col)
438 fCol[col].fNeedShrink = kFALSE;
439 }
440 }
441
442 // rows
443 UInt_t top = layout->GetAttachTop();
444 UInt_t bottom = layout->GetAttachBottom();
445 if (top != bottom - 1) {
446 for (row = top; row < bottom; ++row) fRow[row].fEmpty = kFALSE;
448 if (hints & kLHintsExpandY) {
449 for (row = top; row < bottom; ++row)
450 if (fRow[row].fExpand) { has_expand = kTRUE; break; }
451 if (!has_expand)
452 for (row = top; row < bottom; ++row)
453 fRow[row].fNeedExpand = kTRUE;
454 }
455 if (!(hints & kLHintsShrinkY)) {
456 for (row = top; row < bottom; ++row)
457 if (!fRow[row].fShrink) { has_shrink = kFALSE; break;}
458 if (has_shrink)
459 for (row = top; row < bottom; ++row)
460 fRow[row].fNeedShrink = kFALSE;
461 }
462 }
463 }
464
465 // Set expand/shrink flags
466 for (col = 0; col < fNcols; ++col) {
467 if (fCol[col].fEmpty) {
468 fCol[col].fExpand = kFALSE;
469 fCol[col].fShrink = kFALSE;
470 } else {
471 if (fCol[col].fNeedExpand) fCol[col].fExpand = kTRUE;
472 if (!fCol[col].fNeedShrink) fCol[col].fShrink = kFALSE;
473 }
474 }
475 for (row = 0; row < fNrows; ++row) {
476 if (fRow[row].fEmpty) {
477 fRow[row].fExpand = kFALSE;
478 fRow[row].fShrink = kFALSE;
479 } else {
480 if (fRow[row].fNeedExpand) fRow[row].fExpand = kTRUE;
481 if (!fRow[row].fNeedShrink) fRow[row].fShrink = kFALSE;
482 }
483 }
484}
485
486////////////////////////////////////////////////////////////////////////////////
487/// Sanity check various values.
488
490{
491 TIter next(fList);
492 TGFrameElement *ptr;
493 UInt_t nerrors = 0;
494 while ((ptr = (TGFrameElement*) next())) {
496 dynamic_cast<TGTableLayoutHints*>(ptr->fLayout);
497 if (!layout) {
498 Error("CheckSanity", "didn't get TGTableLayoutHints");
499 return;
500 }
501
502 UInt_t right = layout->GetAttachRight();
503 UInt_t left = layout->GetAttachLeft();
504 UInt_t top = layout->GetAttachTop();
505 UInt_t bottom = layout->GetAttachBottom();
506
507 if (left == right) {
508 ++nerrors;
509 Error("CheckSanity", "AttachLeft == AttachRight");
510 }
511 if (left > right) {
512 ++nerrors;
513 Error("CheckSanity", "AttachLeft > AttachRight");
514 }
515 if (left > fNcols-1) {
516 ++nerrors;
517 Error("CheckSanity", "AttachLeft illegal value: %u", left);
518 }
520 ++nerrors;
521 Error("CheckSanity", "AttachRight illegal value: %u", right);
522 }
523
524 if (top == bottom) {
525 ++nerrors;
526 Error("CheckSanity", "AttachTop == AttachBottom");
527 }
528 if (top > bottom) {
529 ++nerrors;
530 Error("CheckSanity", "AttachTop > AttachBottom");
531 }
532 if (top > fNrows-1) {
533 ++nerrors;
534 Error("CheckSanity", "AttachTop illegal value: %u", top);
535 }
537 ++nerrors;
538 Error("CheckSanity", "AttachBottom illegal value: %u", bottom);
539 }
540
541 }
542 if (nerrors) {
543 Error("CheckSanity", "errors in %u x %u table", fNcols, fNrows);
544 }
545}
546
547////////////////////////////////////////////////////////////////////////////////
548/// Make a table layout of all frames in the list.
549
551{
552 CheckSanity();
553
555
557
558 // Do the layout
559 TIter next(fList);
560 TGFrameElement *ptr;
562 while ((ptr = (TGFrameElement*) next())) {
564 dynamic_cast<TGTableLayoutHints*>(ptr->fLayout);
565 if (!layout) {
566 Error("TGTableLayout::Layout", "didn't get TGTableLayoutHints");
567 return;
568 }
569 ULong_t hints = layout->GetLayoutHints();
571
572 UInt_t right = layout->GetAttachRight();
573 UInt_t left = layout->GetAttachLeft();
574 UInt_t top = layout->GetAttachTop();
575 UInt_t bottom = layout->GetAttachBottom();
576
577 // Find location and size of cell in which to fit the child frame.
578 UInt_t col, cell_x = border_width + left*fSep;
579 for (col = 0; col < left; ++col) cell_x += fCol[col].fRealSize;
580
581 UInt_t row, cell_y = border_width + top*fSep;
582 for (row = 0; row < top; ++row) cell_y += fRow[row].fRealSize;
583
584 UInt_t cell_width = (right-left-1)*fSep;
585 for (col=left; col < right; ++col)
586 cell_width += fCol[col].fRealSize;
587
588 UInt_t cell_height = (bottom-top-1)*fSep;
589 for (row=top; row < bottom; ++row)
590 cell_height += fRow[row].fRealSize;
591
592 UInt_t pad_left = layout->GetPadLeft();
593 UInt_t pad_right = layout->GetPadRight();
594 UInt_t pad_bottom = layout->GetPadBottom();
595 UInt_t pad_top = layout->GetPadTop();
596
597 // find size of child frame
598 UInt_t ww,hh;
599 if (hints & kLHintsFillX)
601 else
602 ww = size.fWidth;
603 if (hints & kLHintsFillY)
605 else
606 hh = size.fHeight;
607
608 // Find location of child frame
609 UInt_t xx;
610 if (hints & kLHintsFillX) // Fill beats right/center/left hints
611 xx = cell_x + pad_left;
612 else if (hints & kLHintsRight)
613 xx = cell_x + cell_width - pad_right - ww;
614 else if (hints & kLHintsCenterX)
615 xx = cell_x + cell_width/2 - ww/2; // padding?
616 else // defaults to kLHintsLeft
617 xx = cell_x + pad_left;
618
619 UInt_t yy;
620 if (hints & kLHintsFillY) // Fill beats top/center/bottom hings
621 yy = cell_y + pad_top;
622 else if (hints & kLHintsBottom)
624 else if (hints & kLHintsCenterY)
625 yy = cell_y + cell_height/2 - hh/2; // padding?
626 else // defaults to kLHintsTop
627 yy = cell_y + pad_top;
628
629 ptr->fFrame->MoveResize(xx,yy,ww,hh);
630 ptr->fFrame->Layout();
631
632 }
633}
634
635////////////////////////////////////////////////////////////////////////////////
636/// Return default dimension of the table layout.
637
639{
641 UInt_t options = fMain->GetOptions();
642
643 if ((options & kFixedWidth) && (options & kFixedHeight))
644 return msize;
645
647
649 2*border_width + (fNrows-1)*fSep);
650
651 UInt_t col, row;
652 if (fCol)
653 for (col = 0; col < fNcols; ++col) size.fWidth += fCol[col].fDefSize;
654 if (fRow)
655 for (row = 0; row < fNrows; ++row) size.fHeight += fRow[row].fDefSize;
656
657 if (options & kFixedWidth) size.fWidth = msize.fWidth;
658 if (options & kFixedHeight) size.fHeight = msize.fHeight;
659 return size;
660}
661
662// ________________________________________________________________________
663void TGTableLayoutHints::SavePrimitive(std::ostream &out, Option_t * /*= ""*/)
664{
665
666 // Save table layout hints as a C++ statement(s) on output stream out.
667
669
670 if (!GetLayoutHints())
671 return;
672
673 if ((fLayoutHints == kLHintsNormal) && (pad == 0))
674 return;
675
677 auto add = [this, &hints](UInt_t mask, const char *name) {
678 if (fLayoutHints & mask) {
679 if (hints.Length())
680 hints.Append(" | ");
681 hints.Append(name);
682 }
683 };
684
685 add(kLHintsLeft, "kLHintsLeft");
686 add(kLHintsCenterX, "kLHintsCenterX");
687 add(kLHintsRight, "kLHintsRight");
688 add(kLHintsTop, "kLHintsTop");
689 add(kLHintsCenterY, "kLHintsCenterY");
690 add(kLHintsBottom, "kLHintsBottom");
691 add(kLHintsExpandX, "kLHintsExpandX");
692 add(kLHintsExpandY, "kLHintsExpandY");
693 add(kLHintsShrinkX, "kLHintsShrinkX");
694 add(kLHintsShrinkY, "kLHintsShrinkY");
695 add(kLHintsFillX, "kLHintsFillX");
696 add(kLHintsFillY, "kLHintsFillY");
697
698 out << ", new TGTableLayoutHints(" << GetAttachLeft() << "," << GetAttachRight() << "," << GetAttachTop() << ","
699 << GetAttachBottom() << "," << hints;
700
701 if (pad)
702 out << "," << GetPadLeft() << "," << GetPadRight() << "," << GetPadTop() << "," << GetPadBottom();
703 out << ")";
704}
705
706// __________________________________________________________________________
707void TGTableLayout::SavePrimitive(std::ostream &out, Option_t * /*= ""*/)
708{
709
710 // Save table layout as a C++ statement(s) on output stream.
711
712 out << " new TGTableLayout(" << fMain->GetName() << "," << fNrows << "," << fNcols;
713
714 if (fSep) {
715 if (fHomogeneous == kTRUE)
716 out << ", kTRUE";
717 else
718 out << ", kFALSE";
719 out << fSep;
720 }
721 out << ")";
722 // hints parameter is not used/saved currently
723}
@ kFixedWidth
Definition GuiTypes.h:387
@ kFixedHeight
Definition GuiTypes.h:389
int main()
Definition Prototype.cxx:12
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
unsigned long ULong_t
Unsigned long integer 4 bytes (unsigned long). Size depends on architecture.
Definition RtypesCore.h:69
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
const char Option_t
Option string (const char)
Definition RtypesCore.h:80
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
@ kLHintsRight
Definition TGLayout.h:26
@ kLHintsExpandY
Definition TGLayout.h:31
@ kLHintsLeft
Definition TGLayout.h:24
@ kLHintsCenterY
Definition TGLayout.h:28
@ kLHintsNormal
Definition TGLayout.h:32
@ kLHintsCenterX
Definition TGLayout.h:25
@ kLHintsBottom
Definition TGLayout.h:29
@ kLHintsTop
Definition TGLayout.h:27
@ kLHintsExpandX
Definition TGLayout.h:30
@ kLHintsFillX
@ kLHintsShrinkX
@ kLHintsShrinkY
@ kLHintsFillY
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t mask
Option_t Option_t width
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
char name[80]
Definition TGX11.cxx:110
The base class for composite widgets (menu bars, list boxes, etc.).
Definition TGFrame.h:289
virtual TList * GetList() const
Definition TGFrame.h:312
TGLayoutHints * fLayout
Definition TGLayout.h:114
TGFrame * fFrame
Definition TGLayout.h:112
virtual TGDimension GetDefaultSize() const
std::cout << fWidth << "x" << fHeight << std::endl;
Definition TGFrame.cxx:576
void MoveResize(Int_t x, Int_t y, UInt_t w=0, UInt_t h=0) override
Move and/or resize the frame.
Definition TGFrame.cxx:621
Int_t GetBorderWidth() const
Definition TGFrame.h:235
virtual UInt_t GetDefaultWidth() const
Definition TGFrame.h:192
virtual UInt_t GetDefaultHeight() const
Definition TGFrame.h:193
TGDimension GetSize() const
Definition TGFrame.h:232
virtual UInt_t GetOptions() const
Definition TGFrame.h:199
UInt_t GetHeight() const
Definition TGFrame.h:227
virtual void Layout()
Definition TGFrame.h:201
UInt_t GetWidth() const
Definition TGFrame.h:226
Int_t GetPadRight() const
Definition TGLayout.h:86
Int_t GetPadBottom() const
Definition TGLayout.h:84
ULong_t fLayoutHints
Definition TGLayout.h:62
ULong_t GetLayoutHints() const
Definition TGLayout.h:82
Int_t GetPadTop() const
Definition TGLayout.h:83
Int_t GetPadLeft() const
Definition TGLayout.h:85
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
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.
Definition TGWindow.cxx:334
void Reset()
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:1071
Basic string class.
Definition TString.h:138
UInt_t fDefSize
Default size of col/rows.
UInt_t fRealSize
Real size of col/rows (eg, if table resize)