[haiku-development] Re: BShelf and layouts

  • From: Alex Wilson <yourpalal2@xxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sat, 27 Nov 2010 20:19:01 -0700

On Sat, Nov 27, 2010 at 1:08 PM, Rene Gollent <anevilyak@xxxxxxxxx> wrote:
> Hi everyone,
>
> While looking into some of the remaining bugs in Alex's layout/locale
> Tracker rewrite, an interesting problem comes up: BShelf is currently
> completely unaware of the layout kit, which results in some
> interesting problems since it adds the replicant views directly to the
> shelf container view via AddChild(). At the moment I'm not really sure
> how to cleanly solve this though while preserving the feature set of
> the shelf. Problem #1 is that BShelf supports absolute positioning of
> replicants since the user can drag them around, but this isn't really
> something that's supported by any existing layout except maybe ALM via
> some creative manipulation of constraints. However, it can't really
> assume that the containing view is using a particular layout, so that
> solution isn't viable either. Any thoughts on how best to deal with
> replicants in a layout-aware world?

I'm not sure if it's the best way, but here is one possible solution:

*Let BShelf work the same way it currently does on views without a layout.
*Add a custom BShelf-specific BLayout that allows manual positioning
of its items, this
layout would be private to BShelf, and could be created with a BShelf
factory method.
BShelf still has some padding space, so it could store a pointer to
the layout it creates.
*On views with a layout which is not a BShelfLayout (or whatever)
disable replicant
positionability.
* In all scenarios, replicants can still be added with the view's
AddChild() method (which
calls the view's layout's AddView() method)

How does that sound?

--Alex

Other related posts: