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) 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 #ifndef ROOT_TGTableLayout
13 #define ROOT_TGTableLayout
14 
15 #include "TGLayout.h"
16 
17 
18 // extension of ELayoutHints
20  kLHintsShrinkX = BIT(8),
21  kLHintsShrinkY = BIT(9),
22  kLHintsFillX = BIT(10),
23  kLHintsFillY = BIT(11)
24 };
25 
26 
27 //////////////////////////////////////////////////////////////////////////
28 // //
29 // TGTableLayoutHints //
30 // //
31 // This class describes layout hints used by the TGTableLayout class. //
32 // //
33 //////////////////////////////////////////////////////////////////////////
34 
36 
37 private:
38  TGTableLayoutHints(const TGTableLayoutHints&); // Not implemented
39  TGTableLayoutHints& operator=(const TGTableLayoutHints&); // Not implemented
40 
41 protected:
42  UInt_t fAttachLeft; // Column/row division number on which
43  UInt_t fAttachRight; // to attach the frame. Starts at 0
44  UInt_t fAttachTop; // and goes to # columns / # rows
45  UInt_t fAttachBottom; // respectively
46 
47 public:
48  TGTableLayoutHints(UInt_t attach_left, UInt_t attach_right,
49  UInt_t attach_top, UInt_t attach_bottom,
50  ULong_t hints = kLHintsNormal,
51  UInt_t padleft = 0, UInt_t padright = 0,
52  UInt_t padtop = 0, UInt_t padbottom = 0)
53  : TGLayoutHints(hints,padleft,padright,padtop,padbottom),
54  fAttachLeft(attach_left),
55  fAttachRight(attach_right),
56  fAttachTop(attach_top),
57  fAttachBottom(attach_bottom) { }
58  virtual ~TGTableLayoutHints() { }
59 
60  UInt_t GetAttachLeft() const { return fAttachLeft; }
61  UInt_t GetAttachRight() const { return fAttachRight; }
62  UInt_t GetAttachTop() const { return fAttachTop; }
63  UInt_t GetAttachBottom() const { return fAttachBottom; }
64  virtual void SavePrimitive(std::ostream &out, Option_t * = "");
65 
66  ClassDef(TGTableLayoutHints,0) // Class describing GUI table layout hints
67 };
68 
69 
70 //////////////////////////////////////////////////////////////////////////
71 // //
72 // TGTableLayout //
73 // //
74 // A LayoutManager which places child frames in a table. This uses //
75 // TGTableLayoutHints (not TGLayoutHints). See TGTableLayoutHints //
76 // for how to use these. This manager works like TGMatrixLayout with //
77 // the addition that: //
78 // - Child frames can span more than one column/row. //
79 // - Child frames can resize with the frame. //
80 // - Column and row sizes are not fixed nor (optionally) homogeneous. //
81 // - The number of columns and rows must be fully specified. //
82 // //
83 //////////////////////////////////////////////////////////////////////////
84 
86 
87 private:
88  TGTableLayout(const TGTableLayout&); // Not implemented
89  TGTableLayout& operator=(const TGTableLayout&); // Not implemented
90 
91 protected:
92  struct TableData_t {
93  UInt_t fDefSize; // Default size of col/rows
94  UInt_t fRealSize; // Real size of col/rows (eg, if table resize)
100  };
101  TableData_t *fRow; // info about each row
102  TableData_t *fCol; // info about each column
103  TGCompositeFrame *fMain; // container frame
104  TList *fList; // list of frames to arrange
105  Bool_t fHomogeneous; // all cols/rows same size
106 
107  void FindRowColSizes();
108  void FindRowColSizesInit();
112 
113  void SetRowColSizes();
114  void SetRowColSizesInit();
115 
116  void CheckSanity();
117 
118  static void SetRowColResize(UInt_t real_size, UInt_t nthings,
119  TableData_t *thing, Bool_t homogeneous);
120 
121 public:
122  // these are public in TGMatrixLayout ??? Perpetuate it.
123  Int_t fSep; // interval between frames
124  Int_t fHints; // layout hints (currently not used)
125  UInt_t fNrows; // number of rows
126  UInt_t fNcols; // number of columns
127 
129  Bool_t homogeneous = kFALSE, Int_t sep = 0, Int_t hints = 0);
130  virtual ~TGTableLayout();
131 
132  virtual void Layout();
133  virtual TGDimension GetDefaultSize() const; // return sum of all child sizes
134  virtual void SavePrimitive(std::ostream &out, Option_t * = "");
135 
136  ClassDef(TGTableLayout,0) // Table layout manager
137 };
138 
139 #endif
TGTableLayout::FindRowColSizesMultiplyAttached
void FindRowColSizesMultiplyAttached()
Checks any children which span multiple col/rows.
Definition: TGTableLayout.cxx:207
TGTableLayoutHints::GetAttachBottom
UInt_t GetAttachBottom() const
Definition: TGTableLayout.h:63
TGTableLayout::TableData_t
Definition: TGTableLayout.h:92
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:48
TGTableLayout::FindRowColSizesInit
void FindRowColSizesInit()
Initialize values needed to determine the size of rows and columns.
Definition: TGTableLayout.cxx:135
ETableLayoutHints
ETableLayoutHints
Definition: TGTableLayout.h:19
TGDimension
Definition: TGDimension.h:27
TGTableLayout::SetRowColSizes
void SetRowColSizes()
This gets the new sizes needed to fit the table to the parent frame.
Definition: TGTableLayout.cxx:346
TGTableLayout::fHints
Int_t fHints
Definition: TGTableLayout.h:124
TGTableLayout::FindRowColSizes
void FindRowColSizes()
Find the sizes of rows and columns needed to statisfy children's layout policies.
Definition: TGTableLayout.cxx:121
TGTableLayoutHints::TGTableLayoutHints
TGTableLayoutHints(const TGTableLayoutHints &)
TGLayout.h
TGTableLayoutHints
Definition: TGTableLayout.h:35
TGTableLayout::FindRowColSizesHomogeneous
void FindRowColSizesHomogeneous()
If the table is homogeneous make sure all col/rows are same size as biggest col/row.
Definition: TGTableLayout.cxx:186
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:266
kLHintsShrinkY
@ kLHintsShrinkY
Definition: TGTableLayout.h:27
TGTableLayout::CheckSanity
void CheckSanity()
Sanity check various values.
Definition: TGTableLayout.cxx:492
TGTableLayout::TGTableLayout
TGTableLayout(const TGTableLayout &)
TGTableLayout::~TGTableLayout
virtual ~TGTableLayout()
TGTableLayout constructor.
Definition: TGTableLayout.cxx:111
TGTableLayoutHints::GetAttachRight
UInt_t GetAttachRight() const
Definition: TGTableLayout.h:61
TGTableLayoutHints::~TGTableLayoutHints
virtual ~TGTableLayoutHints()
Definition: TGTableLayout.h:58
TGTableLayout::fList
TList * fList
Definition: TGTableLayout.h:104
TGTableLayout::fMain
TGCompositeFrame * fMain
Definition: TGTableLayout.h:103
TGTableLayout::TableData_t::fNeedShrink
Bool_t fNeedShrink
Definition: TGTableLayout.h:96
TGTableLayoutHints::fAttachRight
UInt_t fAttachRight
Definition: TGTableLayout.h:43
TGTableLayoutHints::GetAttachLeft
UInt_t GetAttachLeft() const
Definition: TGTableLayout.h:60
TGTableLayout::TableData_t::fRealSize
UInt_t fRealSize
Definition: TGTableLayout.h:94
bool
TGLayoutManager
Definition: TGLayout.h:142
TGTableLayout::SetRowColSizesInit
void SetRowColSizesInit()
Initialize rows/cols.
Definition: TGTableLayout.cxx:361
TGTableLayout::Layout
virtual void Layout()
Make a table layout of all frames in the list.
Definition: TGTableLayout.cxx:553
TGTableLayout::fSep
Int_t fSep
Definition: TGTableLayout.h:123
Option_t
const typedef char Option_t
Definition: RtypesCore.h:66
kLHintsFillX
@ kLHintsFillX
Definition: TGTableLayout.h:28
kLHintsNormal
@ kLHintsNormal
Definition: TGLayout.h:45
TGTableLayout::TableData_t::fNeedExpand
Bool_t fNeedExpand
Definition: TGTableLayout.h:95
TGTableLayout::FindRowColSizesSinglyAttached
void FindRowColSizesSinglyAttached()
Determine the size of rows/cols needed for singly attached children.
Definition: TGTableLayout.cxx:152
TGTableLayout::TableData_t::fExpand
Bool_t fExpand
Definition: TGTableLayout.h:97
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
TGTableLayout::TableData_t::fShrink
Bool_t fShrink
Definition: TGTableLayout.h:98
TGTableLayout::TableData_t::fDefSize
UInt_t fDefSize
Definition: TGTableLayout.h:93
main
int main(int argc, char **argv)
Definition: histspeedtest.cxx:751
TGTableLayoutHints::fAttachTop
UInt_t fAttachTop
Definition: TGTableLayout.h:44
TGLayoutHints
Definition: TGLayout.h:57
TGTableLayoutHints::operator=
TGTableLayoutHints & operator=(const TGTableLayoutHints &)
BIT
#define BIT(n)
Definition: Rtypes.h:85
TGTableLayout::TableData_t::fEmpty
Bool_t fEmpty
Definition: TGTableLayout.h:99
TGTableLayout::fHomogeneous
Bool_t fHomogeneous
Definition: TGTableLayout.h:105
ULong_t
unsigned long ULong_t
Definition: RtypesCore.h:55
TGTableLayout::fRow
TableData_t * fRow
Definition: TGTableLayout.h:101
TGTableLayout::fNcols
UInt_t fNcols
Definition: TGTableLayout.h:126
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:738
kLHintsShrinkX
@ kLHintsShrinkX
Definition: TGTableLayout.h:26
TGTableLayout::operator=
TGTableLayout & operator=(const TGTableLayout &)
TGTableLayout::GetDefaultSize
virtual TGDimension GetDefaultSize() const
Return default dimension of the table layout.
Definition: TGTableLayout.cxx:641
TGTableLayout::fCol
TableData_t * fCol
Definition: TGTableLayout.h:102
TGTableLayoutHints::SavePrimitive
virtual void SavePrimitive(std::ostream &out, Option_t *="")
Save a primitive as a C++ statement(s) on output stream "out".
Definition: TGTableLayout.cxx:666
kLHintsFillY
@ kLHintsFillY
Definition: TGTableLayout.h:29
TGTableLayout
Definition: TGTableLayout.h:85
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TGTableLayoutHints::GetAttachTop
UInt_t GetAttachTop() const
Definition: TGTableLayout.h:62
TGTableLayout::fNrows
UInt_t fNrows
Definition: TGTableLayout.h:125
TGCompositeFrame
Definition: TGFrame.h:324
ROOT::Math::detail::sep
@ sep
Definition: GenVectorIO.h:55
TGTableLayoutHints::fAttachLeft
UInt_t fAttachLeft
Definition: TGTableLayout.h:42
TGTableLayoutHints::fAttachBottom
UInt_t fAttachBottom
Definition: TGTableLayout.h:45
TList
Definition: TList.h:44
int