Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGTableLayout.h
Go to the documentation of this file.
1// @(#)root/gui:$Id$
2// Author: Brett Viren 04/15/2001
3
4/*************************************************************************
5 * Copyright (C) 1995-2021, Rene Brun and Fons Rademakers. *
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#ifndef ROOT_TGTableLayout
13#define ROOT_TGTableLayout
14
15#include "TGLayout.h"
16
17// extension of ELayoutHints
22 kLHintsFillY = BIT(11)
23};
24
25
27
28private:
31
32protected:
33 UInt_t fAttachLeft; ///< Column/row division number on which
34 UInt_t fAttachRight; ///< to attach the frame. Starts at 0
35 UInt_t fAttachTop; ///< and goes to # columns / # rows
36 UInt_t fAttachBottom; ///< respectively
37
38public:
39 TGTableLayoutHints(UInt_t attach_left, UInt_t attach_right,
40 UInt_t attach_top, UInt_t attach_bottom,
41 ULong_t hints = kLHintsNormal,
42 UInt_t padleft = 0, UInt_t padright = 0,
43 UInt_t padtop = 0, UInt_t padbottom = 0)
44 : TGLayoutHints(hints,padleft,padright,padtop,padbottom),
45 fAttachLeft(attach_left),
46 fAttachRight(attach_right),
47 fAttachTop(attach_top),
48 fAttachBottom(attach_bottom) { }
49 ~TGTableLayoutHints() override { }
50
51 UInt_t GetAttachLeft() const { return fAttachLeft; }
53 UInt_t GetAttachTop() const { return fAttachTop; }
55 void SavePrimitive(std::ostream &out, Option_t * = "") override;
56
57 ClassDefOverride(TGTableLayoutHints,0) // Class describing GUI table layout hints
58};
59
60
62
63private:
64 TGTableLayout(const TGTableLayout&) = delete;
66
67protected:
68 struct TableData_t {
69 UInt_t fDefSize; ///< Default size of col/rows
70 UInt_t fRealSize; ///< Real size of col/rows (eg, if table resize)
76 };
77 TableData_t *fRow; ///< info about each row
78 TableData_t *fCol; ///< info about each column
79 TGCompositeFrame *fMain; ///< container frame
80 TList *fList; ///< list of frames to arrange
81 Bool_t fHomogeneous; ///< all cols/rows same size
82
83 void FindRowColSizes();
88
89 void SetRowColSizes();
90 void SetRowColSizesInit();
91
92 void CheckSanity();
93
94 static void SetRowColResize(UInt_t real_size, UInt_t nthings,
95 TableData_t *thing, Bool_t homogeneous);
96
97public:
98 // these are public in TGMatrixLayout ??? Perpetuate it.
99 Int_t fSep; ///< interval between frames
100 Int_t fHints; ///< layout hints (currently not used)
101 UInt_t fNrows; ///< number of rows
102 UInt_t fNcols; ///< number of columns
103
105 Bool_t homogeneous = kFALSE, Int_t sep = 0, Int_t hints = 0);
106 ~TGTableLayout() override;
107
108 void Layout() override;
109 TGDimension GetDefaultSize() const override; // return sum of all child sizes
110 void SavePrimitive(std::ostream &out, Option_t * = "") override;
111
112 ClassDefOverride(TGTableLayout,0) // Table layout manager
113};
114
115#endif
int main()
Definition Prototype.cxx:12
unsigned long ULong_t
Definition RtypesCore.h:55
constexpr Bool_t kFALSE
Definition RtypesCore.h:94
const char Option_t
Definition RtypesCore.h:66
#define BIT(n)
Definition Rtypes.h:90
#define ClassDefOverride(name, id)
Definition Rtypes.h:346
@ kLHintsNormal
Definition TGLayout.h:32
ETableLayoutHints
@ kLHintsFillX
@ kLHintsShrinkX
@ kLHintsShrinkY
@ kLHintsFillY
The base class for composite widgets (menu bars, list boxes, etc.).
Definition TGFrame.h:287
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
Frame layout manager.
Definition TGLayout.h:135
This class describes layout hints used by the TGTableLayout class.
TGTableLayoutHints(const TGTableLayoutHints &)=delete
TGTableLayoutHints & operator=(const TGTableLayoutHints &)=delete
UInt_t fAttachBottom
respectively
UInt_t fAttachLeft
Column/row division number on which.
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
TGTableLayoutHints(UInt_t attach_left, UInt_t attach_right, UInt_t attach_top, UInt_t attach_bottom, ULong_t hints=kLHintsNormal, UInt_t padleft=0, UInt_t padright=0, UInt_t padtop=0, UInt_t padbottom=0)
UInt_t fAttachRight
to attach the frame. Starts at 0
~TGTableLayoutHints() override
UInt_t fAttachTop
and goes to # columns / # rows
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
TGTableLayout & operator=(const TGTableLayout &)=delete
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.
A doubly linked list.
Definition TList.h:38
UInt_t fDefSize
Default size of col/rows.
UInt_t fRealSize
Real size of col/rows (eg, if table resize)