Logo ROOT  
Reference Guide
RPaletteDrawable.hxx
Go to the documentation of this file.
1/*************************************************************************
2 * Copyright (C) 1995-2020, 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_RPaletteDrawable
10#define ROOT7_RPaletteDrawable
11
12#include <ROOT/RDrawable.hxx>
13#include <ROOT/RAttrAxis.hxx>
14#include <ROOT/RPadPos.hxx>
15#include <ROOT/RPalette.hxx>
16
17#include <memory>
18#include <string>
19
20namespace ROOT {
21namespace Experimental {
22
23/** \class ROOT::Experimental::RPaletteDrawable
24\ingroup GrafROOT7
25\brief A color palette draw near the frame.
26\author Sergey Linev <s.linev@gsi.de>
27\date 2020-03-05
28\warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
29*/
30
31
32class RPaletteDrawable final : public RDrawable {
33
34 class ROwnAttrs : public RAttrBase {
35 friend class RPaletteDrawable;
36 R__ATTR_CLASS(ROwnAttrs, "", AddBool("visible", true).AddPadLength("margin",0.02).AddPadLength("size",0.05));
37 };
38
39 RPalette fPalette; /// color palette to draw
40 RAttrAxis fAttrAxis{this, "axis_"}; ///<! axis attributes
41 ROwnAttrs fAttr{this,""}; ///<! own attributes
42
43protected:
44
45 bool IsFrameRequired() const final { return true; }
46
47 RPaletteDrawable() : RDrawable("palette") {}
48
49public:
50
51 RPaletteDrawable(const RPalette &palette) : RPaletteDrawable() { fPalette = palette; }
52 RPaletteDrawable(const RPalette &palette, bool visible) : RPaletteDrawable() { fPalette = palette; SetVisible(visible); }
53 const RPalette &GetPalette() const { return fPalette; }
54
55 RPaletteDrawable &SetVisible(bool on = true) { fAttr.SetValue("visible", on); return *this; }
56 bool GetVisible() const { return fAttr.GetValue<bool>("visible"); }
57
59 {
60 fAttr.SetValue("margin", pos);
61 return *this;
62 }
63
65 {
66 return fAttr.GetValue<RPadLength>("margin");
67 }
68
70 {
71 fAttr.SetValue("size", sz);
72 return *this;
73 }
74
76 {
77 return fAttr.GetValue<RPadLength>("size");
78 }
79
80 const RAttrAxis &GetAttrAxis() const { return fAttrAxis; }
81 RPaletteDrawable &SetAttrAxis(const RAttrAxis &attr) { fAttrAxis = attr; return *this; }
83};
84
85//inline auto GetDrawable(const RPalette &palette)
86//{
87// return std::make_shared<RPaletteDrawable>(palette);
88//}
89
90
91} // namespace Experimental
92} // namespace ROOT
93
94#endif
All kind of drawing a axis: line, text, ticks, min/max, log, invert, ...
Definition: RAttrAxis.hxx:27
Base class for all attributes, used with RDrawable.
Definition: RAttrBase.hxx:27
void SetValue(const std::string &name, bool value)
Set boolean value.
Definition: RAttrBase.cxx:133
T GetValue(const std::string &name) const
Definition: RAttrBase.hxx:170
Base class for drawable entities: objects that can be painted on a RPad.
Definition: RDrawable.hxx:102
R__ATTR_CLASS(ROwnAttrs, "", AddBool("visible", true).AddPadLength("margin", 0.02).AddPadLength("size", 0.05))
A color palette draw near the frame.
RPaletteDrawable & SetMargin(const RPadLength &pos)
RPaletteDrawable & SetVisible(bool on=true)
RPaletteDrawable & SetAttrAxis(const RAttrAxis &attr)
RPaletteDrawable(const RPalette &palette, bool visible)
RAttrAxis fAttrAxis
color palette to draw
RPaletteDrawable & SetSize(const RPadLength &sz)
const RAttrAxis & GetAttrAxis() const
RPaletteDrawable(const RPalette &palette)
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Definition: StringConv.hxx:21