39 const auto *dvalue = GetDefaults().Find(
name);
40 if (!dvalue || !dvalue->CanConvertFrom(value.
Kind()))
44 if (
auto access = EnsureAttr(
name)) {
45 access.attr->Add(access.fullname, value.
Copy());
57 if (
auto v = AccessValue(
name, use_style))
58 return v.value->CanConvertFrom(value.
Kind()) &&
v.value->IsEqual(value);
68 for (
const auto &entry : GetDefaults()) {
69 if (
auto v = AccessValue(entry.first, use_style))
80 std::swap(fPrefix, tgt.
fPrefix);
82 std::swap(fParent, tgt.
fParent);
90 for (
const auto &entry : GetDefaults()) {
91 if (
auto v = AccessValue(entry.first, use_style))
92 if (!tgt.
IsValueEqual(entry.first, *
v.value, use_style))
return false;
102 fDrawable = drawable;
105 if (!IsValue() && !fPrefix.empty()) fPrefix.append(
"_");
117 if (!IsValue() && !fPrefix.empty()) fPrefix.append(
"_");
126 if (
auto access = AccessAttr(
name))
127 access.attr->
Clear(access.fullname);
136 if (
auto access = AccessAttr(
name))
137 access.attr->AddNoValue(access.fullname);
145 if (
auto access = EnsureAttr(
name))
146 access.attr->AddBool(access.fullname, value);
154 if (
auto access = EnsureAttr(
name))
155 access.attr->AddInt(access.fullname, value);
163 if (
auto access = EnsureAttr(
name))
164 access.attr->AddDouble(access.fullname, value);
172 if (
auto access = EnsureAttr(
name))
173 access.attr->AddString(access.fullname, value);
192 for (
const auto &entry : GetDefaults())
193 ClearValue(entry.first);
206 const std::type_info &info =
typeid(*this);
208 auto baseClass = TClass::GetClass<ROOT::Experimental::RAttrBase>();
209 if (thisClass && baseClass) {
211 if (data_member && data_member->GetClass() && data_member->GetClass()->InheritsFrom(baseClass) &&
212 (data_member->GetClass()->GetBaseClassOffset(baseClass) == 0)) {
217 R__LOG_ERROR(
GPadLog()) <<
"Missing dictionary for " << info.name() <<
" class, implement CollectDefaults() like in RAttrColor";
#define R__LOG_ERROR(...)
Base class for all attributes, used with RDrawable.
bool IsValueEqual(const std::string &name, const RAttrMap::Value_t &value, bool use_style=false) const
Check if provided value equal to attribute in the map.
std::unique_ptr< RAttrMap > fOwnAttr
own instance when deep copy is created, persistent for RColor and similar classes
void Clear()
Clear all respective values from drawable. Only defaults can be used.
void SetNoValue(const std::string &name)
Set <NoValue> for attribute.
bool CopyValue(const std::string &name, const RAttrMap::Value_t &value, bool check_type=true)
Copy attributes from other object.
void MoveTo(RAttrBase &tgt)
Move all fields into target object.
RDrawable * fDrawable
! drawable used to store attributes
void ClearValue(const std::string &name)
Clear value if any with specified name.
void AssignDrawable(RDrawable *drawable, const std::string &prefix)
Return value from attributes container - no style or defaults are used.
RAttrBase * fParent
! parent attributes, prefix applied to it
void SetValue(const std::string &name, bool value)
Set boolean value.
bool IsSame(const RAttrBase &src, bool use_style=true) const
Check if all values which are evaluated in this object are exactly the same as in tgt object.
void AssignParent(RAttrBase *parent, const std::string &prefix)
Assign parent object for this RAttrBase.
std::string fPrefix
! name prefix for all attributes values
virtual const RAttrMap & GetDefaults() const
Return default values for attributes, empty for base class.
virtual RAttrMap CollectDefaults() const
Collect all attributes in derived class Works only if such class has dictionary.
void CopyTo(RAttrBase &tgt, bool use_style=true) const
Copy attributes into target object.
virtual EValuesKind Kind() const =0
virtual std::unique_ptr< Value_t > Copy() const =0
RAttrMap & AddDefaults(const RAttrBase &vis)
Add defaults values form sub attribute.
Base class for drawable entities: objects that can be painted on a RPad.
A log configuration for a channel, e.g.
std::string AsString() const
Converts RPadLength to string like "0.1 + 25px" User coordinates not (yet) supported.
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
TRangeDynCast is an adaptater class that allows the typed iteration through a TCollection.
RLogChannel & GPadLog()
Log channel for GPad diagnostics.