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 Experimental {
17namespace Browsable {
18
19/** \class RWrapper
20\ingroup rbrowser
21\brief Wrapper for other element - to provide different name
22\author Sergey Linev <S.Linev@gsi.de>
23\date 2019-11-22
24\warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
25*/
26
27class RWrapper : public RElement {
28 std::string fName;
29 std::shared_ptr<RElement> fElem;
30 bool fExapndByDefault{false};
31
32public:
33 RWrapper() = default;
34
35 RWrapper(const std::string &name, std::shared_ptr<RElement> elem) : fName(name), fElem(elem) {}
36
37 virtual ~RWrapper() = default;
38
39 /** Name of element, must be provided in derived classes */
40 std::string GetName() const override { return fName; }
41
42 /** Title of element (optional) */
43 std::string GetTitle() const override { return fElem->GetTitle(); }
44
45 /** Create iterator for childs elements if any */
46 std::unique_ptr<RLevelIter> GetChildsIter() override { return fElem->GetChildsIter(); }
47
48 /** Returns element content, depends from kind. Can be "text" or "image64" */
49 std::string GetContent(const std::string &kind = "text") override { return fElem->GetContent(kind); }
50
51 /** Access object */
52 std::unique_ptr<RHolder> GetObject() override { return fElem->GetObject(); }
53
54 /** Get default action */
55 EActionKind GetDefaultAction() const override { return fElem->GetDefaultAction(); }
56
57 /** Check if want to perform action */
58 bool IsCapable(EActionKind action) const override { return fElem->IsCapable(action); }
59
60 bool IsExpandByDefault() const override { return fExapndByDefault || fElem->IsExpandByDefault(); }
61 void SetExpandByDefault(bool on = true) { fExapndByDefault = on; }
62
63
64};
65
66
67} // namespace Browsable
68} // namespace Experimental
69} // namespace ROOT
70
71#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:110
Basic element of browsable hierarchy.
Definition RElement.hxx:35
EActionKind
Possible actions on double-click.
Definition RElement.hxx:51
Wrapper for other element - to provide different name.
Definition RWrapper.hxx:27
std::unique_ptr< RLevelIter > GetChildsIter() override
Create iterator for childs elements if any.
Definition RWrapper.hxx:46
EActionKind GetDefaultAction() const override
Get default action.
Definition RWrapper.hxx:55
std::string GetTitle() const override
Title of element (optional)
Definition RWrapper.hxx:43
bool IsExpandByDefault() const override
Should item representing element be expand by default.
Definition RWrapper.hxx:60
std::string GetName() const override
Name of element, must be provided in derived classes.
Definition RWrapper.hxx:40
std::string GetContent(const std::string &kind="text") override
Returns element content, depends from kind.
Definition RWrapper.hxx:49
std::shared_ptr< RElement > fElem
Definition RWrapper.hxx:29
bool IsCapable(EActionKind action) const override
Check if want to perform action.
Definition RWrapper.hxx:58
std::unique_ptr< RHolder > GetObject() override
Access object.
Definition RWrapper.hxx:52
RWrapper(const std::string &name, std::shared_ptr< RElement > elem)
Definition RWrapper.hxx:35
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.