[interfacekit] Re: BBox::GetPreferredSize()

Ingo Weinhold <bonefish@xxxxxxxxxxxxxxx> wrote:
> * The "NOTE" near the end of the function is obviously incorrect. It 
> doesn't make any sense to add the child's width to a value that 
> includes 
> the width of the label.

Indeed.

> * In case of a label string, the label placement and spacing is not 
> taken 
> into account. The computation of the label box rect in SetLabel() 
> explains 
> that the label is place at x = 10 and has 4 pixels of horizontal 
> spacing to 
> either side.

It's even worse than that; it uses the += operator on uninitialized 
variables.

> * The "account for border" part is a riddle to me. Where is the 
> padding 
> coming from? And why does it differ depending on whether there's a 
> label or 
> not?

If you ask me, it doesn't make much sense - only that it has a 
different border width depending on the type. With a label, it might 
look better with more padding, though.
Anyway, the computations don't look correct to me at all.

Feel free to correct that to your likings, I would think. IMO 
GetPreferredSize() in a BBox is as useful as in BView, at least when 
there is no label.

Bye,
   Axel.


Other related posts: