Logo ROOT  
Reference Guide
RObjectDrawable.cxx
Go to the documentation of this file.
1/*************************************************************************
2 * Copyright (C) 1995-2017, 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 <ROOT/RDisplayItem.hxx>
12#include <ROOT/RLogger.hxx>
13#include <ROOT/RMenuItem.hxx>
14
15#include "TROOT.h"
16
17
18#include <exception>
19#include <sstream>
20#include <iostream>
21
22
23std::unique_ptr<ROOT::Experimental::RDisplayItem> ROOT::Experimental::RObjectDrawable::Display() const
24{
25 return std::make_unique<RObjectDisplayItem>(fObj.get(), fOpts);
26}
27
29{
30 // fill context menu items for the ROOT class
31 items.PopulateObjectMenu(fObj.get(), fObj.get()->IsA());
32}
33
35{
36 TObject *obj = fObj.get();
37
38 std::stringstream cmd;
39 cmd << "((" << obj->ClassName() << "* ) " << std::hex << std::showbase << (size_t)obj << ")->" << exec << ";";
40 std::cout << "RObjectDrawable::Execute Obj " << obj->GetName() << "Cmd " << cmd.str() << std::endl;
41 gROOT->ProcessLine(cmd.str().c_str());
42}
43
44
45
#define gROOT
Definition: TROOT.h:415
List of items for object context menu.
Definition: RMenuItem.hxx:151
void PopulateObjectMenu(void *obj, TClass *cl)
Definition: RMenuItem.cxx:20
std::string fOpts
drawing options
Internal::RIOShared< TObject > fObj
The object to be painted.
void Execute(const std::string &) final
Executes menu item.
std::unique_ptr< RDisplayItem > Display() const override
Creates display item for drawable By default item contains drawble data itself.
void PopulateMenu(RMenuItems &) final
Fill menu items for the object.
Mother of all ROOT objects.
Definition: TObject.h:37
virtual const char * GetName() const
Returns name of object.
Definition: TObject.cxx:357
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Definition: TObject.cxx:128