On Tue, Jul 10, 2018, 5:57 PM John Scipione <jscipione@xxxxxxxxx> wrote:
Dear Haiku Developers,
This letter is meant to start a discussion of a potentially
glass-elevator backwards-compatibility breaking change that I'd like
to propose. The idea is to introduce a templated BControl which takes
a type to use in its Value() and SetValue() methods instead of
assuming int32. I asked about the idea on the mailing list a while
back and it seemed like there was some interest in the idea so I
wanted to get the mailing lists feedback next.
Currently the value of fa BControl is always of type int32. This falls
down when the value of a BControl does not neatly fit into an int32.
For most controls like in the IK like buttons, checkboxes this is not
a problem, however, one example from IK that suffers is BColorControl
which tries to take an rgb_color value. In this case the API gets
around the int32 type limitation by packing an rgb_color stuffed into
an int32 into BColorControl::SetValue() method and implementing
ValueAColor(). Another place where I ran into this deficiency was in
BDecimalSpinner where I overloaded SetValue() to take a double. The
overloaded SetValue() method requires the caller to do casting or
specify their types carefully on the implementation side in order to
avoid ambiguous type warnings/errors.