#ifndef ROOT_TGTableLayout
#define ROOT_TGTableLayout
#ifndef ROOT_TGLayout
#include "TGLayout.h"
#endif
enum ETableLayoutHints {
kLHintsShrinkX = BIT(8),
kLHintsShrinkY = BIT(9),
kLHintsFillX = BIT(10),
kLHintsFillY = BIT(11)
};
class TGTableLayoutHints : public TGLayoutHints {
private:
TGTableLayoutHints(const TGTableLayoutHints&);
TGTableLayoutHints& operator=(const TGTableLayoutHints&);
protected:
UInt_t fAttachLeft;
UInt_t fAttachRight;
UInt_t fAttachTop;
UInt_t fAttachBottom;
public:
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)
: TGLayoutHints(hints,padleft,padright,padtop,padbottom),
fAttachLeft(attach_left),
fAttachRight(attach_right),
fAttachTop(attach_top),
fAttachBottom(attach_bottom) { }
virtual ~TGTableLayoutHints() { }
UInt_t GetAttachLeft() const { return fAttachLeft; }
UInt_t GetAttachRight() const { return fAttachRight; }
UInt_t GetAttachTop() const { return fAttachTop; }
UInt_t GetAttachBottom() const { return fAttachBottom; }
virtual void SavePrimitive(ostream &out, Option_t * = "");
ClassDef(TGTableLayoutHints,0)
};
class TGTableLayout : public TGLayoutManager {
private:
TGTableLayout(const TGTableLayout&);
TGTableLayout& operator=(const TGTableLayout&);
protected:
struct TableData_t {
UInt_t fDefSize;
UInt_t fRealSize;
Bool_t fNeedExpand;
Bool_t fNeedShrink;
Bool_t fExpand;
Bool_t fShrink;
Bool_t fEmpty;
};
TableData_t *fRow;
TableData_t *fCol;
TGCompositeFrame *fMain;
TList *fList;
Bool_t fHomogeneous;
void FindRowColSizes();
void FindRowColSizesInit();
void FindRowColSizesHomogeneous();
void FindRowColSizesSinglyAttached();
void FindRowColSizesMultiplyAttached();
void SetRowColSizes();
void SetRowColSizesInit();
void CheckSanity();
static void SetRowColResize(UInt_t real_size, UInt_t nthings,
TableData_t *thing, Bool_t homogeneous);
public:
Int_t fSep;
Int_t fHints;
UInt_t fNrows;
UInt_t fNcols;
TGTableLayout(TGCompositeFrame *main, UInt_t nrows, UInt_t ncols,
Bool_t homogeneous = kFALSE, Int_t sep = 0, Int_t hints = 0);
virtual ~TGTableLayout();
virtual void Layout();
virtual TGDimension GetDefaultSize() const;
virtual void SavePrimitive(ostream &out, Option_t * = "");
ClassDef(TGTableLayout,0)
};
#endif