Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:10:31

0001 /*************************************************************************
0002  * Copyright (C) 1995-2020, 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_Browsable_RWrapper
0010 #define ROOT7_Browsable_RWrapper
0011 
0012 #include <ROOT/Browsable/RElement.hxx>
0013 #include <ROOT/Browsable/RLevelIter.hxx>
0014 
0015 namespace ROOT {
0016 namespace Browsable {
0017 
0018 /** \class RWrapper
0019 \ingroup rbrowser
0020 \brief Wrapper for other element - to provide different name
0021 \author Sergey Linev <S.Linev@gsi.de>
0022 \date 2019-11-22
0023 \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
0024 */
0025 
0026 class RWrapper : public RElement {
0027    std::string fName;
0028    std::shared_ptr<RElement> fElem;
0029    bool fExapndByDefault{false};
0030 
0031 public:
0032    RWrapper() = default;
0033 
0034    RWrapper(const std::string &name, std::shared_ptr<RElement> elem) : fName(name), fElem(elem) {}
0035 
0036    virtual ~RWrapper() = default;
0037 
0038    /** Name of element, must be provided in derived classes */
0039    std::string GetName() const override { return fName; }
0040 
0041    /** Title of element (optional) */
0042    std::string GetTitle() const override { return fElem->GetTitle(); }
0043 
0044    /** Create iterator for childs elements if any */
0045    std::unique_ptr<RLevelIter> GetChildsIter() override { return fElem->GetChildsIter(); }
0046 
0047    /** Returns element content, depends from kind. Can be "text" or "image64" */
0048    std::string GetContent(const std::string &kind = "text") override { return fElem->GetContent(kind); }
0049 
0050    /** Access object */
0051    std::unique_ptr<RHolder> GetObject() override { return fElem->GetObject(); }
0052 
0053    /** Get default action */
0054    EActionKind GetDefaultAction() const override { return fElem->GetDefaultAction(); }
0055 
0056    /** Check if want to perform action */
0057    bool IsCapable(EActionKind action) const override { return fElem->IsCapable(action); }
0058 
0059    bool IsExpandByDefault() const override { return fExapndByDefault || fElem->IsExpandByDefault(); }
0060    void SetExpandByDefault(bool on = true) { fExapndByDefault = on; }
0061 };
0062 
0063 
0064 } // namespace Browsable
0065 } // namespace ROOT
0066 
0067 #endif