Logo ROOT  
Reference Guide
RDisplayItem.hxx
Go to the documentation of this file.
1/*************************************************************************
2 * Copyright (C) 1995-2019, 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
9#ifndef ROOT7_RDisplayItem
10#define ROOT7_RDisplayItem
11
12#include <string>
13
14namespace ROOT {
15namespace Experimental {
16
17class RDrawable;
18class RStyle;
19class RAttrMap;
20
21/** \class RDisplayItem
22\ingroup GpadROOT7
23\brief Base class for painting data for JS.
24\author Sergey Linev <s.linev@gsi.de>
25\date 2017-05-31
26\warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
27*/
28
30protected:
31 std::string fObjectID; ///< unique object identifier
32 RStyle *fStyle{nullptr}; ///< style object
33 unsigned fIndex{0}; ///<! index inside current pad, used to produce fully-qualified id, not send to client
34 bool fDummy{false}; ///< if true, just placeholder for drawable which does not changed
35
36public:
37 RDisplayItem() = default;
38 RDisplayItem(bool dummy) : RDisplayItem() { fDummy = dummy; }
39 virtual ~RDisplayItem() {}
40
41 void SetObjectID(const std::string &id) { fObjectID = id; }
42 std::string GetObjectID() const { return fObjectID; }
43
44 void SetObjectIDAsPtr(const void *ptr);
45
47
48 void SetIndex(unsigned indx) { fIndex = indx; }
49 unsigned GetIndex() const { return fIndex; }
50
51 virtual void BuildFullId(const std::string &prefix);
52
53 static std::string ObjectIDFromPtr(const void *ptr);
54};
55
56
57/** \class RDrawableDisplayItem
58\ingroup GpadROOT7
59\brief Generic display item for RDrawable, just reference drawable itself
60\author Sergey Linev <s.linev@gsi.de>
61\date 2017-05-31
62\warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
63*/
64
66protected:
67
68 const RDrawable *fDrawable{nullptr}; ///< drawable
69
70public:
71
72 template <class DRAWABLE>
73 RDrawableDisplayItem(const DRAWABLE &dr)
74 {
75 fDrawable = &dr;
76 }
77
78 const RDrawable *GetDrawable() const { return fDrawable; }
79
80 virtual ~RDrawableDisplayItem();
81
82};
83
84
85/** \class RIndirectDisplayItem
86\ingroup GpadROOT7
87\brief Extract (reference) only basic attributes from drawable, but not drawable itself
88\author Sergey Linev <s.linev@gsi.de>
89\date 2020-04-02
90\warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
91*/
92
94protected:
95
96 const RAttrMap *fAttr{nullptr}; ///< pointer on drawable attributes
97 const std::string *fCssClass{nullptr}; ///< pointer on drawable class
98 const std::string *fId{nullptr}; ///< pointer on drawable id
99
100public:
101
103
105};
106
107} // namespace Experimental
108} // namespace ROOT
109
110#endif
XFontStruct * id
Definition: TGX11.cxx:109
Base class for painting data for JS.
virtual void BuildFullId(const std::string &prefix)
Build full id, including prefix and object index.
std::string fObjectID
unique object identifier
void SetObjectID(const std::string &id)
bool fDummy
if true, just placeholder for drawable which does not changed
void SetObjectIDAsPtr(const void *ptr)
Assign id using arbitrary pointer value Typically drawable pointer should be used here.
unsigned fIndex
! index inside current pad, used to produce fully-qualified id, not send to client
static std::string ObjectIDFromPtr(const void *ptr)
Construct fillid using pointer value.
std::string GetObjectID() const
Generic display item for RDrawable, just reference drawable itself.
const RDrawable * GetDrawable() const
const RDrawable * fDrawable
drawable
Base class for drawable entities: objects that can be painted on a RPad.
Definition: RDrawable.hxx:108
Extract (reference) only basic attributes from drawable, but not drawable itself.
const std::string * fId
pointer on drawable id
const std::string * fCssClass
pointer on drawable class
const RAttrMap * fAttr
pointer on drawable attributes
A set of defaults for graphics attributes, e.g.
Definition: RStyle.hxx:32
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
TCanvas * style()
Definition: style.C:1