28using namespace std::string_literals;
66 std::shared_ptr<TObjectElement> telem = std::dynamic_pointer_cast<TObjectElement>(
fElements[
fCounter]);
67 return telem ? telem->IsFolder() :
false;
82 bool Find(
const std::string &
name,
int indx = -1)
override
119 std::unique_ptr<RHolder> holder = std::make_unique<TObjectHolder>(obj);
124 std::shared_ptr<TObjectElement> telem = std::dynamic_pointer_cast<TObjectElement>(elem);
125 if (telem) telem->SetName(
name);
135 Add(obj,
nullptr, 0);
164 if (!obj)
return ""s;
165 std::string
name = obj->GetName();
168 std::unique_ptr<RHolder> holder = std::make_unique<TObjectHolder>(obj,
kFALSE);
170 if (elem)
name = elem->CreateItem()->GetName();
179 if (!obj || !obj->IsFolder())
190 std::unique_ptr<RHolder> holder = std::make_unique<TObjectHolder>(obj,
kFALSE);
195 elem = std::make_shared<TObjectElement>(holder);
197 return elem->CreateItem();
203 std::unique_ptr<RHolder> holder = std::make_unique<TObjectHolder>(*
fIter,
kFALSE);
230 return std::make_unique<TCollectionIter>(folder->GetListOfFolders());
259 if (coll && (coll->GetSize() > 0))
260 return std::make_unique<TCollectionIter>(coll);
268 return coll ? coll->
GetSize() : 0;
297 else if (
fName.empty())
308 fObject = std::make_unique<TObjectHolder>(obj);
318 elem->
fObj =
nullptr;
320 elem->fObject->Forget();
321 elem->fObject.reset();
377 auto iter = std::make_unique<TObjectLevelIter>();
395 if (dupl || (iter->NumElements() == 0))
return nullptr;
444 std::string clname = cl->GetName();
446 if ((
"TTree"s == clname) || (
"TNtuple"s == clname))
return kActTree;
447 if ((
"TGeoManager"s == clname) || (clname.compare(0, 10,
"TGeoVolume"s) == 0) || (clname.compare(0, 8,
"TGeoNode"s) == 0))
return kActGeom;
465 auto item = std::make_unique<TObjectItem>(obj->GetName(), isfolder ? -1 : 0);
467 if (item->GetName().empty())
470 item->SetTitle(obj->GetTitle());
471 if (item->GetTitle().empty())
474 item->SetClassName(obj->ClassName());
494 if (!cl)
return false;
496 std::string clname = cl->GetName();
505 case kActTree:
return (
"TTree"s == clname) || (
"TNtuple"s == clname) ||
506 (clname.compare(0, 7,
"TBranch"s) == 0) || (clname.compare(0, 5,
"TLeaf"s) == 0);
507 case kActGeom:
return (
"TGeoManager"s == clname) || (clname.compare(0, 10,
"TGeoVolume"s) == 0) || (clname.compare(0, 8,
"TGeoNode"s) == 0);
508 default:
return false;
519 return std::make_unique<TCollectionIter>(coll);
531 auto col = fObject->Get<
TColor>();
533 fName =
"Color"s + std::to_string(col->GetNumber());
555 void RegisterTObject(
const std::string &clname,
const std::string &iconname,
bool can_browse =
false,
int can_draw = 3,
const std::string &drawopt =
""s)
557 RegisterClass(clname,
559 can_browse ?
"dflt"s :
""s,
560 can_draw & 1 ?
"libROOTObjectDraw6Provider"s :
""s,
561 can_draw & 2 ?
"libROOTObjectDraw7Provider"s :
""s,
567 RegisterClass(
"TTree",
"sap-icon://tree",
"libROOTBranchBrowseProvider");
568 RegisterClass(
"TNtuple",
"sap-icon://tree",
"libROOTBranchBrowseProvider");
569 RegisterClass(
"TBranchElement",
"sap-icon://e-care",
"libROOTBranchBrowseProvider",
"libROOTLeafDraw6Provider",
"libROOTLeafDraw7Provider");
570 RegisterClass(
"TLeaf",
"sap-icon://e-care",
""s,
"libROOTLeafDraw6Provider",
"libROOTLeafDraw7Provider");
571 RegisterClass(
"TBranch",
"sap-icon://e-care",
"libROOTBranchBrowseProvider"s,
"libROOTLeafDraw6Provider",
"libROOTLeafDraw7Provider");
572 RegisterClass(
"TVirtualBranchBrowsable",
"sap-icon://e-care",
""s,
"libROOTLeafDraw6Provider",
"libROOTLeafDraw7Provider");
573 RegisterClass(
"TColor",
"sap-icon://palette");
574 RegisterClass(
"TStyle",
"sap-icon://badge");
576 RegisterTObject(
"TDirectory",
"sap-icon://folder-blank",
true, 0);
577 RegisterTObject(
"TClass",
"sap-icon://tag-cloud-chart",
false, 0);
578 RegisterTObject(
"TQClass",
"sap-icon://tag-cloud-chart",
false, 0);
579 RegisterTObject(
"TH1",
"sap-icon://bar-chart",
false, 3,
""s);
580 RegisterTObject(
"TH2",
"sap-icon://pixelate",
false, 3,
"col"s);
581 RegisterTObject(
"TH3",
"sap-icon://product");
582 RegisterTObject(
"TProfile",
"sap-icon://vertical-bar-chart",
false, 3,
""s);
583 RegisterTObject(
"TGraph",
"sap-icon://line-chart");
584 RegisterTObject(
"TCanvas",
"sap-icon://business-objects-experience",
false, 1);
585 RegisterTObject(
"TASImage",
"sap-icon://picture",
false, 1);
587 RegisterTObject(
"THStack",
"sap-icon://multiple-bar-chart");
588 RegisterTObject(
"TMultiGraph",
"sap-icon://multiple-line-chart");
590 RegisterTObject(
"TCollection",
"sap-icon://list",
true, 0);
592 RegisterClass(
"TGeoManager",
"sap-icon://overview-chart",
"libROOTGeoBrowseProvider");
593 RegisterClass(
"TGeoVolume",
"sap-icon://product",
"libROOTGeoBrowseProvider");
594 RegisterClass(
"TGeoNode",
"sap-icon://product",
"libROOTGeoBrowseProvider");
596 RegisterBrowse(
TFolder::Class(), [](std::unique_ptr<RHolder> &
object) -> std::shared_ptr<RElement> {
597 return std::make_shared<TFolderElement>(
object);
600 RegisterBrowse(
TCollection::Class(), [](std::unique_ptr<RHolder> &
object) -> std::shared_ptr<RElement> {
601 return std::make_shared<TCollectionElement>(
object);
604 RegisterBrowse(
TColor::Class(), [](std::unique_ptr<RHolder> &
object) -> std::shared_ptr<RElement> {
605 return std::make_shared<TColorElement>(
object);
608 RegisterBrowse(
nullptr, [](std::unique_ptr<RHolder> &
object) -> std::shared_ptr<RElement> {
610 return std::make_shared<TObjectElement>(
object,
"", NotShowChilds(
object->GetClass()));
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
RTObjectProvider newRTObjectProvider
EActionKind
Possible actions on double-click.
@ kActImage
can be shown in image viewer, can provide image
@ kActDraw6
can be drawn inside ROOT6 canvas
@ kActCanvas
indicate that it is canvas and should be drawn directly
@ kActTree
can be shown in tree viewer
@ kActGeom
can be shown in geometry viewer
@ kActBrowse
just browse (expand) item
@ kActEdit
can provide data for text editor
@ kActDraw7
can be drawn inside ROOT7 canvas
virtual std::unique_ptr< RItem > CreateItem() const
Returns item with element description.
Iterator over single level hierarchy like any array, keys list, ...
virtual std::unique_ptr< RItem > CreateItem()
Create generic description item for RBrowser.
virtual bool Find(const std::string &name, int indx=-1)
Find item with specified name Default implementation, should work for all If index specified,...
Provider of different browsing methods for supported classes.
static bool CanDraw6(const ClassArg &)
Return true if provided class can be drawn on the TCanvas.
static std::shared_ptr< RElement > Browse(std::unique_ptr< RHolder > &obj)
Create browsable element for the object Created element may take ownership over the object.
static bool CanDraw7(const ClassArg &)
Return true if provided class can be drawn on the RCanvas.
static std::string GetClassIcon(const ClassArg &, bool=false)
Return icon name for the given class - either class name or TClass *.
static bool CanHaveChilds(const ClassArg &)
Return true if provided class can have childs.
static bool NotShowChilds(const ClassArg &)
Check if showing of sub-elements was disabled.
Access to TObject basic properties for RBrowsable.
std::unique_ptr< RHolder > GetObject() override
Return copy of TObject holder - if possible.
virtual std::string GetMTime() const
const TClass * GetClass() const
Returns class for contained object.
bool CheckValid() override
Returns true if object is still valid.
bool IsCapable(EActionKind) const override
Check object capability.
static std::unique_ptr< RLevelIter > GetCollectionIter(const TCollection *)
Creates iterator for TCollection object.
TObjectElement(TObject *obj, const std::string &name="", bool _hide_childs=false)
Constructor with plain TObject* as argument - ownership is not defined.
void SetHideChilds(bool on)
Set flag to hide all potential object childs.
void SetObject(TObject *obj)
Constructor with std::unique_ptr<RHolder> as argument.
std::unique_ptr< RHolder > fObject
std::string GetTitle() const override
Title of TObject.
virtual const TObject * CheckObject() const
Check if object still exists.
std::unique_ptr< RLevelIter > GetChildsIter() override
Create iterator for childs elements if any.
bool IsObject(void *) override
Returns true if holding specified object.
EActionKind GetDefaultAction() const override
Provides default action which can be performed with the object.
std::string GetName() const override
Name of TObject.
bool IsFolder() const override
Returns true if object can have child elements.
bool IsHideChilds() const
Is flag to hide all potential object childs set.
virtual Long64_t GetSize() const
void ForgetObject() const
Forget object, use when it was deleted behind the scene.
std::unique_ptr< RItem > CreateItem() const override
Create item.
Provider for all known TObject-based classes.
void RegisterTObject(const std::string &clname, const std::string &iconname, bool can_browse=false, int can_draw=3, const std::string &drawopt=""s)
ABC describing GUI independent browser implementation protocol.
Using a TBrowser one can browse all ROOT objects.
TClass instances represent classes, structs and namespaces in the ROOT type system.
Browsable element for TCollection.
int GetNumChilds() override
Returns number of childs By default creates iterator and iterates over all items.
std::unique_ptr< RLevelIter > GetChildsIter() override
Create iterator for childs elements if any.
TCollectionElement(std::unique_ptr< RHolder > &obj)
Iterator over elements in TCollection.
std::unique_ptr< RItem > CreateItem() override
Create item for current TObject.
TCollectionIter(const TFolder *f)
bool CanItemHaveChilds() const override
Check if item can be expanded.
bool Next() override
Shift to next entry.
virtual ~TCollectionIter()=default
TCollectionIter(const TCollection *coll)
std::shared_ptr< RElement > GetElement() override
Returns full information for current element.
std::string GetItemName() const override
Returns current entry name
Collection abstract base class.
virtual Int_t GetEntries() const
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
Element representing TColor.
EActionKind GetDefaultAction() const override
Get default action.
TColorElement(std::unique_ptr< RHolder > &obj)
The color creation and management class.
Browsable element for TFolder.
TFolderElement(std::unique_ptr< RHolder > &obj)
std::unique_ptr< RLevelIter > GetChildsIter() override
Create iterator for childs elements if any.
int GetNumChilds() override
Returns number of childs By default creates iterator and iterates over all items.
<div class="legacybox"><h2>Legacy Code</h2> TFolder is a legacy interface: there will be no bug fixes...
TCollection * GetListOfFolders() const
bool fDuplicated
! is object was duplicated?
virtual ~TMyBrowserImp()=default
TObjectLevelIter * fIter
! back-reference on iterator
void BrowseObj(TObject *obj) override
void Add(TObject *obj, const char *name, Int_t) override
void SetIgnore(bool on=true)
bool fIgnore
! ignore browsing, used during TBrowser constructor
const TObject * fBrowseObj
! object which will be browsed
bool IsDuplicated() const
TMyBrowserImp(TObjectLevelIter *iter, TObject *obj)
void Copy(TObject &named) const override
Copy this to obj.
Iterator over list of elements, designed for support TBrowser usage.
std::unique_ptr< RItem > CreateItem() override
Create element for the browser.
std::vector< std::shared_ptr< RElement > > fElements
bool CanItemHaveChilds() const override
Returns true if current item can have childs.
std::string GetItemName() const override
Returns current entry name
void AddElement(std::shared_ptr< RElement > &&elem)
bool Next() override
Shift to next entry.
std::shared_ptr< RElement > GetElement() override
Returns full information for current element.
bool Find(const std::string &name, int indx=-1) override
Find item with specified name Default implementation, should work for all If index specified,...
virtual ~TObjectLevelIter()=default
Mother of all ROOT objects.
virtual Bool_t IsFolder() const
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects).
virtual const char * GetName() const
Returns name of object.
virtual void Browse(TBrowser *b)
Browse object. May be overridden for another default action.
R__ALWAYS_INLINE Bool_t IsZombie() const
virtual const char * GetTitle() const
Returns title of object.
virtual TClass * IsA() const