Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RWrapper.hxx
Go to the documentation of this file.
1/*************************************************************************
2 * Copyright (C) 1995-2020, Rene Brun and Fons Rademakers. *
3 * All rights reserved. *
4 * *
5 * For the licensing terms see $ROOTSYS/LICENSE. *
6 * For the list of contributors see $ROOTSYS/README/CREDITS. *
7 *************************************************************************/
8
9#ifndef ROOT7_Browsable_RWrapper
10#define ROOT7_Browsable_RWrapper
11
14
15namespace ROOT {
16namespace Browsable {
17
18/** \class RWrapper
19\ingroup rbrowser
20\brief Wrapper for other element - to provide different name
21\author Sergey Linev <S.Linev@gsi.de>
22\date 2019-11-22
23*/
24
25class RWrapper : public RElement {
26 std::string fName;
27 std::shared_ptr<RElement> fElem;
28 bool fExapndByDefault{false};
29
30public:
31 RWrapper() = default;
32
33 RWrapper(const std::string &name, std::shared_ptr<RElement> elem) : fName(name), fElem(elem) {}
34
35 virtual ~RWrapper() = default;
36
37 /** Name of element, must be provided in derived classes */
38 std::string GetName() const override { return fName; }
39
40 /** Title of element (optional) */
41 std::string GetTitle() const override { return fElem->GetTitle(); }
42
43 /** Create iterator for childs elements if any */
44 std::unique_ptr<RLevelIter> GetChildsIter() override { return fElem->GetChildsIter(); }
45
46 /** Returns element content, depends from kind. Can be "text" or "image64" */
47 std::string GetContent(const std::string &kind = "text") override { return fElem->GetContent(kind); }
48
49 /** Access object */
50 std::unique_ptr<RHolder> GetObject() override { return fElem->GetObject(); }
51
52 /** Get default action */
53 EActionKind GetDefaultAction() const override { return fElem->GetDefaultAction(); }
54
55 /** Check if want to perform action */
56 bool IsCapable(EActionKind action) const override { return fElem->IsCapable(action); }
57
58 bool IsExpandByDefault() const override { return fExapndByDefault || fElem->IsExpandByDefault(); }
59 void SetExpandByDefault(bool on = true) { fExapndByDefault = on; }
60};
61
62
63} // namespace Browsable
64} // namespace ROOT
65
66#endif
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
char name[80]
Definition TGX11.cxx:148
Basic element of browsable hierarchy.
Definition RElement.hxx:33
EActionKind
Possible actions on double-click.
Definition RElement.hxx:49
Wrapper for other element - to provide different name.
Definition RWrapper.hxx:25
RWrapper(const std::string &name, std::shared_ptr< RElement > elem)
Definition RWrapper.hxx:33
bool IsCapable(EActionKind action) const override
Check if want to perform action.
Definition RWrapper.hxx:56
std::unique_ptr< RHolder > GetObject() override
Access object.
Definition RWrapper.hxx:50
std::shared_ptr< RElement > fElem
Definition RWrapper.hxx:27
std::string GetTitle() const override
Title of element (optional)
Definition RWrapper.hxx:41
bool IsExpandByDefault() const override
Should item representing element be expand by default.
Definition RWrapper.hxx:58
std::string GetName() const override
Name of element, must be provided in derived classes.
Definition RWrapper.hxx:38
void SetExpandByDefault(bool on=true)
Definition RWrapper.hxx:59
std::unique_ptr< RLevelIter > GetChildsIter() override
Create iterator for childs elements if any.
Definition RWrapper.hxx:44
EActionKind GetDefaultAction() const override
Get default action.
Definition RWrapper.hxx:53
virtual ~RWrapper()=default
std::string GetContent(const std::string &kind="text") override
Returns element content, depends from kind.
Definition RWrapper.hxx:47