library: libGui
#include "TGXYLayout.h"

TGXYLayoutHints


class description - source file - inheritance tree (.pdf)

class TGXYLayoutHints : public TGLayoutHints

Inheritance Chart:
TObject
TRefCnt
<-
TGLayoutHints
<-
TGXYLayoutHints

    public:
TGXYLayoutHints(Double_t x, Double_t y, Double_t w, Double_t h, UInt_t rubberFlag = kLRubberX|kLRubberY) TGXYLayoutHints(const TGXYLayoutHints&) ~TGXYLayoutHints() static TClass* Class() UInt_t GetFlag() const Double_t GetH() const Double_t GetW() const Double_t GetX() const Double_t GetY() const virtual TClass* IsA() const TGXYLayoutHints& operator=(const TGXYLayoutHints&) void SetFlag(UInt_t flag) void SetH(Double_t h) void SetW(Double_t w) void SetX(Double_t x) void SetY(Double_t y) virtual void ShowMembers(TMemberInspector& insp, char* parent) virtual void Streamer(TBuffer& b) void StreamerNVirtual(TBuffer& b)

Data Members


    protected:
Double_t fX x - position of widget Double_t fY y - position of widget Double_t fW width of widget Double_t fH height of widget UInt_t fFlag rubber flag public:
static const TGXYLayoutHints::ERubberFlag kLRubberX static const TGXYLayoutHints::ERubberFlag kLRubberY static const TGXYLayoutHints::ERubberFlag kLRubberW static const TGXYLayoutHints::ERubberFlag kLRubberH

Class Description

                                                                      
 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.             
 - kLRubberY: 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;                                      
       }                                                              
    }                                                                 
 }                                                                    
                                                                      


TGXYLayoutHints(Double_t x, Double_t y, Double_t w, Double_t h, UInt_t rubberFlag) : TGLayoutHints(kLHintsNormal, 0,0,0,0)
 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.



Inline Functions


                    void ~TGXYLayoutHints()
                Double_t GetX() const
                Double_t GetY() const
                Double_t GetW() const
                Double_t GetH() const
                  UInt_t GetFlag() const
                    void SetX(Double_t x)
                    void SetY(Double_t y)
                    void SetW(Double_t w)
                    void SetH(Double_t h)
                    void SetFlag(UInt_t flag)
                 TClass* Class()
                 TClass* IsA() const
                    void ShowMembers(TMemberInspector& insp, char* parent)
                    void Streamer(TBuffer& b)
                    void StreamerNVirtual(TBuffer& b)
         TGXYLayoutHints TGXYLayoutHints(const TGXYLayoutHints&)
        TGXYLayoutHints& operator=(const TGXYLayoutHints&)


Author: Reiner Rohlfs 24/03/2002
Last update: root/gui:$Name: $:$Id: TGXYLayout.cxx,v 1.1 2002/08/08 16:54:11 rdm Exp $
Copyright (C) 1995-2001, Rene Brun, Fons Rademakers and Reiner Rohlfs *


ROOT page - Class index - Class Hierarchy - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.