Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TObjectDrawable.hxx
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
9#ifndef ROOT7_TObjectDrawable
10#define ROOT7_TObjectDrawable
11
12#include <ROOT/RDrawable.hxx>
13
14class TObject;
15class TColor;
16
17namespace ROOT {
18namespace Experimental {
19
20class RPadBase;
21
22/** \class TObjectDrawable
23\ingroup GpadROOT7
24\brief Provides v7 drawing facilities for TObject types (TGraph etc).
25\author Sergey Linev
26\date 2017-05-31
27\warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
28*/
29
30class TObjectDrawable final : public RDrawable {
31private:
32
33 enum {
34 kNone = 0, ///< empty container
35 kObject = 1, ///< plain object
36 };
37
38 int fKind{kNone}; ///< object kind
39 Internal::RIOShared<TObject> fObj; ///< The object to be painted
40 std::string fOpts; ///< drawing options
41
42 const char *GetColorCode(TColor *col);
43
44 std::unique_ptr<TObject> CreateSpecials(int kind);
45
46protected:
47
48 void CollectShared(Internal::RIOSharedVector_t &vect) final { vect.emplace_back(&fObj); }
49
50 std::unique_ptr<RDisplayItem> Display(const RDisplayContext &) override;
51
52 void PopulateMenu(RMenuItems &) final;
53
54 void Execute(const std::string &) final;
55
56public:
57 // special kinds, see TWebSnapshot enums
58 enum EKind {
59 kColors = 4, ///< list of ROOT colors
60 kStyle = 5, ///< instance of TStyle object
61 kPalette = 6 ///< list of colors from palette
62 };
63
64 TObjectDrawable() : RDrawable("tobject") {}
65
66 TObjectDrawable(const std::shared_ptr<TObject> &obj, const std::string &opt = "") : RDrawable("tobject"), fKind(kObject), fObj(obj), fOpts(opt) {}
67
68 TObjectDrawable(EKind kind, bool persistent = false);
69
70 virtual ~TObjectDrawable() = default;
71};
72
73} // namespace Experimental
74} // namespace ROOT
75
76
77#endif
Base class for drawable entities: objects that can be painted on a RPad.
List of items for object context menu.
Provides v7 drawing facilities for TObject types (TGraph etc).
@ kPalette
list of colors from palette
@ kStyle
instance of TStyle object
TObjectDrawable(const std::shared_ptr< TObject > &obj, const std::string &opt="")
Internal::RIOShared< TObject > fObj
The object to be painted.
std::string fOpts
drawing options
std::unique_ptr< TObject > CreateSpecials(int kind)
Create instance of requested special object.
const char * GetColorCode(TColor *col)
Convert TColor to RGB string for using with SVG.
void PopulateMenu(RMenuItems &) final
void CollectShared(Internal::RIOSharedVector_t &vect) final
void Execute(const std::string &) final
std::unique_ptr< RDisplayItem > Display(const RDisplayContext &) override
Create display item which will be delivered to the client.
The color creation and management class.
Definition TColor.h:19
Mother of all ROOT objects.
Definition TObject.h:37
std::vector< RIOSharedBase * > RIOSharedVector_t
Definition RDrawable.hxx:52
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...