[haiku-development] Re: BBox and layout
- From: Clemens <clemens.zeidler@xxxxxxxxxxxxxx>
- To: haiku-development@xxxxxxxxxxxxx
- Date: Thu, 17 May 2012 08:23:50 +1200
After giving it a another thought I still think SetInset should be in BView for consistency reasons. As said before BView is a speciallayout/layout item. It's somehow an artificial BLayoutItem or BLayout. It can be added into a layout and handled like a normal BLayoutItem. For this reason when adding a SetInset to BLayout it should also be added to BView(similar to the layout related size getter and setter in BView).I can't quite follow this train of thought. BView is essentially aBLayoutItem (and it really would be, had that been possible to implement in a binary compatible way). I don't see how that implies that because BLayouthas insets BView should have insets, too.
yes BView is a hybrid of an BLayoutItem and a BLayout, BView would not only be a BLayoutItem, it would be a BLayout. For all important BLayout methods there are already equivalent methods in BView.
The BView, as a BLayout, has no "Add*" layout method but just one SetLayout method because it can exactly hold one layout.
There is a clear separation of concerns: A layout gets a rectangular areaand arranges layout items in it. One layout property are the insets for theoriginal area. BView has two roles: As a simple layout item with size and alignment constraints and as an entity that drives the layout process. Neither role requires or even benefits from insets.
As said above the second role is the role of a layout. In this role a SetInset would remove the need to add another layout just for the sake of adding a container inset.
Since border style and label of the BBox can also be set any time afterconstruction, insets would have to be updated then as well. Furthermore thesize constraints of the label view can change, which would also have thatimplication. That is in practice you can't easily override the insets for aBBox.
bummer, yes SetInset cannot provide a clean solution in a label resize event. However, I would still hide the BBoxLayout complexity and make it working by overwriting BBox::SetLayout and BBox::SetInset.
A BBoxLayout::AddItem call to set a single layout is confusing for theuser, i.e. does it means that multiple layouts can be assigned to a BBox?As written above, I'd add BBox::SetContent() methods (and a BLayoutItem*constructor version -- there already is one for a BView* child) to simplifyand clarify the API.
But there is still the problem that the user could try to use SetLayout to set the content layout. (that would happened for user like me :) ) This confusion can be avoided by using the more general BView api.
Such a BBox API also doesn't require any knowledge of "layout internals". I think it's at least as easy to grasp that a BBox is a frame with a content item that one can set as how certain insets would add up and that the labelview isn't managed by the layout.
The more basic and simpler view on a BBox is that it's just a simple BView that does some drawing and sets a default inset for the layout.
Regards,
Clemens
- Follow-Ups:
- [haiku-development] Re: BBox and layout
- From: Ingo Weinhold
- [haiku-development] Re: BBox and layout
- References:
- [haiku-development] Re: BBox and layout
- From: clemens . zeidler
- [haiku-development] Re: BBox and layout
- From: Alex Wilson
- [haiku-development] Re: BBox and layout
- From: Clemens
- [haiku-development] Re: BBox and layout
- From: Alex Wilson
- [haiku-development] Re: BBox and layout
- From: Clemens
- [haiku-development] Re: BBox and layout
- From: pulkomandy
- [haiku-development] Re: BBox and layout
- From: Clemens Zeidler
- [haiku-development] Re: BBox and layout
- From: Alex Wilson
- [haiku-development] Re: BBox and layout
- From: Clemens Zeidler
- [haiku-development] Re: BBox and layout
- From: Ingo Weinhold
- [haiku-development] Re: BBox and layout
Other related posts:
- » [haiku-development] BBox and layout - Clemens
- » [haiku-development] Re: BBox and layout - Alex Wilson
- » [haiku-development] Re: BBox and layout - Ingo Weinhold
- » [haiku-development] Re: BBox and layout - Clemens
- » [haiku-development] Re: BBox and layout - Clemens
- » [haiku-development] Re: BBox and layout - Stephan Aßmus
- » [haiku-development] Re: BBox and layout - Axel Dörfler
- » [haiku-development] Re: BBox and layout - Clemens Zeidler
- » [haiku-development] Re: BBox and layout - Alex Wilson
- » [haiku-development] Re: BBox and layout - Alex Wilson
- » [haiku-development] Re: BBox and layout - clemens . zeidler
- » [haiku-development] Re: BBox and layout - Clemens
- » [haiku-development] Re: BBox and layout - Alex Wilson
- » [haiku-development] Re: BBox and layout - Alex Wilson
- » [haiku-development] Re: BBox and layout - Clemens
- » [haiku-development] Re: BBox and layout - Clemens
- » [haiku-development] Re: BBox and layout - Clemens
- » [haiku-development] Re: BBox and layout - Alex Wilson
- » [haiku-development] Re: BBox and layout - Axel Dörfler
- » [haiku-development] Re: BBox and layout - Alex Wilson
- » [haiku-development] Re: BBox and layout - Alex Wilson
- » [haiku-development] Re: BBox and layout - Clemens
- » [haiku-development] Re: BBox and layout - Ingo Weinhold
- » [haiku-development] Re: BBox and layout - Clemens
- » [haiku-development] Re: BBox and layout - Ingo Weinhold
- » [haiku-development] Re: BBox and layout - Stephan Aßmus
- » [haiku-development] Re: BBox and layout - Clemens
- » [haiku-development] Re: BBox and layout - Clemens
- » [haiku-development] Re: BBox and layout - Ingo Weinhold
- » [haiku-development] Re: BBox and layout - pulkomandy
- » [haiku-development] Re: BBox and layout - Clemens Zeidler
- » [haiku-development] Re: BBox and layout - Clemens Zeidler
- » [haiku-development] Re: BBox and layout - Ingo Weinhold
- » [haiku-development] Re: BBox and layout - Alex Wilson
- » [haiku-development] Re: BBox and layout - Clemens Zeidler
- » [haiku-development] Re: BBox and layout - Ingo Weinhold
- » [haiku-development] Re: BBox and layout - Clemens
- » [haiku-development] Re: BBox and layout - Ingo Weinhold
- » [haiku-development] Re: BBox and layout - Clemens Zeidler
- » [haiku-development] Re: BBox and layout - Ingo Weinhold