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
26//////////////////////////////////////////////////////////////////////////
27// //
28// TGTableLayoutHints //
29// //
30// This class describes layout hints used by the TGTableLayout class. //
31// //
32//////////////////////////////////////////////////////////////////////////
33
35
36private:
39
40protected:
41 UInt_t fAttachLeft; // Column/row division number on which
42 UInt_t fAttachRight; // to attach the frame. Starts at 0
43 UInt_t fAttachTop; // and goes to # columns / # rows
44 UInt_t fAttachBottom; // respectively
45
46public:
47 TGTableLayoutHints(UInt_t attach_left, UInt_t attach_right,
48 UInt_t attach_top, UInt_t attach_bottom,
49 ULong_t hints = kLHintsNormal,
50 UInt_t padleft = 0, UInt_t padright = 0,
51 UInt_t padtop = 0, UInt_t padbottom = 0)
52 : TGLayoutHints(hints,padleft,padright,padtop,padbottom),
53 fAttachLeft(attach_left),
54 fAttachRight(attach_right),
55 fAttachTop(attach_top),
56 fAttachBottom(attach_bottom) { }
57 virtual ~TGTableLayoutHints() { }
58
59 UInt_t GetAttachLeft() const { return fAttachLeft; }
61 UInt_t GetAttachTop() const { return fAttachTop; }
63 virtual void SavePrimitive(std::ostream &out, Option_t * = "");
64
65 ClassDef(TGTableLayoutHints,0) // Class describing GUI table layout hints
66};
67
68
69//////////////////////////////////////////////////////////////////////////
70// //
71// TGTableLayout //
72// //
73// A LayoutManager which places child frames in a table. This uses //
74// TGTableLayoutHints (not TGLayoutHints). See TGTableLayoutHints //
75// for how to use these. This manager works like TGMatrixLayout with //
76// the addition that: //
77// - Child frames can span more than one column/row. //
78// - Child frames can resize with the frame. //
79// - Column and row sizes are not fixed nor (optionally) homogeneous. //
80// - The number of columns and rows must be fully specified. //
81// //
82//////////////////////////////////////////////////////////////////////////
83
85
86private:
87 TGTableLayout(const TGTableLayout&) = delete;
89
90protected:
91 struct TableData_t {
92 UInt_t fDefSize; // Default size of col/rows
93 UInt_t fRealSize; // Real size of col/rows (eg, if table resize)
99 };
100 TableData_t *fRow; // info about each row
101 TableData_t *fCol; // info about each column
102 TGCompositeFrame *fMain; // container frame
103 TList *fList; // list of frames to arrange
104 Bool_t fHomogeneous; // all cols/rows same size
105
106 void FindRowColSizes();
107 void FindRowColSizesInit();
111
112 void SetRowColSizes();
113 void SetRowColSizesInit();
114
115 void CheckSanity();
116
117 static void SetRowColResize(UInt_t real_size, UInt_t nthings,
118 TableData_t *thing, Bool_t homogeneous);
119
120public:
121 // these are public in TGMatrixLayout ??? Perpetuate it.
122 Int_t fSep; // interval between frames
123 Int_t fHints; // layout hints (currently not used)
124 UInt_t fNrows; // number of rows
125 UInt_t fNcols; // number of columns
126
128 Bool_t homogeneous = kFALSE, Int_t sep = 0, Int_t hints = 0);
129 virtual ~TGTableLayout();
130
131 virtual void Layout();
132 virtual TGDimension GetDefaultSize() const; // return sum of all child sizes
133 virtual void SavePrimitive(std::ostream &out, Option_t * = "");
134
135 ClassDef(TGTableLayout,0) // Table layout manager
136};
137
138#endif
const Bool_t kFALSE
Definition RtypesCore.h:92
unsigned long ULong_t
Definition RtypesCore.h:55
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:39
ETableLayoutHints
@ kLHintsFillX
@ kLHintsShrinkX
@ kLHintsShrinkY
@ kLHintsFillY
TGTableLayoutHints(const TGTableLayoutHints &)=delete
TGTableLayoutHints & operator=(const TGTableLayoutHints &)=delete
virtual void SavePrimitive(std::ostream &out, Option_t *="")
Save a primitive as a C++ statement(s) on output stream "out".
virtual ~TGTableLayoutHints()
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)
virtual TGDimension GetDefaultSize() const
Return default dimension of the table layout.
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
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.
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.
void FindRowColSizesInit()
Initialize values needed to determine the size of rows and columns.
void CheckSanity()
Sanity check various values.
TGTableLayout & operator=(const TGTableLayout &)=delete
TableData_t * fCol
TGCompositeFrame * fMain
TGTableLayout(const TGTableLayout &)=delete
void FindRowColSizes()
Find the sizes of rows and columns needed to statisfy children's layout policies.
void SetRowColSizesInit()
Initialize rows/cols.
virtual ~TGTableLayout()
TGTableLayout constructor.
A doubly linked list.
Definition TList.h:44
int main()