Adding NamedValueSet& LookAndFeel::getProperties()


What do you think about adding a NamedValueSet for holding properties to the LookAndFeel class, pretty much like the Component class already has?

For reasons that are quite long to explain there, I would find it very convenient to store additional informations about the LookAndFeel itself without having to derive a class for just that, for example the default sizes for knobs, or the position of their center (these are very useful informations when the widgets need to be repositioned in resized() methods)


Well I'm sure you have good reasons, but it seems odd to me.. Since the base class won't use these properties, it's only your own derived classes that would need them.. so why not just add the NamedValueSet to your derived class?



1) I'd have to dynamic_cast what I get from Component::getLookAndFeel() in order to check whether it is a LookAndFeel that supports those informations or not

2) I expect other developers to find their own useful ways to use this even if the base class makes no use of it (similarly to the possible ways the Component properties can and have been used)

3) (but not sure this is adivceable performance-wise) the whole Colour management in the LookAndFeel could be moved inside this NamedValueSet, like it's already done for Component


Yes, it's a nice idea to use the same colour storage mechanism as used by Component, but it would be much slower.

Not sure about this, it feels wrong to me - a base class shouldn't do things like that. Personally, I'd just put it in the derived class and write a few utility functions to set/get values which hide the dynamic_casting out of sight.


It's ok, I'll add it to a base class of mine and will inheirit my LaF's from there.

One more question: what's faster for this purpose? a PropertySet or a NamedValueSet?


NamedValueSet is almost certainly faster.