Logo ROOT  
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#include "TObject.h"
17#include "TGDimension.h"
18#include "TRefCnt.h"
19
20//---- layout hints
21
33 // bits 8-11 used by ETableLayoutHints
34};
35
36class TGFrame;
38class TGLayoutHints;
39class TList;
40class TGFrameElement;
41
42/** \class TGLayoutHints
43 \ingroup guiwidgets
44
45This class describes layout hints used by the layout classes.
46
47*/
48
49
50class TGLayoutHints : public TObject, public TRefCnt {
51
52friend class TGFrameElement;
53friend class TGCompositeFrame;
54
55private:
56 TGFrameElement *fFE; // back pointer to the last frame element
57 TGFrameElement *fPrev; // previous element sharing this layout_hints
58
60
61protected:
62 ULong_t fLayoutHints; // layout hints (combination of ELayoutHints)
63 Int_t fPadtop; // amount of top padding
64 Int_t fPadbottom; // amount of bottom padding
65 Int_t fPadleft; // amount of left padding
66 Int_t fPadright; // amount of right padding
67
69
70public:
72 Int_t padleft = 0, Int_t padright = 0,
73 Int_t padtop = 0, Int_t padbottom = 0):
74 fFE(0), fPrev(0), fLayoutHints(hints), fPadtop(padtop), fPadbottom(padbottom),
75 fPadleft(padleft), fPadright(padright)
76 { SetRefCount(0); }
77
79
80 virtual ~TGLayoutHints();
81
83 Int_t GetPadTop() const { return fPadtop; }
84 Int_t GetPadBottom() const { return fPadbottom; }
85 Int_t GetPadLeft() const { return fPadleft; }
86 Int_t GetPadRight() const { return fPadright; }
87
88 virtual void SetLayoutHints(ULong_t lh) { fLayoutHints = lh; }
89 virtual void SetPadTop(Int_t v) { fPadtop = v; }
90 virtual void SetPadBottom(Int_t v) { fPadbottom = v; }
91 virtual void SetPadLeft(Int_t v) { fPadleft = v; }
92 virtual void SetPadRight(Int_t v) { fPadright = v; }
93
94 void Print(Option_t* option = "") const;
95 void ls(Option_t* option = "") const { Print(option); }
96
97 virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
98
99 ClassDef(TGLayoutHints,0) // Class describing GUI layout hints
100};
101
102// Temporarily public as we need to share this class definition
103// with the frame manager class
104
105class TGFrameElement : public TObject {
106
107private:
110
111public:
112 TGFrame *fFrame; // frame used in layout
113 Int_t fState; // EFrameState defined in TGFrame.h
114 TGLayoutHints *fLayout; // layout hints used in layout
115
119
120 void Print(Option_t* option = "") const;
121 void ls(Option_t* option = "") const { Print(option); }
122
123 ClassDef(TGFrameElement, 0); // Base class used in GUI containers
124};
125
126
127/** \class TGLayoutManager
128 \ingroup guiwidgets
129
130Frame layout manager. This is an abstract class.
131
132*/
133
134
135class TGLayoutManager : public TObject {
136protected:
137 Bool_t fModified;// kTRUE if positions of subframes changed after layout
138
139public:
141
142 virtual void Layout() = 0;
143 virtual TGDimension GetDefaultSize() const = 0;
144 virtual void SetDefaultWidth(UInt_t /* w */) {}
145 virtual void SetDefaultHeight(UInt_t /* h */) {}
146 virtual Bool_t IsModified() const { return fModified; }
147 virtual void SetModified(Bool_t flag = kTRUE) { fModified = flag; }
148
149 ClassDef(TGLayoutManager,0) // Layout manager abstract base class
150};
151
152
153/** \class TGVerticalLayout
154 \ingroup guiwidgets
155
156*/
157
158
160
161protected:
162 TGCompositeFrame *fMain; // container frame
163 TList *fList; // list of frames to arrange
164
166 TGLayoutManager(gvl), fMain(gvl.fMain), fList(gvl.fList) { }
168 {if(this!=&gvl) { TGLayoutManager::operator=(gvl);
169 fMain=gvl.fMain; fList=gvl.fList;} return *this;}
170
171public:
173
174 virtual void Layout();
175 virtual TGDimension GetDefaultSize() const;
176 virtual void SavePrimitive(std::ostream &out, Option_t * = "");
177
178 ClassDef(TGVerticalLayout,0) // Vertical layout manager
179};
180
181/** \class TGHorizontalLayout
182 \ingroup guiwidgets
183
184*/
185
186
188public:
190
191 virtual void Layout();
192 virtual TGDimension GetDefaultSize() const;
193 virtual void SavePrimitive(std::ostream &out, Option_t * = "");
194
195 ClassDef(TGHorizontalLayout,0) // Horizontal layout manager
196};
197
198
199/** \class TGRowLayout
200 \ingroup guiwidgets
201
202The following two layout managers do not make use of TGLayoutHints.
203
204*/
205
206
208public:
209 Int_t fSep; // interval between frames
210
213
214 virtual void Layout();
215 virtual TGDimension GetDefaultSize() const;
216 virtual void SavePrimitive(std::ostream &out, Option_t * = "");
217
218 ClassDef(TGRowLayout,0) // Row layout manager
219};
220
221/** \class TGColumnLayout
222 \ingroup guiwidgets
223
224The following layout manager do not make use of TGLayoutHints.
225
226*/
227
228
230public:
232
233 virtual void Layout();
234 virtual TGDimension GetDefaultSize() const;
235 virtual void SavePrimitive(std::ostream &out, Option_t * = "");
236
237 ClassDef(TGColumnLayout,0) // Column layout manager
238};
239
240
241/** \class TGMatrixLayout
242 \ingroup guiwidgets
243
244This layout managers does not make use of TGLayoutHints.
245
246
247It arranges frames in a matrix-like way.
248This manager provides :
249- a column number (0 means unlimited)
250- a row number (0 means unlimited)
251- horizontal & vertical separators
252
253Notes : If both column and row are fixed values, any remaining
254 frames outside the count won't be managed.
255 Unlimited rows means the frame can expand downward
256 (the default behaviour in most UI).
257 Both unlimited rows and columns is undefined (read: will
258 crash the algorithm ;-).
259 With fixed dimensions, frames are always arranged in rows.
260 That is: 1st frame is at position (0,0), next one is at
261 row(0), column(1) and so on...
262 When specifying one dimension as unlimited (i.e. row=0 or
263 column=0) the frames are arranged according to the direction
264 of the fixed dimension. This layout manager does not make
265 use of TGLayoutHints.
266*/
267
268
270
271private:
274
275protected:
276 TGCompositeFrame *fMain; ///< container frame
277 TList *fList; ///< list of frames to arrange
278
279public:
280 Int_t fSep; ///< interval between frames
281 Int_t fHints; ///< layout hints (currently not used)
282 UInt_t fRows; ///< number of rows
283 UInt_t fColumns; ///< number of columns
284
286
287 virtual void Layout();
288 virtual TGDimension GetDefaultSize() const;
289 virtual void SavePrimitive(std::ostream &out, Option_t * = "");
290
291 ClassDef(TGMatrixLayout,0) // Matrix layout manager
292};
293
294
295/** \class TGTileLayout
296 \ingroup guiwidgets
297
298This is a layout manager for the TGListView widget.
299
300*/
301
302
304
305private:
308
309protected:
310 Int_t fSep; ///< separation between tiles
311 TGCompositeFrame *fMain; ///< container frame
312 TList *fList; ///< list of frames to arrange
313 Bool_t fModified; ///< layout changed
314
315
316public:
318
319 virtual void Layout();
320 virtual TGDimension GetDefaultSize() const;
321 virtual Bool_t IsModified() const { return fModified; }
322 virtual void SavePrimitive(std::ostream &out, Option_t * = "");
323
324 ClassDef(TGTileLayout,0) // Tile layout manager
325};
326
327/** \class TGListLayout
328 \ingroup guiwidgets
329
330This is a layout manager for the TGListView widget.
331
332*/
333
334
336public:
338 TGTileLayout(main, sep) { }
339
340 virtual void Layout();
341 virtual TGDimension GetDefaultSize() const;
342 virtual void SavePrimitive(std::ostream &out, Option_t * = "");
343
344 ClassDef(TGListLayout,0) // Layout manager for TGListView widget
345};
346
347/** \class TGListDetailsLayout
348 \ingroup guiwidgets
349
350This is a layout manager for the TGListView widget.
351
352*/
353
354
356private:
357 UInt_t fWidth; // width of listview container
358
359public:
361 TGTileLayout(main, sep), fWidth(w) { }
362
363 virtual void Layout();
364 virtual TGDimension GetDefaultSize() const;
365 virtual void SetDefaultWidth(UInt_t w) { fWidth = w; }
366 virtual void SavePrimitive(std::ostream &out, Option_t * = "");
367
368 ClassDef(TGListDetailsLayout,0) // Layout manager for TGListView details
369};
370
371#endif
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:45
unsigned int UInt_t
Definition: RtypesCore.h:46
unsigned long ULong_t
Definition: RtypesCore.h:55
bool Bool_t
Definition: RtypesCore.h:63
const Bool_t kTRUE
Definition: RtypesCore.h:100
const char Option_t
Definition: RtypesCore.h:66
#define ClassDef(name, id)
Definition: Rtypes.h:325
#define BIT(n)
Definition: Rtypes.h:85
ELayoutHints
Definition: TGLayout.h:22
@ kLHintsNoHints
Definition: TGLayout.h:23
@ kLHintsRight
Definition: TGLayout.h:26
@ kLHintsExpandY
Definition: TGLayout.h:31
@ kLHintsLeft
Definition: TGLayout.h:24
@ kLHintsCenterY
Definition: TGLayout.h:28
@ kLHintsNormal
Definition: TGLayout.h:32
@ kLHintsCenterX
Definition: TGLayout.h:25
@ kLHintsBottom
Definition: TGLayout.h:29
@ kLHintsTop
Definition: TGLayout.h:27
@ kLHintsExpandX
Definition: TGLayout.h:30
int main(int argc, char *argv[])
Definition: cef_main.cxx:54
The following layout manager do not make use of TGLayoutHints.
Definition: TGLayout.h:229
virtual TGDimension GetDefaultSize() const
Return default dimension of the column layout.
Definition: TGLayout.cxx:590
virtual void SavePrimitive(std::ostream &out, Option_t *="")
Save column layout manager as a C++ statement(s) on output stream.
Definition: TGLayout.cxx:1064
virtual void Layout()
Make a column layout of all frames in the list.
Definition: TGLayout.cxx:566
TGColumnLayout(TGCompositeFrame *main, Int_t s=0)
Definition: TGLayout.h:231
The base class for composite widgets (menu bars, list boxes, etc.).
Definition: TGFrame.h:287
TGLayoutHints * fLayout
Definition: TGLayout.h:114
TGFrameElement & operator=(const TGFrameElement &)
void Print(Option_t *option="") const
Print this frame element.
Definition: TGLayout.cxx:71
~TGFrameElement()
Destructor. Decrease ref. count of fLayout.
Definition: TGLayout.cxx:64
Int_t fState
Definition: TGLayout.h:113
TGFrameElement(const TGFrameElement &)
TGFrame * fFrame
Definition: TGLayout.h:112
void ls(Option_t *option="") const
The ls function lists the contents of a class on stdout.
Definition: TGLayout.h:121
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
Definition: TGFrame.h:80
TGHorizontalLayout(TGCompositeFrame *main)
Definition: TGLayout.h:189
virtual TGDimension GetDefaultSize() const
Return default dimension of the horizontal layout.
Definition: TGLayout.cxx:477
virtual void Layout()
Make a horizontal layout of all frames in the list.
Definition: TGLayout.cxx:352
virtual void SavePrimitive(std::ostream &out, Option_t *="")
Save horizontal layout manager as a C++ statement(s) on output stream.
Definition: TGLayout.cxx:1045
This class describes layout hints used by the layout classes.
Definition: TGLayout.h:50
TGFrameElement * fPrev
Definition: TGLayout.h:57
Int_t GetPadRight() const
Definition: TGLayout.h:86
TGLayoutHints & operator=(const TGLayoutHints &)
void Print(Option_t *option="") const
Printing.
Definition: TGLayout.cxx:123
Int_t fPadtop
Definition: TGLayout.h:63
void ls(Option_t *option="") const
The ls function lists the contents of a class on stdout.
Definition: TGLayout.h:95
Int_t GetPadBottom() const
Definition: TGLayout.h:84
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save layout hints as a C++ statement(s) on output stream out.
Definition: TGLayout.cxx:975
Int_t fPadbottom
Definition: TGLayout.h:64
TGLayoutHints(ULong_t hints=kLHintsNormal, Int_t padleft=0, Int_t padright=0, Int_t padtop=0, Int_t padbottom=0)
Definition: TGLayout.h:71
ULong_t fLayoutHints
Definition: TGLayout.h:62
ULong_t GetLayoutHints() const
Definition: TGLayout.h:82
Int_t fPadleft
Definition: TGLayout.h:65
virtual void SetPadRight(Int_t v)
Definition: TGLayout.h:92
virtual void SetPadLeft(Int_t v)
Definition: TGLayout.h:91
Int_t GetPadTop() const
Definition: TGLayout.h:83
TGFrameElement * fFE
Definition: TGLayout.h:56
virtual ~TGLayoutHints()
Destructor.
Definition: TGLayout.cxx:100
virtual void SetPadTop(Int_t v)
Definition: TGLayout.h:89
Int_t GetPadLeft() const
Definition: TGLayout.h:85
virtual void SetPadBottom(Int_t v)
Definition: TGLayout.h:90
Int_t fPadright
Definition: TGLayout.h:66
void UpdateFrameElements(TGLayoutHints *l)
Update layout hints of frame elements.
Definition: TGLayout.cxx:107
virtual void SetLayoutHints(ULong_t lh)
Definition: TGLayout.h:88
Frame layout manager.
Definition: TGLayout.h:135
virtual void SetDefaultWidth(UInt_t)
Definition: TGLayout.h:144
virtual Bool_t IsModified() const
Definition: TGLayout.h:146
virtual void SetModified(Bool_t flag=kTRUE)
Definition: TGLayout.h:147
Bool_t fModified
Definition: TGLayout.h:137
virtual TGDimension GetDefaultSize() const =0
virtual void Layout()=0
virtual void SetDefaultHeight(UInt_t)
Definition: TGLayout.h:145
This is a layout manager for the TGListView widget.
Definition: TGLayout.h:355
virtual void SetDefaultWidth(UInt_t w)
Definition: TGLayout.h:365
virtual TGDimension GetDefaultSize() const
Return default dimension of the list details layout.
Definition: TGLayout.cxx:949
TGListDetailsLayout(TGCompositeFrame *main, Int_t sep=0, UInt_t w=0)
Definition: TGLayout.h:360
virtual void Layout()
Make a list details layout of all frames in the list.
Definition: TGLayout.cxx:917
virtual void SavePrimitive(std::ostream &out, Option_t *="")
Save list details layout manager as a C++ statement(s) on out stream.
Definition: TGLayout.cxx:1111
This is a layout manager for the TGListView widget.
Definition: TGLayout.h:335
virtual void SavePrimitive(std::ostream &out, Option_t *="")
Save list layout manager as a C++ statement(s) on output stream.
Definition: TGLayout.cxx:1100
virtual void Layout()
Make a tile layout of all frames in the list.
Definition: TGLayout.cxx:825
TGListLayout(TGCompositeFrame *main, Int_t sep=0)
Definition: TGLayout.h:337
virtual TGDimension GetDefaultSize() const
Return default dimension of the list layout.
Definition: TGLayout.cxx:883
This layout managers does not make use of TGLayoutHints.
Definition: TGLayout.h:269
UInt_t fRows
number of rows
Definition: TGLayout.h:282
TGMatrixLayout & operator=(const TGMatrixLayout &)
Int_t fHints
layout hints (currently not used)
Definition: TGLayout.h:281
virtual TGDimension GetDefaultSize() const
Return default dimension of the matrix layout.
Definition: TGLayout.cxx:691
TGCompositeFrame * fMain
container frame
Definition: TGLayout.h:276
Int_t fSep
interval between frames
Definition: TGLayout.h:280
virtual void SavePrimitive(std::ostream &out, Option_t *="")
Save matrix layout manager as a C++ statement(s) on output stream.
Definition: TGLayout.cxx:1075
UInt_t fColumns
number of columns
Definition: TGLayout.h:283
virtual void Layout()
Make a matrix layout of all frames in the list.
Definition: TGLayout.cxx:635
TGMatrixLayout(const TGMatrixLayout &)
TList * fList
list of frames to arrange
Definition: TGLayout.h:277
The following two layout managers do not make use of TGLayoutHints.
Definition: TGLayout.h:207
virtual void Layout()
Make a row layout of all frames in the list.
Definition: TGLayout.cxx:509
Int_t fSep
Definition: TGLayout.h:209
TGRowLayout(TGCompositeFrame *main, Int_t s=0)
Definition: TGLayout.h:211
virtual void SavePrimitive(std::ostream &out, Option_t *="")
Save row layout manager as a C++ statement(s) on output stream.
Definition: TGLayout.cxx:1054
virtual TGDimension GetDefaultSize() const
Return default dimension of the row layout.
Definition: TGLayout.cxx:535
This is a layout manager for the TGListView widget.
Definition: TGLayout.h:303
virtual TGDimension GetDefaultSize() const
Return default dimension of the tile layout.
Definition: TGLayout.cxx:790
TGTileLayout(const TGTileLayout &)
virtual void SavePrimitive(std::ostream &out, Option_t *="")
Save tile layout manager as a C++ statement(s) on output stream.
Definition: TGLayout.cxx:1089
TGTileLayout & operator=(const TGTileLayout &)
TList * fList
list of frames to arrange
Definition: TGLayout.h:312
Int_t fSep
separation between tiles
Definition: TGLayout.h:310
TGCompositeFrame * fMain
container frame
Definition: TGLayout.h:311
virtual void Layout()
Make a tile layout of all frames in the list.
Definition: TGLayout.cxx:735
Bool_t fModified
layout changed
Definition: TGLayout.h:313
virtual Bool_t IsModified() const
Definition: TGLayout.h:321
virtual TGDimension GetDefaultSize() const
Return default dimension of the vertical layout.
Definition: TGLayout.cxx:320
TGVerticalLayout(const TGVerticalLayout &gvl)
Definition: TGLayout.h:165
virtual void Layout()
Make a vertical layout of all frames in the list.
Definition: TGLayout.cxx:189
TList * fList
Definition: TGLayout.h:163
TGCompositeFrame * fMain
Definition: TGLayout.h:162
TGVerticalLayout & operator=(const TGVerticalLayout &gvl)
Definition: TGLayout.h:167
virtual void SavePrimitive(std::ostream &out, Option_t *="")
Save vertical layout manager as a C++ statement(s) on output stream.
Definition: TGLayout.cxx:1035
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:283
Definitions for TRefCnt, base class for reference counted objects.
Definition: TRefCnt.h:27
void SetRefCount(UInt_t r)
Definition: TRefCnt.h:39
static constexpr double s
auto * l
Definition: textangle.C:4