Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:12:07

0001 // @(#)root/gui:$Id$
0002 // Author: Reiner Rohlfs   24/03/2002
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2002, Rene Brun, Fons Rademakers and Reiner Rohlfs *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 
0013 #ifndef ROOT_TGXYLayout
0014 #define ROOT_TGXYLayout
0015 
0016 #include "TGLayout.h"
0017 
0018 
0019 class TGXYLayoutHints : public TGLayoutHints {
0020 
0021 protected:
0022    Double_t   fX;    ///< x - position of widget
0023    Double_t   fY;    ///< y - position of widget
0024    Double_t   fW;    ///< width of widget
0025    Double_t   fH;    ///< height of widget
0026    UInt_t     fFlag; ///< rubber flag
0027 
0028 public:
0029 
0030    enum ERubberFlag {
0031       kLRubberX   = BIT(0),
0032       kLRubberY   = BIT(1),
0033       kLRubberW   = BIT(2),
0034       kLRubberH   = BIT(3)
0035    };
0036 
0037    TGXYLayoutHints(Double_t x, Double_t y, Double_t w, Double_t h,
0038                    UInt_t rubberFlag = kLRubberX | kLRubberY);
0039 
0040    Double_t  GetX() const { return fX; };
0041    Double_t  GetY() const { return fY; };
0042    Double_t  GetW() const { return fW; };
0043    Double_t  GetH() const { return fH; };
0044    UInt_t    GetFlag() const { return fFlag; };
0045 
0046    void      SetX(Double_t x) { fX = x; }
0047    void      SetY(Double_t y) { fY = y; }
0048    void      SetW(Double_t w) { fW = w; }
0049    void      SetH(Double_t h) { fH = h; }
0050    void      SetFlag(UInt_t flag) { fFlag = flag; }
0051 
0052    void SavePrimitive(std::ostream &out, Option_t * = "") override;
0053 
0054    ClassDefOverride(TGXYLayoutHints,0)  // Hits for the X / Y - layout manager
0055 };
0056 
0057 
0058 class TGXYLayout : public TGLayoutManager {
0059 
0060 protected:
0061    TList            *fList;           ///< list of frames to arrange
0062    TGCompositeFrame *fMain;           ///< container frame
0063 
0064    Bool_t            fFirst;          ///< flag to determine the first call of Layout()
0065    UInt_t            fFirstWidth;     ///< original width of the frame fMain
0066    UInt_t            fFirstHeight;    ///< original height of the frame fMain
0067 
0068    Int_t             fTWidth;         ///< text width of a default character "1234567890" / 10
0069    Int_t             fTHeight;        ///< text height
0070 
0071    TGXYLayout(const TGXYLayout&);
0072    TGXYLayout& operator=(const TGXYLayout&);
0073 
0074 public:
0075    TGXYLayout(TGCompositeFrame *main);
0076 
0077    void Layout() override;
0078    TGDimension GetDefaultSize() const override;
0079    void SavePrimitive(std::ostream &out, Option_t * = "") override;
0080 
0081    void NewSize() { fFirst = kTRUE; }
0082 
0083    ClassDefOverride(TGXYLayout,0)  // X / Y - layout manager
0084 };
0085 
0086 #endif