Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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/RAttrValue.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 RPalette fPalette; ///< color palette to draw
35 RAttrValue<bool> fVisible{this, "visible", true}; ///<! visibility flag
36 RAttrValue<RPadLength> fMargin{this, "margin", 0.02_normal}; ///<! margin
37 RAttrValue<RPadLength> fSize{this, "size", 0.05_normal}; ///<! margin
38
39protected:
40
41 bool IsFrameRequired() const final { return true; }
42
43 RPaletteDrawable() : RDrawable("palette") {}
44
45public:
46
47 RPaletteDrawable(const RPalette &palette) : RPaletteDrawable() { fPalette = palette; }
48 RPaletteDrawable(const RPalette &palette, bool visible) : RPaletteDrawable() { fPalette = palette; SetVisible(visible); }
49 const RPalette &GetPalette() const { return fPalette; }
50
51 RPaletteDrawable &SetVisible(bool on = true) { fVisible = on; return *this; }
52 bool GetVisible() const { return fVisible; }
53
54 RPaletteDrawable &SetMargin(const RPadLength &pos) { fMargin = pos; return *this; }
55 RPadLength GetMargin() const { return fMargin; }
56
57 RPaletteDrawable &SetSize(const RPadLength &sz) { fSize = sz; return *this; }
58 RPadLength GetSize() const { return fSize; }
59};
60
61//inline auto GetDrawable(const RPalette &palette)
62//{
63// return std::make_shared<RPaletteDrawable>(palette);
64//}
65
66
67} // namespace Experimental
68} // namespace ROOT
69
70#endif
Template class to access single value from drawable or other attributes.
Base class for drawable entities: objects that can be painted on a RPad.
A color palette draw near the frame.
RPaletteDrawable & SetMargin(const RPadLength &pos)
RPaletteDrawable & SetVisible(bool on=true)
RAttrValue< bool > fVisible
! visibility flag
RPaletteDrawable(const RPalette &palette, bool visible)
RPalette fPalette
color palette to draw
RAttrValue< RPadLength > fSize
! margin
RPaletteDrawable & SetSize(const RPadLength &sz)
RAttrValue< RPadLength > fMargin
! margin
RPaletteDrawable(const RPalette &palette)
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...