ROOT logo
ROOT » GUI » GUI » TGXYLayoutHints

class TGXYLayoutHints: public TGLayoutHints


TGXYLayout

Is a layout manager where the position and the size of each widget
in the frame are defined by X / Y - coordinates. The coordinates
for each widget are defined by the TGXYLayoutHints. Therefore it
is not possible to share a layout hint for several widgets.

The coordinates (X, Y) and the size (W, H) are defined in units
of the size of a typical character. Also the size of the
TGCompositeFrame for which a TGXYLayout manager is used has to be
defined in its constructor in units of the size of a character!

It is not possible to use any other layout hint than the
TGXYLayoutHints for this layout manager!

The rubberFlag in the constructor of the TGLXYLayoutHins defines
how the position and the size of a widget is recalculated if the
size of the frame is increased:
- kLRubberX: The X - position (left edge) is increased by the same
factor as the width of the frame increases.
- kLRubberY: The Y - position (upper edge) is increased by the same
factor as the height of the frame increases.
- kLRubberW: The width of the widget is increased by the same
factor as the width of the frame increases.
- kLRubberH: The height of the widget is increased by the same
factor as the height of the frame increases.
But the size never becomes smaller than defined by the
TGXYLayoutHints and the X and Y coordinates becomes never smaller
than defined by the layout hints.

TGXYLayoutHints

This layout hint must be used for the TGXYLouyout manager!


Example how to use this layout manager:

TGMyFrame::TGMyFrame()
: TGMainFrame(gClient->GetRoot(), 30, 12)
 frame is 30 character long and 12 character heigh
{
SetLayoutManager(new TGXYLayout(this));

 create a button of size 8 X 1.8 at position 20 / 1
TGTextButton * button;
button = new TGTextButton(this, "&Apply", 1);
AddFrame(button, new TGXYLayoutHints(20, 1, 8, 1.8));

 create a listbox of size 18 X 10 at position 1 / 1.
 The height will increase if the frame height increases
TGListBox * listBox;
listBox = new TGListBox(this, 2);
AddFrame(listBox, new TGXYLayoutHints(1, 1, 18, 10,
TGXYLayoutHints::kLRubberX |
TGXYLayoutHints::kLRubberY |
TGXYLayoutHints::kLRubberH ));
.
.
.
}

Normaly there is one layout hint per widget. Therefore these
can be deleted like in the following example in the desctuctor
of the frame:

TGMyFrame::~TGMyFrame()
{
 Destructor, deletes all frames and their layout hints.

TGFrameElement *ptr;

 delete all frames and layout hints
if (fList) {
TIter next(fList);
while ((ptr = (TGFrameElement *) next())) {
if (ptr->fLayout)
delete ptr->fLayout;
if (ptr->fFrame)
delete ptr->fFrame;
}
}
}


Function Members (Methods)

public:
TGXYLayoutHints(const TGXYLayoutHints&)
TGXYLayoutHints(Double_t x, Double_t y, Double_t w, Double_t h, UInt_t rubberFlag = kLRubberX|kLRubberY)
~TGXYLayoutHints()
voidTObject::AbstractMethod(const char* method) const
voidTRefCnt::AddReference()
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidTObject::Browse(TBrowser* b)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTObject::Clear(Option_t* = "")
virtual TObject*TObject::Clone(const char* newname = "") const
virtual Int_tTObject::Compare(const TObject* obj) const
virtual voidTObject::Copy(TObject& object) const
virtual voidTObject::Delete(Option_t* option = "")MENU
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidTObject::Dump() constMENU
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
UInt_tGetFlag() const
Double_tGetH() const
virtual const char*TObject::GetIconName() const
ULong_tTGLayoutHints::GetLayoutHints() const
virtual const char*TObject::GetName() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
Int_tTGLayoutHints::GetPadBottom() const
Int_tTGLayoutHints::GetPadLeft() const
Int_tTGLayoutHints::GetPadRight() const
Int_tTGLayoutHints::GetPadTop() const
virtual const char*TObject::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
Double_tGetW() const
Double_tGetX() const
Double_tGetY() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTObject::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() constMENU
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTObject::IsSortable() const
Bool_tTObject::IsZombie() const
virtual voidTGLayoutHints::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
virtual Bool_tTObject::Notify()
voidTObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
TObject&TObject::operator=(const TObject& rhs)
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidTGLayoutHints::Print(Option_t* option = "") const
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
UInt_tTRefCnt::References() const
UInt_tTRefCnt::RemoveReference()
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidSavePrimitive(ostream& out, Option_t* = "")
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
voidSetFlag(UInt_t flag)
voidSetH(Double_t h)
virtual voidTGLayoutHints::SetLayoutHints(ULong_t lh)
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidTGLayoutHints::SetPadBottom(Int_t v)
virtual voidTGLayoutHints::SetPadLeft(Int_t v)
virtual voidTGLayoutHints::SetPadRight(Int_t v)
virtual voidTGLayoutHints::SetPadTop(Int_t v)
voidTRefCnt::SetRefCount(UInt_t r)
virtual voidTObject::SetUniqueID(UInt_t uid)
voidSetW(Double_t w)
voidSetX(Double_t x)
voidSetY(Double_t y)
virtual voidShowMembers(TMemberInspector& insp)
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
protected:
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidTObject::MakeZombie()
voidTGLayoutHints::UpdateFrameElements(TGLayoutHints* l)

Data Members

public:
enum ERubberFlag { kLRubberX
kLRubberY
kLRubberW
kLRubberH
};
enum TObject::EStatusBits { kCanDelete
kMustCleanup
kObjInCanvas
kIsReferenced
kHasUUID
kCannotPick
kNoContextMenu
kInvalidObject
};
enum TObject::[unnamed] { kIsOnHeap
kNotDeleted
kZombie
kBitMask
kSingleKey
kOverwrite
kWriteDelete
};
enum TRefCnt::EReferenceFlag { kStaticInit
};
protected:
UInt_tfFlagrubber flag
Double_tfHheight of widget
ULong_tTGLayoutHints::fLayoutHintslayout hints (combination of ELayoutHints)
Int_tTGLayoutHints::fPadbottomamount of bottom padding
Int_tTGLayoutHints::fPadleftamount of left padding
Int_tTGLayoutHints::fPadrightamount of right padding
Int_tTGLayoutHints::fPadtopamount of top padding
UInt_tTRefCnt::fRefs(1 less than) number of references
Double_tfWwidth of widget
Double_tfXx - position of widget
Double_tfYy - position of widget

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

TGXYLayoutHints(Double_t x, Double_t y, Double_t w, Double_t h, UInt_t rubberFlag = kLRubberX|kLRubberY)
 Constructor. The x, y, w and h define the position of the widget in
 its frame and the size of the widget. The unit is the size of a
 character. The rubberFlag defines how to move and to resize the
 widget when the frame is resized. Default is moving the X and Y
 position but keep the size of the widget.
void SavePrimitive(ostream& out, Option_t* = "")
 Save XY layout hints as a C++ statement(s) on output stream.
TGXYLayoutHints(Double_t x, Double_t y, Double_t w, Double_t h, UInt_t rubberFlag = kLRubberX|kLRubberY)
{ return fX; }
Double_t GetY() const
{ return fY; }
Double_t GetW() const
{ return fW; }
Double_t GetH() const
{ return fH; }
UInt_t GetFlag() const
{ return fFlag; }
void SetX(Double_t x)
{ fX = x; }
void SetY(Double_t y)
{ fY = y; }
void SetW(Double_t w)
{ fW = w; }
void SetH(Double_t h)
{ fH = h; }
void SetFlag(UInt_t flag)
{ fFlag = flag; }