Logo ROOT  
Reference Guide
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
26
27
29
30private:
33
34protected:
35 UInt_t fAttachLeft; ///< Column/row division number on which
36 UInt_t fAttachRight; ///< to attach the frame. Starts at 0
37 UInt_t fAttachTop; ///< and goes to # columns / # rows
38 UInt_t fAttachBottom; ///< respectively
39
40public:
41 TGTableLayoutHints(UInt_t attach_left, UInt_t attach_right,
42 UInt_t attach_top, UInt_t attach_bottom,
43 ULong_t hints = kLHintsNormal,
44 UInt_t padleft = 0, UInt_t padright = 0,
45 UInt_t padtop = 0, UInt_t padbottom = 0)
46 : TGLayoutHints(hints,padleft,padright,padtop,padbottom),
47 fAttachLeft(attach_left),
48 fAttachRight(attach_right),
49 fAttachTop(attach_top),
50 fAttachBottom(attach_bottom) { }
51 virtual ~TGTableLayoutHints() { }
52
53 UInt_t GetAttachLeft() const { return fAttachLeft; }
55 UInt_t GetAttachTop() const { return fAttachTop; }
57 virtual void SavePrimitive(std::ostream &out, Option_t * = "");
58
59 ClassDef(TGTableLayoutHints,0) // Class describing GUI table layout hints
60};
61
62
63
64
66
67private:
68 TGTableLayout(const TGTableLayout&) = delete;
70
71protected:
72 struct TableData_t {
73 UInt_t fDefSize; ///< Default size of col/rows
74 UInt_t fRealSize; ///< Real size of col/rows (eg, if table resize)
80 };
81 TableData_t *fRow; ///< info about each row
82 TableData_t *fCol; ///< info about each column
83 TGCompositeFrame *fMain; ///< container frame
84 TList *fList; ///< list of frames to arrange
85 Bool_t fHomogeneous; ///< all cols/rows same size
86
87 void FindRowColSizes();
92
93 void SetRowColSizes();
94 void SetRowColSizesInit();
95
96 void CheckSanity();
97
98 static void SetRowColResize(UInt_t real_size, UInt_t nthings,
99 TableData_t *thing, Bool_t homogeneous);
100
101public:
102 // these are public in TGMatrixLayout ??? Perpetuate it.
103 Int_t fSep; ///< interval between frames
104 Int_t fHints; ///< layout hints (currently not used)
105 UInt_t fNrows; ///< number of rows
106 UInt_t fNcols; ///< number of columns
107
109 Bool_t homogeneous = kFALSE, Int_t sep = 0, Int_t hints = 0);
110 virtual ~TGTableLayout();
111
112 virtual void Layout();
113 virtual TGDimension GetDefaultSize() const; // return sum of all child sizes
114 virtual void SavePrimitive(std::ostream &out, Option_t * = "");
115
116 ClassDef(TGTableLayout,0) // Table layout manager
117};
118
119#endif
int Int_t
Definition: CPyCppyy.h:43
unsigned int UInt_t
Definition: CPyCppyy.h:44
unsigned long ULong_t
Definition: CPyCppyy.h:51
const Bool_t kFALSE
Definition: RtypesCore.h:101
bool Bool_t
Definition: RtypesCore.h:63
const char Option_t
Definition: RtypesCore.h:66
#define ClassDef(name, id)
Definition: Rtypes.h:325
#define BIT(n)
Definition: Rtypes.h:85
@ kLHintsNormal
Definition: TGLayout.h:32
ETableLayoutHints
Definition: TGTableLayout.h:18
@ kLHintsFillX
Definition: TGTableLayout.h:21
@ kLHintsShrinkX
Definition: TGTableLayout.h:19
@ kLHintsShrinkY
Definition: TGTableLayout.h:20
@ kLHintsFillY
Definition: TGTableLayout.h:22
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.
Definition: TGTableLayout.h:28
TGTableLayoutHints(const TGTableLayoutHints &)=delete
UInt_t fAttachBottom
respectively
Definition: TGTableLayout.h:38
virtual void SavePrimitive(std::ostream &out, Option_t *="")
Save layout hints as a C++ statement(s) on output stream out.
TGTableLayoutHints & operator=(const TGTableLayoutHints &)=delete
virtual ~TGTableLayoutHints()
Definition: TGTableLayout.h:51
UInt_t fAttachLeft
Column/row division number on which.
Definition: TGTableLayout.h:35
UInt_t GetAttachLeft() const
Definition: TGTableLayout.h:53
UInt_t GetAttachTop() const
Definition: TGTableLayout.h:55
UInt_t GetAttachBottom() const
Definition: TGTableLayout.h:56
UInt_t GetAttachRight() const
Definition: TGTableLayout.h:54
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)
Definition: TGTableLayout.h:41
UInt_t fAttachRight
to attach the frame. Starts at 0
Definition: TGTableLayout.h:36
UInt_t fAttachTop
and goes to # columns / # rows
Definition: TGTableLayout.h:37
A layout manager, which places child frames in a table arranged in rows and columns,...
Definition: TGTableLayout.h:65
virtual TGDimension GetDefaultSize() const
Return default dimension of the table layout.
Bool_t fHomogeneous
all cols/rows same size
Definition: TGTableLayout.h:85
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.
TableData_t * fRow
info about each row
Definition: TGTableLayout.h:81
TGTableLayout & operator=(const TGTableLayout &)=delete
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.
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
Definition: TGTableLayout.h:82
TList * fList
list of frames to arrange
Definition: TGTableLayout.h:84
TGCompositeFrame * fMain
container frame
Definition: TGTableLayout.h:83
TGTableLayout(const TGTableLayout &)=delete
void FindRowColSizes()
Find the sizes of rows and columns needed to satisfy children's layout policies.
void SetRowColSizesInit()
Initialize rows/cols.
virtual ~TGTableLayout()
TGTableLayout constructor.
A doubly linked list.
Definition: TList.h:44
int main()
UInt_t fDefSize
Default size of col/rows.
Definition: TGTableLayout.h:73
UInt_t fRealSize
Real size of col/rows (eg, if table resize)
Definition: TGTableLayout.h:74