#ifndef ROOT_TGLayout
#define ROOT_TGLayout
#ifndef ROOT_TObject
#include "TObject.h"
#endif
#ifndef ROOT_TGDimension
#include "TGDimension.h"
#endif
#ifndef ROOT_TRefCnt
#include "TRefCnt.h"
#endif
enum ELayoutHints {
kLHintsNoHints = 0,
kLHintsLeft = BIT(0),
kLHintsCenterX = BIT(1),
kLHintsRight = BIT(2),
kLHintsTop = BIT(3),
kLHintsCenterY = BIT(4),
kLHintsBottom = BIT(5),
kLHintsExpandX = BIT(6),
kLHintsExpandY = BIT(7),
kLHintsNormal = (kLHintsLeft | kLHintsTop)
};
class TGFrame;
class TGCompositeFrame;
class TGLayoutHints;
class TList;
class TGFrameElement;
class TGLayoutHints : public TObject, public TRefCnt {
friend class TGFrameElement;
friend class TGCompositeFrame;
private:
TGFrameElement *fFE;
TGFrameElement *fPrev;
TGLayoutHints& operator=(const TGLayoutHints&);
protected:
ULong_t fLayoutHints;
Int_t fPadtop;
Int_t fPadbottom;
Int_t fPadleft;
Int_t fPadright;
void UpdateFrameElements(TGLayoutHints *l);
public:
TGLayoutHints(ULong_t hints = kLHintsNormal,
Int_t padleft = 0, Int_t padright = 0,
Int_t padtop = 0, Int_t padbottom = 0):
fFE(0), fPrev(0), fLayoutHints(hints), fPadtop(padtop), fPadbottom(padbottom),
fPadleft(padleft), fPadright(padright)
{ SetRefCount(0); }
TGLayoutHints(const TGLayoutHints &lh);
virtual ~TGLayoutHints();
ULong_t GetLayoutHints() const { return fLayoutHints; }
Int_t GetPadTop() const { return fPadtop; }
Int_t GetPadBottom() const { return fPadbottom; }
Int_t GetPadLeft() const { return fPadleft; }
Int_t GetPadRight() const { return fPadright; }
virtual void SetLayoutHints(ULong_t lh) { fLayoutHints = lh; }
virtual void SetPadTop(Int_t v) { fPadtop = v; }
virtual void SetPadBottom(Int_t v) { fPadbottom = v; }
virtual void SetPadLeft(Int_t v) { fPadleft = v; }
virtual void SetPadRight(Int_t v) { fPadright = v; }
void Print(Option_t* option = "") const;
void ls(Option_t* option = "") const { Print(option); }
virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
ClassDef(TGLayoutHints,0)
};
class TGFrameElement : public TObject {
private:
TGFrameElement(const TGFrameElement&);
TGFrameElement& operator=(const TGFrameElement&);
public:
TGFrame *fFrame;
Int_t fState;
TGLayoutHints *fLayout;
TGFrameElement() : fFrame(0), fState(0), fLayout(0) { }
TGFrameElement(TGFrame *f, TGLayoutHints *l);
~TGFrameElement();
void Print(Option_t* option = "") const;
void ls(Option_t* option = "") const { Print(option); }
ClassDef(TGFrameElement, 0);
};
class TGLayoutManager : public TObject {
protected:
Bool_t fModified;
public:
TGLayoutManager() : fModified(kTRUE) {}
virtual void Layout() = 0;
virtual TGDimension GetDefaultSize() const = 0;
virtual void SetDefaultWidth(UInt_t ) {}
virtual void SetDefaultHeight(UInt_t ) {}
virtual Bool_t IsModified() const { return fModified; }
virtual void SetModified(Bool_t flag = kTRUE) { fModified = flag; }
ClassDef(TGLayoutManager,0)
};
class TGVerticalLayout : public TGLayoutManager {
protected:
TGCompositeFrame *fMain;
TList *fList;
TGVerticalLayout(const TGVerticalLayout& gvl) :
TGLayoutManager(gvl), fMain(gvl.fMain), fList(gvl.fList) { }
TGVerticalLayout& operator=(const TGVerticalLayout& gvl)
{if(this!=&gvl) { TGLayoutManager::operator=(gvl);
fMain=gvl.fMain; fList=gvl.fList;} return *this;}
public:
TGVerticalLayout(TGCompositeFrame *main);
virtual void Layout();
virtual TGDimension GetDefaultSize() const;
virtual void SavePrimitive(std::ostream &out, Option_t * = "");
ClassDef(TGVerticalLayout,0)
};
class TGHorizontalLayout : public TGVerticalLayout {
public:
TGHorizontalLayout(TGCompositeFrame *main) : TGVerticalLayout(main) { }
virtual void Layout();
virtual TGDimension GetDefaultSize() const;
virtual void SavePrimitive(std::ostream &out, Option_t * = "");
ClassDef(TGHorizontalLayout,0)
};
class TGRowLayout : public TGVerticalLayout {
public:
Int_t fSep;
TGRowLayout(TGCompositeFrame *main, Int_t s = 0) :
TGVerticalLayout(main), fSep(s) { }
virtual void Layout();
virtual TGDimension GetDefaultSize() const;
virtual void SavePrimitive(std::ostream &out, Option_t * = "");
ClassDef(TGRowLayout,0)
};
class TGColumnLayout : public TGRowLayout {
public:
TGColumnLayout(TGCompositeFrame *main, Int_t s = 0) : TGRowLayout(main, s) { }
virtual void Layout();
virtual TGDimension GetDefaultSize() const;
virtual void SavePrimitive(std::ostream &out, Option_t * = "");
ClassDef(TGColumnLayout,0)
};
class TGMatrixLayout : public TGLayoutManager {
private:
TGMatrixLayout(const TGMatrixLayout&);
TGMatrixLayout& operator=(const TGMatrixLayout&);
protected:
TGCompositeFrame *fMain;
TList *fList;
public:
Int_t fSep;
Int_t fHints;
UInt_t fRows;
UInt_t fColumns;
TGMatrixLayout(TGCompositeFrame *main, UInt_t r, UInt_t c, Int_t s=0, Int_t h=0);
virtual void Layout();
virtual TGDimension GetDefaultSize() const;
virtual void SavePrimitive(std::ostream &out, Option_t * = "");
ClassDef(TGMatrixLayout,0)
};
class TGTileLayout : public TGLayoutManager {
private:
TGTileLayout(const TGTileLayout&);
TGTileLayout& operator=(const TGTileLayout&);
protected:
Int_t fSep;
TGCompositeFrame *fMain;
TList *fList;
Bool_t fModified;
public:
TGTileLayout(TGCompositeFrame *main, Int_t sep = 0);
virtual void Layout();
virtual TGDimension GetDefaultSize() const;
virtual Bool_t IsModified() const { return fModified; }
virtual void SavePrimitive(std::ostream &out, Option_t * = "");
ClassDef(TGTileLayout,0)
};
class TGListLayout : public TGTileLayout {
public:
TGListLayout(TGCompositeFrame *main, Int_t sep = 0) :
TGTileLayout(main, sep) { }
virtual void Layout();
virtual TGDimension GetDefaultSize() const;
virtual void SavePrimitive(std::ostream &out, Option_t * = "");
ClassDef(TGListLayout,0)
};
class TGListDetailsLayout : public TGTileLayout {
private:
UInt_t fWidth;
public:
TGListDetailsLayout(TGCompositeFrame *main, Int_t sep = 0, UInt_t w = 0) :
TGTileLayout(main, sep), fWidth(w) { }
virtual void Layout();
virtual TGDimension GetDefaultSize() const;
virtual void SetDefaultWidth(UInt_t w) { fWidth = w; }
virtual void SavePrimitive(std::ostream &out, Option_t * = "");
ClassDef(TGListDetailsLayout,0)
};
#endif