16 #ifndef ROOT7_TDrawingAttrs 17 #define ROOT7_TDrawingAttrs 28 namespace Experimental {
31 class TDrawingOptsBaseNoDefault;
35 template <
class PRIMITIVE>
45 template <
class PRIMITIVE>
48 size_t fIdx = (size_t)-1;
66 const std::vector<std::string_view> &optStrings = {});
69 operator size_t()
const {
return fIdx; }
72 explicit operator bool()
const {
return fIdx != (size_t)-1; }
81 template <
class PRIMITIVE>
99 void Create(
const PRIMITIVE &val);
108 bool IsFree()
const {
return fUseCount == 0; }
111 PRIMITIVE &
Get() {
return fVal; }
114 const PRIMITIVE &
Get()
const {
return fVal; }
122 template <
class PRIMITIVE>
157 std::vector<value_type> &
GetTable() {
return fTable; }
160 const std::vector<value_type> &
GetTable()
const {
return fTable; }
174 explicit operator long long()
const {
return fVal; }
180 : fColor(opts, name +
".Color", col), fWidth(opts, name +
".Width", (long long)width)
191 : fColor(opts, name +
".Color", col)
198 #endif // ROOT7_TDrawingAttrs Namespace for new ROOT classes and functions.
void DecrUse(TDrawingAttrRef< PRIMITIVE > idx)
Remove a use of the attribute at table index idx.
std::vector< value_type > fTable
Table of attribute primitives.
const PRIMITIVE & Get(TDrawingAttrRef< PRIMITIVE > idx) const
Get the value at index idx (const version).
void IncrUse(TDrawingAttrRef< PRIMITIVE > idx)
Add a use of the attribute at table index idx.
const std::vector< value_type > & GetTable() const
Access to the underlying attribute table (const version).
TDrawingAttrRef< TColor > fColor
Fill color.
PRIMITIVE & Get(TDrawingAttrRef< PRIMITIVE > idx)
Get the value at index idx (non-const version).
TDrawingAttrAndUseCount(const PRIMITIVE &val)
Initialize with a value, setting use count to 1.
TLineAttrs(TDrawingOptsBaseNoDefault &opts, const std::string &name, const TColor &col, Width width)
Construct from the pad that holds our TDrawable, passing the configuration name of this line attribut...
TDrawingAttrRef< long long > fWidth
Line width.
bool IsFree() const
Whether the use count is 0 and this object has space for a new value.
void Update(TDrawingAttrRef< PRIMITIVE > idx, const PRIMITIVE &val)
Update an existing attribute entry in the table.
const PRIMITIVE & Get() const
Value access (const).
TDrawingAttrAndUseCount()
Default constructor: a default-constructed value that is unused.
std::vector< value_type > & GetTable()
Access to the underlying attribute table (non-const version).
The TCanvas keep track of TColors, integer and floating point attributes used by the drawing options...
PRIMITIVE & Get()
Value access (non-const).
TDrawingAttrRef(size_t idx)
Construct a reference given the index.
A color: Red|Green|Blue|Alpha, or a position in a TPalette.
TDrawingAttrRef< TColor > fColor
Line color.
TFillAttrs(TDrawingOptsBaseNoDefault &opts, const std::string &name, const TColor &col)
Construct from the pad that holds our TDrawable, passing the configuration name of this line attribut...