Logo ROOT   6.18/05
Reference Guide
RObjectDrawable.cxx
Go to the documentation of this file.
1/// \file RObjectDrawable.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
17
18#include <ROOT/RDisplayItem.hxx>
19#include <ROOT/RLogger.hxx>
20#include <ROOT/RMenuItem.hxx>
21#include <ROOT/RPadPainter.hxx>
22
23#include "TClass.h"
24#include "TROOT.h"
25
26#include <exception>
27#include <sstream>
28#include <iostream>
29
31{
32 pad.AddDisplayItem(std::make_unique<RObjectDisplayItem>(fObj.get(), fOpts.GetOptionString()));
33}
34
36{
37 TObject *obj = fObj.get();
38
39 // fill context menu items for the ROOT class
40 items.PopulateObjectMenu(obj, obj->IsA());
41}
42
44{
45 TObject *obj = fObj.get();
46
47 std::stringstream cmd;
48 cmd << "((" << obj->ClassName() << "* ) " << std::hex << std::showbase << (size_t)obj << ")->" << exec << ";";
49 std::cout << "RObjectDrawable::Execute Obj " << obj->GetName() << "Cmd " << cmd.str() << std::endl;
50 gROOT->ProcessLine(cmd.str().c_str());
51}
#define gROOT
Definition: TROOT.h:414
Abstract interface for object painting on the pad/canvas.
Definition: RPadPainter.hxx:37
virtual void AddDisplayItem(std::unique_ptr< RDisplayItem > &&item)
add display item to the canvas
Definition: RPadPainter.cxx:21
void PopulateObjectMenu(void *obj, TClass *cl)
Definition: RMenuItem.cxx:34
void Paint(Internal::RPadPainter &canv) final
Paint the object.
void Execute(const std::string &) final
Executes menu item.
void PopulateMenu(RMenuItems &) final
Fill menu items for the object.
const std::shared_ptr< TObject > fObj
The object to be painted.
const std::string & GetOptionString() const
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