Logo ROOT   6.12/07
Reference Guide
TObjectDrawable.cxx
Go to the documentation of this file.
1 /// \file TObjectDrawable.cxx
2 /// \ingroup CanvasPainter ROOT7
3 /// \author Axel Naumann <axel@cern.ch>
4 /// \date 2017-05-31
5 /// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback
6 /// is welcome!
7 
8 /*************************************************************************
9  * Copyright (C) 1995-2017, Rene Brun and Fons Rademakers. *
10  * All rights reserved. *
11  * *
12  * For the licensing terms see $ROOTSYS/LICENSE. *
13  * For the list of contributors see $ROOTSYS/README/CREDITS. *
14  *************************************************************************/
15 
16 #include <ROOT/TObjectDrawable.hxx>
17 
18 #include <ROOT/TDisplayItem.hxx>
19 #include <ROOT/TLogger.hxx>
20 #include <ROOT/TMenuItem.hxx>
22 
23 #include "TClass.h"
24 #include "TROOT.h"
25 
26 #include <exception>
27 
29 {
31  res->SetOption(fOpts.c_str());
32 
33  canv.AddDisplayItem(res);
34 }
35 
37 {
38  TObject *obj = fObj.get();
39 
40  // fill context menu items for the ROOT class
41  items.PopulateObjectMenu(obj, obj->IsA());
42 }
43 
44 void ROOT::Experimental::TObjectDrawable::Execute(const std::string &exec)
45 {
46  TObject *obj = fObj.get();
47 
48  TString cmd;
49  cmd.Form("((%s*) %p)->%s;", obj->ClassName(), obj, exec.c_str());
50  printf("TObjectDrawable::Execute Obj %s Cmd %s\n", obj->GetName(), cmd.Data());
51  gROOT->ProcessLine(cmd);
52 }
#define gROOT
Definition: TROOT.h:402
void PopulateMenu(TMenuItems &) final
Fill menu items for the object.
Basic string class.
Definition: TString.h:125
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Definition: TObject.cxx:128
virtual void AddDisplayItem(TDisplayItem *item)=0
add display item to the canvas
const std::shared_ptr< TObject > fObj
The object to be painted.
void Execute(const std::string &) final
Executes menu item.
std::string fOpts
The drawing options.
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition: TString.cxx:2343
Abstract interface for painting a canvas.
void PopulateObjectMenu(void *obj, TClass *cl)
Definition: TMenuItem.cxx:33
Mother of all ROOT objects.
Definition: TObject.h:37
void SetOption(const char *opt)
void Paint(Internal::TVirtualCanvasPainter &canv) final
Paint the histogram.
Base class for painting data for JS.
virtual const char * GetName() const
Returns name of object.
Definition: TObject.cxx:357
const char * Data() const
Definition: TString.h:345