[haiku-development] Re: Negative insets and BScroll{Bar|View}

  • From: Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Wed, 26 Aug 2015 10:44:34 +0200

Am 26/08/2015 um 10:35 schrieb Adrien Destugues:

Is it safe to use hardcoded insets values for this? If we change the
size of the borders in the control look, things would not look right
anymore. So maybe it would make more sense to introduce a new
constant, B_COLLAPSE_BORDER_SPACING (which we could set to value -1
to keep binary compatibility with existing apps) that would use the
appropriate inset depending on the kind of border (fancy or not) and
the control look used?

A constant for what exactly? Using an "intelligent" spacing value like this would require quite a rework, as BControlLook has no clue about the context.
For that to work, the constants would need to be stored in the insets, and only be resolved when needed (which would be a nice change, anyway), but at that point, you would also need to know the exact environment to pull this off. And it would only work with internal classes. Ie. it would not be possible to do something like this with a custom class.

Furthermore, -1 is already used in our sources, too.

In any case, there are lots of cases where we would need to know the size of borders, and similar things (like the menu field popup indicator). This is an API shortcoming that must be solved one day, anyway, to be able to do meaningful changes to the default look by replacing BControlLook.

Bye,
Axel.

Other related posts: