Logo ROOT   6.16/01
Reference Guide
TGLayout.h
Go to the documentation of this file.
1// @(#)root/gui:$Id$
2// Author: Fons Rademakers 02/01/98
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, 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_TGLayout
13#define ROOT_TGLayout
14
15
16//////////////////////////////////////////////////////////////////////////
17// //
18// A number of different layout classes (TGLayoutManager, //
19// TGVerticalLayout, TGHorizontalLayout, TGLayoutHints, etc.). //
20// //
21//////////////////////////////////////////////////////////////////////////
22
23#include "TObject.h"
24#include "TGDimension.h"
25#include "TRefCnt.h"
26
27//---- layout hints
28
40 // bits 8-11 used by ETableLayoutHints
41};
42
43class TGFrame;
45class TGLayoutHints;
46class TList;
47class TGFrameElement;
48
49//////////////////////////////////////////////////////////////////////////
50// //
51// TGLayoutHints //
52// //
53// This class describes layout hints used by the layout classes. //
54// //
55//////////////////////////////////////////////////////////////////////////
56
57class TGLayoutHints : public TObject, public TRefCnt {
58
59friend class TGFrameElement;
60friend class TGCompositeFrame;
61
62private:
63 TGFrameElement *fFE; // back pointer to the last frame element
64 TGFrameElement *fPrev; // previous element sharing this layout_hints
65
67
68protected:
69 ULong_t fLayoutHints; // layout hints (combination of ELayoutHints)
70 Int_t fPadtop; // amount of top padding
71 Int_t fPadbottom; // amount of bottom padding
72 Int_t fPadleft; // amount of left padding
73 Int_t fPadright; // amount of right padding
74
76
77public:
79 Int_t padleft = 0, Int_t padright = 0,
80 Int_t padtop = 0, Int_t padbottom = 0):
81 fFE(0), fPrev(0), fLayoutHints(hints), fPadtop(padtop), fPadbottom(padbottom),
82 fPadleft(padleft), fPadright(padright)
83 { SetRefCount(0); }
84
86
87 virtual ~TGLayoutHints();
88
90 Int_t GetPadTop() const { return fPadtop; }
91 Int_t GetPadBottom() const { return fPadbottom; }
92 Int_t GetPadLeft() const { return fPadleft; }
93 Int_t GetPadRight() const { return fPadright; }
94
95 virtual void SetLayoutHints(ULong_t lh) { fLayoutHints = lh; }
96 virtual void SetPadTop(Int_t v) { fPadtop = v; }
97 virtual void SetPadBottom(Int_t v) { fPadbottom = v; }
98 virtual void SetPadLeft(Int_t v) { fPadleft = v; }
99 virtual void SetPadRight(Int_t v) { fPadright = v; }
100
101 void Print(Option_t* option = "") const;
102 void ls(Option_t* option = "") const { Print(option); }
103
104 virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
105
106 ClassDef(TGLayoutHints,0) // Class describing GUI layout hints
107};
108
109// Temporarily public as we need to share this class definition
110// with the frame manager class
111
112class TGFrameElement : public TObject {
113
114private:
117
118public:
119 TGFrame *fFrame; // frame used in layout
120 Int_t fState; // EFrameState defined in TGFrame.h
121 TGLayoutHints *fLayout; // layout hints used in layout
122
126
127 void Print(Option_t* option = "") const;
128 void ls(Option_t* option = "") const { Print(option); }
129
130 ClassDef(TGFrameElement, 0); // Base class used in GUI containers
131};
132
133
134//////////////////////////////////////////////////////////////////////////
135// //
136// TGLayoutManager //
137// //
138// Frame layout manager. This is an abstract class. //
139// //
140//////////////////////////////////////////////////////////////////////////
141
142class TGLayoutManager : public TObject {
143protected:
144 Bool_t fModified;// kTRUE if positions of subframes changed after layout
145
146public:
148
149 virtual void Layout() = 0;
150 virtual TGDimension GetDefaultSize() const = 0;
151 virtual void SetDefaultWidth(UInt_t /* w */) {}
152 virtual void SetDefaultHeight(UInt_t /* h */) {}
153 virtual Bool_t IsModified() const { return fModified; }
154 virtual void SetModified(Bool_t flag = kTRUE) { fModified = flag; }
155
156 ClassDef(TGLayoutManager,0) // Layout manager abstract base class
157};
158
159
160//////////////////////////////////////////////////////////////////////////
161// //
162// TGVerticalLayout and TGHorizontalLayout managers. //
163// //
164//////////////////////////////////////////////////////////////////////////
165
167
168protected:
169 TGCompositeFrame *fMain; // container frame
170 TList *fList; // list of frames to arrange
171
173 TGLayoutManager(gvl), fMain(gvl.fMain), fList(gvl.fList) { }
175 {if(this!=&gvl) { TGLayoutManager::operator=(gvl);
176 fMain=gvl.fMain; fList=gvl.fList;} return *this;}
177
178public:
180
181 virtual void Layout();
182 virtual TGDimension GetDefaultSize() const;
183 virtual void SavePrimitive(std::ostream &out, Option_t * = "");
184
185 ClassDef(TGVerticalLayout,0) // Vertical layout manager
186};
187
189public:
191
192 virtual void Layout();
193 virtual TGDimension GetDefaultSize() const;
194 virtual void SavePrimitive(std::ostream &out, Option_t * = "");
195
196 ClassDef(TGHorizontalLayout,0) // Horizontal layout manager
197};
198
199
200//////////////////////////////////////////////////////////////////////////
201// //
202// TGRowLayout and TGColumnLayout managers. //
203// //
204// The follwing two layout managers do not make use of TGLayoutHints. //
205// //
206//////////////////////////////////////////////////////////////////////////
207
209public:
210 Int_t fSep; // interval between frames
211
214
215 virtual void Layout();
216 virtual TGDimension GetDefaultSize() const;
217 virtual void SavePrimitive(std::ostream &out, Option_t * = "");
218
219 ClassDef(TGRowLayout,0) // Row layout manager
220};
221
223public:
225
226 virtual void Layout();
227 virtual TGDimension GetDefaultSize() const;
228 virtual void SavePrimitive(std::ostream &out, Option_t * = "");
229
230 ClassDef(TGColumnLayout,0) // Column layout manager
231};
232
233
234//////////////////////////////////////////////////////////////////////////
235// //
236// TGMatrixLayout manager. //
237// //
238// This layout managers does not make use of TGLayoutHints. //
239// //
240//////////////////////////////////////////////////////////////////////////
241
243
244private:
247
248protected:
249 TGCompositeFrame *fMain; // container frame
250 TList *fList; // list of frames to arrange
251
252public:
253 Int_t fSep; // interval between frames
254 Int_t fHints; // layout hints (currently not used)
255 UInt_t fRows; // number of rows
256 UInt_t fColumns; // number of columns
257
259
260 virtual void Layout();
261 virtual TGDimension GetDefaultSize() const;
262 virtual void SavePrimitive(std::ostream &out, Option_t * = "");
263
264 ClassDef(TGMatrixLayout,0) // Matrix layout manager
265};
266
267
268//////////////////////////////////////////////////////////////////////////
269// //
270// TGTileLayout, TGListLayout and TGListDetailsLayout managers. //
271// //
272// This are layout managers for the TGListView widget. //
273// //
274//////////////////////////////////////////////////////////////////////////
275
277
278private:
281
282protected:
283 Int_t fSep; // separation between tiles
284 TGCompositeFrame *fMain; // container frame
285 TList *fList; // list of frames to arrange
286 Bool_t fModified;// layout changed
287
288
289public:
291
292 virtual void Layout();
293 virtual TGDimension GetDefaultSize() const;
294 virtual Bool_t IsModified() const { return fModified; }
295 virtual void SavePrimitive(std::ostream &out, Option_t * = "");
296
297 ClassDef(TGTileLayout,0) // Tile layout manager
298};
299
301public:
303 TGTileLayout(main, sep) { }
304
305 virtual void Layout();
306 virtual TGDimension GetDefaultSize() const;
307 virtual void SavePrimitive(std::ostream &out, Option_t * = "");
308
309 ClassDef(TGListLayout,0) // Layout manager for TGListView widget
310};
311
313private:
314 UInt_t fWidth; // width of listview container
315
316public:
318 TGTileLayout(main, sep), fWidth(w) { }
319
320 virtual void Layout();
321 virtual TGDimension GetDefaultSize() const;
322 virtual void SetDefaultWidth(UInt_t w) { fWidth = w; }
323 virtual void SavePrimitive(std::ostream &out, Option_t * = "");
324
325 ClassDef(TGListDetailsLayout,0) // Layout manager for TGListView details
326};
327
328#endif
SVector< double, 2 > v
Definition: Dict.h:5
ROOT::R::TRInterface & r
Definition: Object.C:4
#define f(i)
Definition: RSha256.hxx:104
#define c(i)
Definition: RSha256.hxx:101
#define h(i)
Definition: RSha256.hxx:106
int Int_t
Definition: RtypesCore.h:41
unsigned int UInt_t
Definition: RtypesCore.h:42
unsigned long ULong_t
Definition: RtypesCore.h:51
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kTRUE
Definition: RtypesCore.h:87
const char Option_t
Definition: RtypesCore.h:62
#define ClassDef(name, id)
Definition: Rtypes.h:324
#define BIT(n)
Definition: Rtypes.h:82
ELayoutHints
Definition: TGLayout.h:29
@ kLHintsNoHints
Definition: TGLayout.h:30
@ kLHintsRight
Definition: TGLayout.h:33
@ kLHintsExpandY
Definition: TGLayout.h:38
@ kLHintsLeft
Definition: TGLayout.h:31
@ kLHintsCenterY
Definition: TGLayout.h:35
@ kLHintsNormal
Definition: TGLayout.h:39
@ kLHintsCenterX
Definition: TGLayout.h:32
@ kLHintsBottom
Definition: TGLayout.h:36
@ kLHintsTop
Definition: TGLayout.h:34
@ kLHintsExpandX
Definition: TGLayout.h:37
virtual TGDimension GetDefaultSize() const
Return default dimension of the column layout.
Definition: TGLayout.cxx:620
virtual void SavePrimitive(std::ostream &out, Option_t *="")
Save a primitive as a C++ statement(s) on output stream "out".
Definition: TGLayout.cxx:1092
virtual void Layout()
Make a column layout of all frames in the list.
Definition: TGLayout.cxx:596
TGColumnLayout(TGCompositeFrame *main, Int_t s=0)
Definition: TGLayout.h:224
TGLayoutHints * fLayout
Definition: TGLayout.h:121
TGFrameElement & operator=(const TGFrameElement &)
void Print(Option_t *option="") const
Print this frame element.
Definition: TGLayout.cxx:99
~TGFrameElement()
Destructor. Decrease ref. count of fLayout.
Definition: TGLayout.cxx:92
Int_t fState
Definition: TGLayout.h:120
TGFrameElement(const TGFrameElement &)
TGFrame * fFrame
Definition: TGLayout.h:119
void ls(Option_t *option="") const
The ls function lists the contents of a class on stdout.
Definition: TGLayout.h:128
TGHorizontalLayout(TGCompositeFrame *main)
Definition: TGLayout.h:190
virtual TGDimension GetDefaultSize() const
Return default dimension of the horizontal layout.
Definition: TGLayout.cxx:507
virtual void Layout()
Make a horizontal layout of all frames in the list.
Definition: TGLayout.cxx:381
virtual void SavePrimitive(std::ostream &out, Option_t *="")
Save a primitive as a C++ statement(s) on output stream "out".
Definition: TGLayout.cxx:1073
TGFrameElement * fPrev
Definition: TGLayout.h:64
Int_t GetPadRight() const
Definition: TGLayout.h:93
TGLayoutHints & operator=(const TGLayoutHints &)
void Print(Option_t *option="") const
Printing.
Definition: TGLayout.cxx:151
Int_t fPadtop
Definition: TGLayout.h:70
void ls(Option_t *option="") const
The ls function lists the contents of a class on stdout.
Definition: TGLayout.h:102
Int_t GetPadBottom() const
Definition: TGLayout.h:91
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
Definition: TGLayout.cxx:1003
Int_t fPadbottom
Definition: TGLayout.h:71
TGLayoutHints(ULong_t hints=kLHintsNormal, Int_t padleft=0, Int_t padright=0, Int_t padtop=0, Int_t padbottom=0)
Definition: TGLayout.h:78
ULong_t fLayoutHints
Definition: TGLayout.h:69
ULong_t GetLayoutHints() const
Definition: TGLayout.h:89
Int_t fPadleft
Definition: TGLayout.h:72
virtual void SetPadRight(Int_t v)
Definition: TGLayout.h:99
virtual void SetPadLeft(Int_t v)
Definition: TGLayout.h:98
Int_t GetPadTop() const
Definition: TGLayout.h:90
TGFrameElement * fFE
Definition: TGLayout.h:63
virtual ~TGLayoutHints()
Destructor.
Definition: TGLayout.cxx:128
virtual void SetPadTop(Int_t v)
Definition: TGLayout.h:96
Int_t GetPadLeft() const
Definition: TGLayout.h:92
virtual void SetPadBottom(Int_t v)
Definition: TGLayout.h:97
Int_t fPadright
Definition: TGLayout.h:73
void UpdateFrameElements(TGLayoutHints *l)
Update layout hints of frame elements.
Definition: TGLayout.cxx:135
virtual void SetLayoutHints(ULong_t lh)
Definition: TGLayout.h:95
virtual void SetDefaultWidth(UInt_t)
Definition: TGLayout.h:151
virtual Bool_t IsModified() const
Definition: TGLayout.h:153
virtual void SetModified(Bool_t flag=kTRUE)
Definition: TGLayout.h:154
Bool_t fModified
Definition: TGLayout.h:144
virtual TGDimension GetDefaultSize() const =0
virtual void Layout()=0
virtual void SetDefaultHeight(UInt_t)
Definition: TGLayout.h:152
virtual void SetDefaultWidth(UInt_t w)
Definition: TGLayout.h:322
virtual TGDimension GetDefaultSize() const
Return default dimension of the list details layout.
Definition: TGLayout.cxx:979
TGListDetailsLayout(TGCompositeFrame *main, Int_t sep=0, UInt_t w=0)
Definition: TGLayout.h:317
virtual void Layout()
Make a list details layout of all frames in the list.
Definition: TGLayout.cxx:947
virtual void SavePrimitive(std::ostream &out, Option_t *="")
Save a primitive as a C++ statement(s) on output stream "out".
Definition: TGLayout.cxx:1139
virtual void SavePrimitive(std::ostream &out, Option_t *="")
Save a primitive as a C++ statement(s) on output stream "out".
Definition: TGLayout.cxx:1128
virtual void Layout()
Make a tile layout of all frames in the list.
Definition: TGLayout.cxx:855
TGListLayout(TGCompositeFrame *main, Int_t sep=0)
Definition: TGLayout.h:302
virtual TGDimension GetDefaultSize() const
Return default dimension of the list layout.
Definition: TGLayout.cxx:913
UInt_t fRows
Definition: TGLayout.h:255
TGMatrixLayout & operator=(const TGMatrixLayout &)
Int_t fHints
Definition: TGLayout.h:254
virtual TGDimension GetDefaultSize() const
Return default dimension of the matrix layout.
Definition: TGLayout.cxx:721
TGCompositeFrame * fMain
Definition: TGLayout.h:249
virtual void SavePrimitive(std::ostream &out, Option_t *="")
Save a primitive as a C++ statement(s) on output stream "out".
Definition: TGLayout.cxx:1103
UInt_t fColumns
Definition: TGLayout.h:256
virtual void Layout()
Make a matrix layout of all frames in the list.
Definition: TGLayout.cxx:665
TGMatrixLayout(const TGMatrixLayout &)
TList * fList
Definition: TGLayout.h:250
virtual void Layout()
Make a row layout of all frames in the list.
Definition: TGLayout.cxx:539
Int_t fSep
Definition: TGLayout.h:210
TGRowLayout(TGCompositeFrame *main, Int_t s=0)
Definition: TGLayout.h:212
virtual void SavePrimitive(std::ostream &out, Option_t *="")
Save a primitive as a C++ statement(s) on output stream "out".
Definition: TGLayout.cxx:1082
virtual TGDimension GetDefaultSize() const
Return default dimension of the row layout.
Definition: TGLayout.cxx:565
virtual TGDimension GetDefaultSize() const
Return default dimension of the tile layout.
Definition: TGLayout.cxx:820
TGTileLayout(const TGTileLayout &)
virtual void SavePrimitive(std::ostream &out, Option_t *="")
Save a primitive as a C++ statement(s) on output stream "out".
Definition: TGLayout.cxx:1117
TGTileLayout & operator=(const TGTileLayout &)
TList * fList
Definition: TGLayout.h:285
Int_t fSep
Definition: TGLayout.h:283
TGCompositeFrame * fMain
Definition: TGLayout.h:284
virtual void Layout()
Make a tile layout of all frames in the list.
Definition: TGLayout.cxx:765
Bool_t fModified
Definition: TGLayout.h:286
virtual Bool_t IsModified() const
Definition: TGLayout.h:294
virtual TGDimension GetDefaultSize() const
Return default dimension of the vertical layout.
Definition: TGLayout.cxx:349
TGVerticalLayout(const TGVerticalLayout &gvl)
Definition: TGLayout.h:172
virtual void Layout()
Make a vertical layout of all frames in the list.
Definition: TGLayout.cxx:217
TList * fList
Definition: TGLayout.h:170
TGCompositeFrame * fMain
Definition: TGLayout.h:169
TGVerticalLayout & operator=(const TGVerticalLayout &gvl)
Definition: TGLayout.h:174
virtual void SavePrimitive(std::ostream &out, Option_t *="")
Save a primitive as a C++ statement(s) on output stream "out".
Definition: TGLayout.cxx:1063
A doubly linked list.
Definition: TList.h:44
Mother of all ROOT objects.
Definition: TObject.h:37
TObject & operator=(const TObject &rhs)
TObject assignment operator.
Definition: TObject.h:271
Definitions for TRefCnt, base class for reference counted objects.
Definition: TRefCnt.h:27
void SetRefCount(UInt_t r)
Definition: TRefCnt.h:39
int main(int argc, char **argv)
static constexpr double s
auto * l
Definition: textangle.C:4