Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:22:38

0001 /*************************************************************************
0002  * Copyright (C) 1995-2019, Rene Brun and Fons Rademakers.               *
0003  * All rights reserved.                                                  *
0004  *                                                                       *
0005  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0006  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0007  *************************************************************************/
0008 
0009 #ifndef ROOT7_RPad
0010 #define ROOT7_RPad
0011 
0012 #include "ROOT/RPadBase.hxx"
0013 
0014 namespace ROOT {
0015 namespace Experimental {
0016 
0017 /** \class RPad
0018 \ingroup GpadROOT7
0019 \brief Graphic container for `RDrawable`-s.
0020 \authors Axel Naumann <axel@cern.ch> Sergey Linev <s.linev@gsi.de>
0021 \date 2017-07-06
0022 \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
0023 */
0024 
0025 class RPad: public RPadBase {
0026 
0027    friend class RPadBase; ///< required to set parent
0028 
0029    /// Pad containing this pad as a sub-pad.
0030    RPadBase *fParent{nullptr};             ///< The parent pad, if this pad has one.
0031 
0032    RPadPos fPos;                           ///< pad position
0033    RPadExtent fSize;                       ///< pad size
0034 
0035    /// Create default pad
0036    RPad() : RPadBase("pad") {}
0037 
0038    /// Create a pad.
0039    RPad(const RPadPos &pos, const RPadExtent &size) : RPad()
0040    {
0041       fPos = pos;
0042       fSize = size;
0043    }
0044 
0045    // Assign parent
0046    void SetParent(RPadBase *parent) { fParent = parent; }
0047 
0048 protected:
0049 
0050    std::unique_ptr<RDisplayItem> Display(const RDisplayContext &) final;
0051 
0052 
0053 public:
0054 
0055    RAttrBorder border{this, "border"};    ///<! border attributes
0056 
0057    /// Constructor must be used only for I/O
0058    RPad(TRootIOCtor*) : RPad() {}
0059 
0060    /// Destructor to have a vtable.
0061    ~RPad() override;
0062 
0063    /// Access to the parent pad (const version).
0064    const RPadBase *GetParent() const { return fParent; }
0065 
0066    /// Access to the parent pad (non-const version).
0067    RPadBase *GetParent() { return fParent; }
0068 
0069    /// Access to the top-most canvas (const version).
0070    const RCanvas *GetCanvas() const override { return fParent ? fParent->GetCanvas() : nullptr; }
0071 
0072    /// Access to the top-most canvas (non-const version).
0073    RCanvas *GetCanvas() override { return fParent ? fParent->GetCanvas() : nullptr; }
0074 
0075    /// Get the position of the pad in parent (!) coordinates.
0076    const RPadPos &GetPos() const { return fPos; }
0077 
0078    /// Get the size of the pad in parent (!) coordinates.
0079    const RPadExtent &GetSize() const { return fSize; }
0080 
0081    /// Set the size of the pad in parent (!) coordinates.
0082    void SetSize(const RPadExtent &sz) { fSize = sz; }
0083 
0084    /// Set position
0085    void SetPos(const RPadPos &p) { fPos = p; }
0086 };
0087 
0088 } // namespace Experimental
0089 } // namespace ROOT
0090 
0091 #endif