[haiku-development] Re: BBox and layout

  • From: Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Wed, 09 May 2012 16:32:15 +0200

On 09.05.2012 05:45, Clemens wrote:
To go back to the discussion where Ingo wondered that the "adding to
view adds to layout" automatism was not a wise decision. After giving it
another thought I think it has the following advantages to remove that
automatism:

- AddChild does not change its behaviour if there is a layout present ->
there is no need for a B_EXCLUDE[_VIEW]_FROM_LAYOUT flag

That would merely be a side effect of the different implementation rather than an argument for it.

- AddChild can be used for "overlay" stuff like the label view in BBox
- AddChild is just the raw base method for adding a view, no hidden
intelligence here

It's not about hidden intelligence, but having an API that behaves like you would expect it to. As Alex pointed out, it's okay for layouts to drop into the debugger if the standard form of AddChild() does not make any sense - if they would try to make sense of it in some weird way, now that would be "intelligent" behavior.

- view and layout are more decoupled, only the layout class can be used
to add stuff into the layout -> more consistency

I would completely understand that move, if we removed BView::SetLayout() completely, and that would also create a consistent API. Otherwise, I don't think that it makes any sense. Basically, I don't see the point in decoupling them further, though, as long as BLayouts can be used without BViews.

Anyway, let's not look too closely at Qt for layouts; I would hate ending up having our layout know about the menu bar ;-)

Bye,
   Axel.

Other related posts: