ROOT » GUI » GUI » TGXYLayout

class TGXYLayout: public TGLayoutManager


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:
virtual~TGXYLayout()
voidTObject::AbstractMethod(const char* method) const
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 TGDimensionGetDefaultSize() const
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual const char*TObject::GetIconName() 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
virtual const char*TObject::GetTitle() const
virtual UInt_tTObject::GetUniqueID() 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
virtual Bool_tTGLayoutManager::IsModified() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTObject::IsSortable() const
Bool_tTObject::IsZombie() const
virtual voidLayout()
virtual voidTObject::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
voidNewSize()
virtual Bool_tTObject::Notify()
voidTObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const
voidTObject::operator delete(void* ptr)
voidTObject::operator delete(void* ptr, void* vp)
voidTObject::operator delete[](void* ptr)
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)
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidTObject::Print(Option_t* option = "") const
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
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 voidTGLayoutManager::SetDefaultHeight(UInt_t)
virtual voidTGLayoutManager::SetDefaultWidth(UInt_t)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
virtual voidTGLayoutManager::SetModified(Bool_t flag = kTRUE)
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidShowMembers(TMemberInspector& insp) const
virtual voidStreamer(TBuffer&)
voidStreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_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
TGXYLayout(TGCompositeFrame* main)
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()
TGXYLayout&operator=(const TGXYLayout&)
TGXYLayout(const TGXYLayout&)

Data Members

public:
static TObject::(anonymous)TObject::kBitMask
static TObject::EStatusBitsTObject::kCanDelete
static TObject::EStatusBitsTObject::kCannotPick
static TObject::EStatusBitsTObject::kHasUUID
static TObject::EStatusBitsTObject::kInvalidObject
static TObject::(anonymous)TObject::kIsOnHeap
static TObject::EStatusBitsTObject::kIsReferenced
static TObject::EStatusBitsTObject::kMustCleanup
static TObject::EStatusBitsTObject::kNoContextMenu
static TObject::(anonymous)TObject::kNotDeleted
static TObject::EStatusBitsTObject::kObjInCanvas
static TObject::(anonymous)TObject::kOverwrite
static TObject::(anonymous)TObject::kSingleKey
static TObject::(anonymous)TObject::kWriteDelete
static TObject::(anonymous)TObject::kZombie
protected:
Bool_tfFirstflag to determine the first call of Layout()
UInt_tfFirstHeightoriginal height of the fram fMain
UInt_tfFirstWidthoriginal width of the frame fMain
TList*fListlist of frames to arrange
TGCompositeFrame*fMaincontainer frame
Bool_tTGLayoutManager::fModifiedkTRUE if positions of subframes changed after layout
Int_tfTHeighttext height
Int_tfTWidthtext width of a default character "1234567890" / 10

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

TGXYLayout(TGCompositeFrame* main)
 Constructor. The main is the frame for which this layout manager works.
TGXYLayout(const TGXYLayout& )
copy constructor
TGXYLayout& operator=(const TGXYLayout& )
assignment operator
void Layout()
 Recalculates the postion and the size of all widgets.
TGDimension GetDefaultSize() const
 Returns the original size of the frame.
void SavePrimitive(ostream& out, Option_t* = "")
 Save XY layout manager as a C++ statement(s) on output stream.
void NewSize()
{ fFirst = kTRUE; }