Hi,
On Tue, Jul 10, 2018 at 11:57 PM John Scipione <jscipione@xxxxxxxxx> wrote:
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.
My proposed class would look something like this:
template<typename T>
class BTypedControl: public BView, public BInvoker {
public:
...
virtual void SetValue(T value);
T Value() const;
...
};
A BControl would be the equivalent of a BTypedControl<int32> at least
conceptually.