00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_TGLayout
00013 #define ROOT_TGLayout
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef ROOT_TObject
00024 #include "TObject.h"
00025 #endif
00026 #ifndef ROOT_TGDimension
00027 #include "TGDimension.h"
00028 #endif
00029 #ifndef ROOT_TRefCnt
00030 #include "TRefCnt.h"
00031 #endif
00032
00033
00034
00035 enum ELayoutHints {
00036 kLHintsNoHints = 0,
00037 kLHintsLeft = BIT(0),
00038 kLHintsCenterX = BIT(1),
00039 kLHintsRight = BIT(2),
00040 kLHintsTop = BIT(3),
00041 kLHintsCenterY = BIT(4),
00042 kLHintsBottom = BIT(5),
00043 kLHintsExpandX = BIT(6),
00044 kLHintsExpandY = BIT(7),
00045 kLHintsNormal = (kLHintsLeft | kLHintsTop)
00046
00047 };
00048
00049 class TGFrame;
00050 class TGCompositeFrame;
00051 class TGLayoutHints;
00052 class TList;
00053 class TGFrameElement;
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063 class TGLayoutHints : public TObject, public TRefCnt {
00064
00065 friend class TGFrameElement;
00066 friend class TGCompositeFrame;
00067
00068 private:
00069 TGFrameElement *fFE;
00070 TGFrameElement *fPrev;
00071
00072 TGLayoutHints& operator=(const TGLayoutHints&);
00073
00074 protected:
00075 ULong_t fLayoutHints;
00076 Int_t fPadtop;
00077 Int_t fPadbottom;
00078 Int_t fPadleft;
00079 Int_t fPadright;
00080
00081 void UpdateFrameElements(TGLayoutHints *l);
00082
00083 public:
00084 TGLayoutHints(ULong_t hints = kLHintsNormal,
00085 Int_t padleft = 0, Int_t padright = 0,
00086 Int_t padtop = 0, Int_t padbottom = 0):
00087 fFE(0), fPrev(0), fLayoutHints(hints), fPadtop(padtop), fPadbottom(padbottom),
00088 fPadleft(padleft), fPadright(padright)
00089 { SetRefCount(0); }
00090
00091 TGLayoutHints(const TGLayoutHints &lh);
00092
00093 virtual ~TGLayoutHints();
00094
00095 ULong_t GetLayoutHints() const { return fLayoutHints; }
00096 Int_t GetPadTop() const { return fPadtop; }
00097 Int_t GetPadBottom() const { return fPadbottom; }
00098 Int_t GetPadLeft() const { return fPadleft; }
00099 Int_t GetPadRight() const { return fPadright; }
00100
00101 virtual void SetLayoutHints(ULong_t lh) { fLayoutHints = lh; }
00102 virtual void SetPadTop(Int_t v) { fPadtop = v; }
00103 virtual void SetPadBottom(Int_t v) { fPadbottom = v; }
00104 virtual void SetPadLeft(Int_t v) { fPadleft = v; }
00105 virtual void SetPadRight(Int_t v) { fPadright = v; }
00106
00107 void Print(Option_t* option = "") const;
00108 void ls(Option_t* option = "") const { Print(option); }
00109
00110 virtual void SavePrimitive(ostream &out, Option_t *option = "");
00111
00112 ClassDef(TGLayoutHints,0)
00113 };
00114
00115
00116
00117
00118 class TGFrameElement : public TObject {
00119
00120 private:
00121 TGFrameElement(const TGFrameElement&);
00122 TGFrameElement& operator=(const TGFrameElement&);
00123
00124 public:
00125 TGFrame *fFrame;
00126 Int_t fState;
00127 TGLayoutHints *fLayout;
00128
00129 TGFrameElement() : fFrame(0), fState(0), fLayout(0) { }
00130 TGFrameElement(TGFrame *f, TGLayoutHints *l);
00131 ~TGFrameElement();
00132
00133 void Print(Option_t* option = "") const;
00134 void ls(Option_t* option = "") const { Print(option); }
00135
00136 ClassDef(TGFrameElement, 0);
00137 };
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148 class TGLayoutManager : public TObject {
00149 protected:
00150 Bool_t fModified;
00151
00152 public:
00153 TGLayoutManager() : fModified(kTRUE) {}
00154
00155 virtual void Layout() = 0;
00156 virtual TGDimension GetDefaultSize() const = 0;
00157 virtual void SetDefaultWidth(UInt_t ) {}
00158 virtual void SetDefaultHeight(UInt_t ) {}
00159 virtual Bool_t IsModified() const { return fModified; }
00160 virtual void SetModified(Bool_t flag = kTRUE) { fModified = flag; }
00161
00162 ClassDef(TGLayoutManager,0)
00163 };
00164
00165
00166
00167
00168
00169
00170
00171
00172 class TGVerticalLayout : public TGLayoutManager {
00173
00174 protected:
00175 TGCompositeFrame *fMain;
00176 TList *fList;
00177
00178 TGVerticalLayout(const TGVerticalLayout& gvl) :
00179 TGLayoutManager(gvl), fMain(gvl.fMain), fList(gvl.fList) { }
00180 TGVerticalLayout& operator=(const TGVerticalLayout& gvl)
00181 {if(this!=&gvl) { TGLayoutManager::operator=(gvl);
00182 fMain=gvl.fMain; fList=gvl.fList;} return *this;}
00183
00184 public:
00185 TGVerticalLayout(TGCompositeFrame *main);
00186
00187 virtual void Layout();
00188 virtual TGDimension GetDefaultSize() const;
00189 virtual void SavePrimitive(ostream &out, Option_t * = "");
00190
00191 ClassDef(TGVerticalLayout,0)
00192 };
00193
00194 class TGHorizontalLayout : public TGVerticalLayout {
00195 public:
00196 TGHorizontalLayout(TGCompositeFrame *main) : TGVerticalLayout(main) { }
00197
00198 virtual void Layout();
00199 virtual TGDimension GetDefaultSize() const;
00200 virtual void SavePrimitive(ostream &out, Option_t * = "");
00201
00202 ClassDef(TGHorizontalLayout,0)
00203 };
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214 class TGRowLayout : public TGVerticalLayout {
00215 public:
00216 Int_t fSep;
00217
00218 TGRowLayout(TGCompositeFrame *main, Int_t s = 0) :
00219 TGVerticalLayout(main), fSep(s) { }
00220
00221 virtual void Layout();
00222 virtual TGDimension GetDefaultSize() const;
00223 virtual void SavePrimitive(ostream &out, Option_t * = "");
00224
00225 ClassDef(TGRowLayout,0)
00226 };
00227
00228 class TGColumnLayout : public TGRowLayout {
00229 public:
00230 TGColumnLayout(TGCompositeFrame *main, Int_t s = 0) : TGRowLayout(main, s) { }
00231
00232 virtual void Layout();
00233 virtual TGDimension GetDefaultSize() const;
00234 virtual void SavePrimitive(ostream &out, Option_t * = "");
00235
00236 ClassDef(TGColumnLayout,0)
00237 };
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248 class TGMatrixLayout : public TGLayoutManager {
00249
00250 private:
00251 TGMatrixLayout(const TGMatrixLayout&);
00252 TGMatrixLayout& operator=(const TGMatrixLayout&);
00253
00254 protected:
00255 TGCompositeFrame *fMain;
00256 TList *fList;
00257
00258 public:
00259 Int_t fSep;
00260 Int_t fHints;
00261 UInt_t fRows;
00262 UInt_t fColumns;
00263
00264 TGMatrixLayout(TGCompositeFrame *main, UInt_t r, UInt_t c, Int_t s=0, Int_t h=0);
00265
00266 virtual void Layout();
00267 virtual TGDimension GetDefaultSize() const;
00268 virtual void SavePrimitive(ostream &out, Option_t * = "");
00269
00270 ClassDef(TGMatrixLayout,0)
00271 };
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282 class TGTileLayout : public TGLayoutManager {
00283
00284 private:
00285 TGTileLayout(const TGTileLayout&);
00286 TGTileLayout& operator=(const TGTileLayout&);
00287
00288 protected:
00289 Int_t fSep;
00290 TGCompositeFrame *fMain;
00291 TList *fList;
00292 Bool_t fModified;
00293
00294
00295 public:
00296 TGTileLayout(TGCompositeFrame *main, Int_t sep = 0);
00297
00298 virtual void Layout();
00299 virtual TGDimension GetDefaultSize() const;
00300 virtual Bool_t IsModified() const { return fModified; }
00301 virtual void SavePrimitive(ostream &out, Option_t * = "");
00302
00303 ClassDef(TGTileLayout,0)
00304 };
00305
00306 class TGListLayout : public TGTileLayout {
00307 public:
00308 TGListLayout(TGCompositeFrame *main, Int_t sep = 0) :
00309 TGTileLayout(main, sep) { }
00310
00311 virtual void Layout();
00312 virtual TGDimension GetDefaultSize() const;
00313 virtual void SavePrimitive(ostream &out, Option_t * = "");
00314
00315 ClassDef(TGListLayout,0)
00316 };
00317
00318 class TGListDetailsLayout : public TGTileLayout {
00319 private:
00320 UInt_t fWidth;
00321
00322 public:
00323 TGListDetailsLayout(TGCompositeFrame *main, Int_t sep = 0, UInt_t w = 0) :
00324 TGTileLayout(main, sep), fWidth(w) { }
00325
00326 virtual void Layout();
00327 virtual TGDimension GetDefaultSize() const;
00328 virtual void SetDefaultWidth(UInt_t w) { fWidth = w; }
00329 virtual void SavePrimitive(ostream &out, Option_t * = "");
00330
00331 ClassDef(TGListDetailsLayout,0)
00332 };
00333
00334 #endif