Logo ROOT   6.16/01
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/TLogger.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
29{
30 pad.AddDisplayItem(std::make_unique<RObjectDisplayItem>(fObj.get(), fOpts.GetOptionString()));
31}
32
34{
35 TObject *obj = fObj.get();
36
37 // fill context menu items for the ROOT class
38 items.PopulateObjectMenu(obj, obj->IsA());
39}
40
42{
43 TObject *obj = fObj.get();
44
45 TString cmd;
46 cmd.Form("((%s*) %p)->%s;", obj->ClassName(), obj, exec.c_str());
47 printf("RObjectDrawable::Execute Obj %s Cmd %s\n", obj->GetName(), cmd.Data());
48 gROOT->ProcessLine(cmd);
49}
#define gROOT
Definition: TROOT.h:410
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:33
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
Basic string class.
Definition: TString.h:131
const char * Data() const
Definition: TString.h:364
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition: TString.cxx:2264