Logo ROOT   6.16/01
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
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
37private:
38 TGTableLayoutHints(const TGTableLayoutHints&); // Not implemented
39 TGTableLayoutHints& operator=(const TGTableLayoutHints&); // Not implemented
40
41protected:
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
47public:
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; }
62 UInt_t GetAttachTop() const { return fAttachTop; }
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
87private:
88 TGTableLayout(const TGTableLayout&); // Not implemented
89 TGTableLayout& operator=(const TGTableLayout&); // Not implemented
90
91protected:
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
121public:
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
int Int_t
Definition: RtypesCore.h:41
unsigned int UInt_t
Definition: RtypesCore.h:42
const Bool_t kFALSE
Definition: RtypesCore.h:88
unsigned long ULong_t
Definition: RtypesCore.h:51
bool Bool_t
Definition: RtypesCore.h:59
const char Option_t
Definition: RtypesCore.h:62
#define ClassDef(name, id)
Definition: Rtypes.h:324
#define BIT(n)
Definition: Rtypes.h:82
@ kLHintsNormal
Definition: TGLayout.h:39
ETableLayoutHints
Definition: TGTableLayout.h:19
@ kLHintsFillX
Definition: TGTableLayout.h:22
@ kLHintsShrinkX
Definition: TGTableLayout.h:20
@ kLHintsShrinkY
Definition: TGTableLayout.h:21
@ kLHintsFillY
Definition: TGTableLayout.h:23
TGTableLayoutHints(const TGTableLayoutHints &)
virtual void SavePrimitive(std::ostream &out, Option_t *="")
Save a primitive as a C++ statement(s) on output stream "out".
virtual ~TGTableLayoutHints()
Definition: TGTableLayout.h:58
UInt_t GetAttachLeft() const
Definition: TGTableLayout.h:60
TGTableLayoutHints & operator=(const TGTableLayoutHints &)
UInt_t GetAttachTop() const
Definition: TGTableLayout.h:62
UInt_t GetAttachBottom() const
Definition: TGTableLayout.h:63
UInt_t GetAttachRight() const
Definition: TGTableLayout.h:61
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
virtual TGDimension GetDefaultSize() const
Return default dimension of the table layout.
Bool_t fHomogeneous
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.
TGTableLayout(const TGTableLayout &)
void CheckSanity()
Sanity check various values.
TableData_t * fCol
TGTableLayout & operator=(const TGTableLayout &)
TGCompositeFrame * fMain
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(int argc, char **argv)