Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TObjectDraw6Provider.cxx
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
10
11#include "TObject.h"
12#include "TVirtualPad.h"
13
14using namespace ROOT::Experimental::Browsable;
15
16/** Provider for drawing of ROOT6 classes */
17
19public:
20
22 {
23 RegisterDraw6(nullptr, [](TVirtualPad *pad, std::unique_ptr<RHolder> &obj, const std::string &opt) -> bool {
24
25 // try take object without ownership
26 auto tobj = obj->get_object<TObject>();
27 if (!tobj) {
28 auto utobj = obj->get_unique<TObject>();
29 if (!utobj)
30 return false;
31 tobj = utobj.release();
32 tobj->SetBit(TObject::kMustCleanup); // TCanvas should care about cleanup
33 }
34
35 pad->GetListOfPrimitives()->Clear();
36
37 pad->GetListOfPrimitives()->Add(tobj, opt.c_str());
38
39 return true;
40 });
41 }
42
44
Provider of different browsing methods for supported classes.
Definition RProvider.hxx:36
void RegisterDraw6(const TClass *cl, Draw6Func_t func)
virtual void Add(TObject *obj)
Definition TList.h:81
virtual void Clear(Option_t *option="")
Remove all objects from the list.
Definition TList.cxx:402
Provider for drawing of ROOT6 classes.
Mother of all ROOT objects.
Definition TObject.h:41
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:766
@ kMustCleanup
if object destructor must call RecursiveRemove()
Definition TObject.h:64
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition TVirtualPad.h:51
virtual TList * GetListOfPrimitives() const =0