Logo ROOT   6.08/07
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 #ifndef ROOT_TGLayout
16 #include "TGLayout.h"
17 #endif
18 
19 
20 // extension of ELayoutHints
26 };
27 
28 
29 //////////////////////////////////////////////////////////////////////////
30 // //
31 // TGTableLayoutHints //
32 // //
33 // This class describes layout hints used by the TGTableLayout class. //
34 // //
35 //////////////////////////////////////////////////////////////////////////
36 
38 
39 private:
40  TGTableLayoutHints(const TGTableLayoutHints&); // Not implemented
41  TGTableLayoutHints& operator=(const TGTableLayoutHints&); // Not implemented
42 
43 protected:
44  UInt_t fAttachLeft; // Column/row division number on which
45  UInt_t fAttachRight; // to attach the frame. Starts at 0
46  UInt_t fAttachTop; // and goes to # columns / # rows
47  UInt_t fAttachBottom; // respectively
48 
49 public:
50  TGTableLayoutHints(UInt_t attach_left, UInt_t attach_right,
51  UInt_t attach_top, UInt_t attach_bottom,
52  ULong_t hints = kLHintsNormal,
53  UInt_t padleft = 0, UInt_t padright = 0,
54  UInt_t padtop = 0, UInt_t padbottom = 0)
55  : TGLayoutHints(hints,padleft,padright,padtop,padbottom),
56  fAttachLeft(attach_left),
57  fAttachRight(attach_right),
58  fAttachTop(attach_top),
59  fAttachBottom(attach_bottom) { }
60  virtual ~TGTableLayoutHints() { }
61 
62  UInt_t GetAttachLeft() const { return fAttachLeft; }
63  UInt_t GetAttachRight() const { return fAttachRight; }
64  UInt_t GetAttachTop() const { return fAttachTop; }
65  UInt_t GetAttachBottom() const { return fAttachBottom; }
66  virtual void SavePrimitive(std::ostream &out, Option_t * = "");
67 
68  ClassDef(TGTableLayoutHints,0) // Class describing GUI table layout hints
69 };
70 
71 
72 //////////////////////////////////////////////////////////////////////////
73 // //
74 // TGTableLayout //
75 // //
76 // A LayoutManager which places child frames in a table. This uses //
77 // TGTableLayoutHints (not TGLayoutHints). See TGTableLayoutHints //
78 // for how to use these. This manager works like TGMatrixLayout with //
79 // the addition that: //
80 // - Child frames can span more than one column/row. //
81 // - Child frames can resize with the frame. //
82 // - Column and row sizes are not fixed nor (optionally) homogeneous. //
83 // - The number of columns and rows must be fully specified. //
84 // //
85 //////////////////////////////////////////////////////////////////////////
86 
88 
89 private:
90  TGTableLayout(const TGTableLayout&); // Not implemented
91  TGTableLayout& operator=(const TGTableLayout&); // Not implemented
92 
93 protected:
94  struct TableData_t {
95  UInt_t fDefSize; // Default size of col/rows
96  UInt_t fRealSize; // Real size of col/rows (eg, if table resize)
102  };
103  TableData_t *fRow; // info about each row
104  TableData_t *fCol; // info about each column
105  TGCompositeFrame *fMain; // container frame
106  TList *fList; // list of frames to arrange
107  Bool_t fHomogeneous; // all cols/rows same size
108 
109  void FindRowColSizes();
110  void FindRowColSizesInit();
111  void FindRowColSizesHomogeneous();
112  void FindRowColSizesSinglyAttached();
113  void FindRowColSizesMultiplyAttached();
114 
115  void SetRowColSizes();
116  void SetRowColSizesInit();
117 
118  void CheckSanity();
119 
120  static void SetRowColResize(UInt_t real_size, UInt_t nthings,
121  TableData_t *thing, Bool_t homogeneous);
122 
123 public:
124  // these are public in TGMatrixLayout ??? Perpetuate it.
125  Int_t fSep; // interval between frames
126  Int_t fHints; // layout hints (currently not used)
127  UInt_t fNrows; // number of rows
128  UInt_t fNcols; // number of columns
129 
131  Bool_t homogeneous = kFALSE, Int_t sep = 0, Int_t hints = 0);
132  virtual ~TGTableLayout();
133 
134  virtual void Layout();
135  virtual TGDimension GetDefaultSize() const; // return sum of all child sizes
136  virtual void SavePrimitive(std::ostream &out, Option_t * = "");
137 
138  ClassDef(TGTableLayout,0) // Table layout manager
139 };
140 
141 #endif
UInt_t GetAttachLeft() const
Definition: TGTableLayout.h:62
ETableLayoutHints
Definition: TGTableLayout.h:21
const char Option_t
Definition: RtypesCore.h:62
#define BIT(n)
Definition: Rtypes.h:120
UInt_t GetAttachTop() const
Definition: TGTableLayout.h:64
Bool_t fHomogeneous
TGTableLayoutHints & operator=(const TGTableLayoutHints &)
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
TGCompositeFrame * fMain
#define ClassDef(name, id)
Definition: Rtypes.h:254
TableData_t * fRow
UInt_t GetAttachRight() const
Definition: TGTableLayout.h:63
A doubly linked list.
Definition: TList.h:47
TableData_t * fCol
UInt_t GetAttachBottom() const
Definition: TGTableLayout.h:65
unsigned int UInt_t
Definition: RtypesCore.h:42
TGTableLayoutHints(const TGTableLayoutHints &)
unsigned long ULong_t
Definition: RtypesCore.h:51
RooCmdArg Layout(Double_t xmin, Double_t xmax=0.99, Double_t ymin=0.95)
virtual void SavePrimitive(std::ostream &out, Option_t *="")
Save a primitive as a C++ statement(s) on output stream "out".
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:50
int main(int argc, char **argv)
virtual ~TGTableLayoutHints()
Definition: TGTableLayout.h:60