Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TGTableLayout.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/gui:$Id$
0002 // Author: Brett Viren   04/15/2001
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2021, Rene Brun and Fons Rademakers.               *
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 #ifndef ROOT_TGTableLayout
0013 #define ROOT_TGTableLayout
0014 
0015 #include "TGLayout.h"
0016 
0017 // extension of ELayoutHints
0018 enum ETableLayoutHints {
0019    kLHintsShrinkX = BIT(8),
0020    kLHintsShrinkY = BIT(9),
0021    kLHintsFillX   = BIT(10),
0022    kLHintsFillY   = BIT(11)
0023 };
0024 
0025 
0026 class TGTableLayoutHints : public TGLayoutHints {
0027 
0028 private:
0029    TGTableLayoutHints(const TGTableLayoutHints&) = delete;
0030    TGTableLayoutHints& operator=(const TGTableLayoutHints&) = delete;
0031 
0032 protected:
0033    UInt_t fAttachLeft;         ///< Column/row division number on which
0034    UInt_t fAttachRight;        ///< to attach the frame.  Starts at 0
0035    UInt_t fAttachTop;          ///< and goes to # columns / # rows
0036    UInt_t fAttachBottom;       ///< respectively
0037 
0038 public:
0039    TGTableLayoutHints(UInt_t attach_left, UInt_t attach_right,
0040                       UInt_t attach_top, UInt_t attach_bottom,
0041                       ULong_t hints = kLHintsNormal,
0042                       UInt_t padleft = 0, UInt_t padright = 0,
0043                       UInt_t padtop = 0, UInt_t padbottom = 0)
0044       : TGLayoutHints(hints,padleft,padright,padtop,padbottom),
0045          fAttachLeft(attach_left),
0046          fAttachRight(attach_right),
0047          fAttachTop(attach_top),
0048          fAttachBottom(attach_bottom) { }
0049    ~TGTableLayoutHints() override { }
0050 
0051    UInt_t GetAttachLeft() const { return fAttachLeft; }
0052    UInt_t GetAttachRight() const { return fAttachRight; }
0053    UInt_t GetAttachTop() const { return fAttachTop; }
0054    UInt_t GetAttachBottom() const { return fAttachBottom; }
0055    void SavePrimitive(std::ostream &out, Option_t * = "") override;
0056 
0057    ClassDefOverride(TGTableLayoutHints,0)  // Class describing GUI table layout hints
0058 };
0059 
0060 
0061 class TGTableLayout : public TGLayoutManager {
0062 
0063 private:
0064    TGTableLayout(const TGTableLayout&) = delete;
0065    TGTableLayout& operator=(const TGTableLayout&) = delete;
0066 
0067 protected:
0068    struct TableData_t {
0069       UInt_t fDefSize;        ///< Default size of col/rows
0070       UInt_t fRealSize;       ///< Real size of col/rows (eg, if table resize)
0071       Bool_t fNeedExpand;
0072       Bool_t fNeedShrink;
0073       Bool_t fExpand;
0074       Bool_t fShrink;
0075       Bool_t fEmpty;
0076    };
0077    TableData_t        *fRow;          ///< info about each row
0078    TableData_t        *fCol;          ///< info about each column
0079    TGCompositeFrame   *fMain;         ///< container frame
0080    TList              *fList;         ///< list of frames to arrange
0081    Bool_t              fHomogeneous;  ///< all cols/rows same size
0082 
0083    void FindRowColSizes();
0084    void FindRowColSizesInit();
0085    void FindRowColSizesHomogeneous();
0086    void FindRowColSizesSinglyAttached();
0087    void FindRowColSizesMultiplyAttached();
0088 
0089    void SetRowColSizes();
0090    void SetRowColSizesInit();
0091 
0092    void CheckSanity();
0093 
0094    static void SetRowColResize(UInt_t real_size, UInt_t nthings,
0095                                TableData_t *thing, Bool_t homogeneous);
0096 
0097 public:
0098    // these are public in TGMatrixLayout ???  Perpetuate it.
0099    Int_t   fSep;               ///< interval between frames
0100    Int_t   fHints;             ///< layout hints (currently not used)
0101    UInt_t  fNrows;             ///< number of rows
0102    UInt_t  fNcols;             ///< number of columns
0103 
0104    TGTableLayout(TGCompositeFrame *main, UInt_t nrows, UInt_t ncols,
0105                  Bool_t homogeneous = kFALSE, Int_t sep = 0, Int_t hints = 0);
0106    ~TGTableLayout() override;
0107 
0108    void Layout() override;
0109    TGDimension GetDefaultSize() const override; // return sum of all child sizes
0110    void SavePrimitive(std::ostream &out, Option_t * = "") override;
0111 
0112    ClassDefOverride(TGTableLayout,0)  // Table layout manager
0113 };
0114 
0115 #endif