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 
30 private:
33 
34 protected:
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 
40 public:
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; }
54  UInt_t GetAttachRight() const { return fAttachRight; }
55  UInt_t GetAttachTop() const { return fAttachTop; }
56  UInt_t GetAttachBottom() const { return fAttachBottom; }
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 
67 private:
68  TGTableLayout(const TGTableLayout&) = delete;
70 
71 protected:
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();
88  void FindRowColSizesInit();
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 
101 public:
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
TGTableLayout::FindRowColSizesMultiplyAttached
void FindRowColSizesMultiplyAttached()
Checks any children which span multiple col/rows.
Definition: TGTableLayout.cxx:206
TGTableLayoutHints::GetAttachBottom
UInt_t GetAttachBottom() const
Definition: TGTableLayout.h:56
TGTableLayout::TableData_t
Definition: TGTableLayout.h:72
TGTableLayoutHints::TGTableLayoutHints
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
TGTableLayout::FindRowColSizesInit
void FindRowColSizesInit()
Initialize values needed to determine the size of rows and columns.
Definition: TGTableLayout.cxx:134
TGTableLayout::operator=
TGTableLayout & operator=(const TGTableLayout &)=delete
ETableLayoutHints
ETableLayoutHints
Definition: TGTableLayout.h:18
TGDimension
Definition: TGDimension.h:18
Option_t
const char Option_t
Definition: RtypesCore.h:66
TGTableLayout::SetRowColSizes
void SetRowColSizes()
This gets the new sizes needed to fit the table to the parent frame.
Definition: TGTableLayout.cxx:345
TGTableLayout::fHints
Int_t fHints
layout hints (currently not used)
Definition: TGTableLayout.h:104
TGTableLayout::FindRowColSizes
void FindRowColSizes()
Find the sizes of rows and columns needed to satisfy children's layout policies.
Definition: TGTableLayout.cxx:120
TGTableLayout::TGTableLayout
TGTableLayout(const TGTableLayout &)=delete
TGLayout.h
TGTableLayoutHints
This class describes layout hints used by the TGTableLayout class.
Definition: TGTableLayout.h:28
TGTableLayout::FindRowColSizesHomogeneous
void FindRowColSizesHomogeneous()
If the table is homogeneous make sure all col/rows are same size as biggest col/row.
Definition: TGTableLayout.cxx:185
TGTableLayout::SetRowColResize
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.
Definition: TGTableLayout.cxx:265
kLHintsShrinkY
@ kLHintsShrinkY
Definition: TGTableLayout.h:20
TGTableLayout::CheckSanity
void CheckSanity()
Sanity check various values.
Definition: TGTableLayout.cxx:491
TGTableLayout::~TGTableLayout
virtual ~TGTableLayout()
TGTableLayout constructor.
Definition: TGTableLayout.cxx:110
TGTableLayoutHints::GetAttachRight
UInt_t GetAttachRight() const
Definition: TGTableLayout.h:54
TGTableLayoutHints::~TGTableLayoutHints
virtual ~TGTableLayoutHints()
Definition: TGTableLayout.h:51
TGTableLayout::fList
TList * fList
list of frames to arrange
Definition: TGTableLayout.h:84
TGTableLayout::fMain
TGCompositeFrame * fMain
container frame
Definition: TGTableLayout.h:83
TGTableLayout::TableData_t::fNeedShrink
Bool_t fNeedShrink
Definition: TGTableLayout.h:76
TGTableLayoutHints::fAttachRight
UInt_t fAttachRight
to attach the frame. Starts at 0
Definition: TGTableLayout.h:36
TGTableLayoutHints::GetAttachLeft
UInt_t GetAttachLeft() const
Definition: TGTableLayout.h:53
TGTableLayout::TableData_t::fRealSize
UInt_t fRealSize
Real size of col/rows (eg, if table resize)
Definition: TGTableLayout.h:74
bool
TGLayoutManager
Frame layout manager.
Definition: TGLayout.h:135
TGTableLayout::SetRowColSizesInit
void SetRowColSizesInit()
Initialize rows/cols.
Definition: TGTableLayout.cxx:360
TGTableLayout::Layout
virtual void Layout()
Make a table layout of all frames in the list.
Definition: TGTableLayout.cxx:552
TGTableLayout::fSep
Int_t fSep
interval between frames
Definition: TGTableLayout.h:103
kLHintsFillX
@ kLHintsFillX
Definition: TGTableLayout.h:21
kLHintsNormal
@ kLHintsNormal
Definition: TGLayout.h:32
TGTableLayout::TableData_t::fNeedExpand
Bool_t fNeedExpand
Definition: TGTableLayout.h:75
TGTableLayout::FindRowColSizesSinglyAttached
void FindRowColSizesSinglyAttached()
Determine the size of rows/cols needed for singly attached children.
Definition: TGTableLayout.cxx:151
TGTableLayout::TableData_t::fExpand
Bool_t fExpand
Definition: TGTableLayout.h:77
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:101
TGTableLayout::TableData_t::fShrink
Bool_t fShrink
Definition: TGTableLayout.h:78
TGTableLayout::TableData_t::fDefSize
UInt_t fDefSize
Default size of col/rows.
Definition: TGTableLayout.h:73
TGTableLayoutHints::fAttachTop
UInt_t fAttachTop
and goes to # columns / # rows
Definition: TGTableLayout.h:37
TGLayoutHints
This class describes layout hints used by the layout classes.
Definition: TGLayout.h:50
BIT
#define BIT(n)
Definition: Rtypes.h:85
TGTableLayout::TableData_t::fEmpty
Bool_t fEmpty
Definition: TGTableLayout.h:79
TGTableLayout::fHomogeneous
Bool_t fHomogeneous
all cols/rows same size
Definition: TGTableLayout.h:85
ULong_t
unsigned long ULong_t
Definition: RtypesCore.h:55
TGTableLayoutHints::operator=
TGTableLayoutHints & operator=(const TGTableLayoutHints &)=delete
TGTableLayout::fRow
TableData_t * fRow
info about each row
Definition: TGTableLayout.h:81
TGTableLayout::fNcols
UInt_t fNcols
number of columns
Definition: TGTableLayout.h:106
unsigned int
TGTableLayout::SavePrimitive
virtual void SavePrimitive(std::ostream &out, Option_t *="")
Save a primitive as a C++ statement(s) on output stream "out".
Definition: TGTableLayout.cxx:737
kLHintsShrinkX
@ kLHintsShrinkX
Definition: TGTableLayout.h:19
TGTableLayout::GetDefaultSize
virtual TGDimension GetDefaultSize() const
Return default dimension of the table layout.
Definition: TGTableLayout.cxx:640
TGTableLayout::fCol
TableData_t * fCol
info about each column
Definition: TGTableLayout.h:82
TGTableLayoutHints::SavePrimitive
virtual void SavePrimitive(std::ostream &out, Option_t *="")
Save layout hints as a C++ statement(s) on output stream out.
Definition: TGTableLayout.cxx:665
kLHintsFillY
@ kLHintsFillY
Definition: TGTableLayout.h:22
TGTableLayout
A layout manager, which places child frames in a table arranged in rows and columns,...
Definition: TGTableLayout.h:65
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TGTableLayoutHints::GetAttachTop
UInt_t GetAttachTop() const
Definition: TGTableLayout.h:55
TGTableLayout::fNrows
UInt_t fNrows
number of rows
Definition: TGTableLayout.h:105
TGTableLayoutHints::TGTableLayoutHints
TGTableLayoutHints(const TGTableLayoutHints &)=delete
TGCompositeFrame
The base class for composite widgets (menu bars, list boxes, etc.).
Definition: TGFrame.h:287
ROOT::Math::detail::sep
@ sep
Definition: GenVectorIO.h:35
TGTableLayoutHints::fAttachLeft
UInt_t fAttachLeft
Column/row division number on which.
Definition: TGTableLayout.h:35
TGTableLayoutHints::fAttachBottom
UInt_t fAttachBottom
respectively
Definition: TGTableLayout.h:38
TList
A doubly linked list.
Definition: TList.h:44
main
int main(int argc, char *argv[])
Definition: cef_main.cxx:54
int