Opened 14 years ago
Closed 14 years ago
#6407 closed enhancement (fixed)
BLayout should derive from BLayoutItem, and should function without a BView.
Reported by: | yourpalal | Owned by: | yourpalal |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Kits/Interface Kit | Version: | R1/Development |
Keywords: | layout, gsoc2010, | Cc: | |
Blocked By: | Blocking: | #5524 | |
Platform: | All |
Description
BLayout should derive from BLayoutItem, so that we can avoid creating BViews with the sole purpose of having a BLayout attached to them!
However, this change will cause some compilation problems, so it will have to be done in stages:
1 Update Applications to reflect the impending changes in step 2
2 Update layout builders and remove their operator* BView which will cause compilation ambiguities once BLayout is a BLayoutItem when a layout builder is passed to BView::AddChild() or BWindow::AddChild(). At this point, methods will also be added to the layout builders to facilitate use of viewless BLayouts, but they will not create viewless layouts.
3 Derive BLayout from BLayoutItem, and provide mechanisms for correct operation under viewlessness. Also update BLayout sub-classes to use these mechanisms.
4 Update layout builders to actually create viewless layouts under the correct situations.
5 Add an easy enhancement ticket for updating apps to make better use of viewless layouts, probably with hints at how to do this.
Attachments (3)
Change History (13)
comment:1 by , 14 years ago
Status: | new → in-progress |
---|
follow-up: 3 comment:2 by , 14 years ago
comment:3 by , 14 years ago
Replying to tangobravo:
Just out of interest, what's the need for a viewless BLayout? What's the use-case?
Basically, there are two places where it will be useful: *It will allow for nested layouts, so that instead of this kind of thing:
BGroupView* myGroupView = new BGroupView(B_HORIZONTAL); BGroupView* nestedGroup; myGroupView->GroupLayout()->AddView(nestedGroup = new BGroupView(B_VERTICAL), 5); nestedGroup->AddChild(new BButton("a")); nestedGroup->AddChild(new BButton("a")); myGroupView->GroupLayout()->AddView(nestedGroup = new BGroupView(B_VERTICAL), 2); nestedGroup->AddChild(new BButton("b")); nestedGroup->AddChild(new BButton("b")); nestedGroup->AddChild(new BButton("b"));
You could forego the creation of the nestedGroup BView, and simply add BGroupLayouts to myGroupView. This way, we avoid the overhead of having another two views in there, when their only purpose is to host a BGroupLayout. This also means that all those BButtons will be children of myGroupView. (That's not really an advantage, but I thought I'd mention it) An even more 'extreme' scenario might be to avoid adding any organizational views at all to your window (of course, BWindow::fTopView will still be there).
*Another use case is laying out objects that are not strictly related to BViews. (Composing a document for example, you could use many nested layouts for the different elements).
comment:4 by , 14 years ago
patch: | 0 → 1 |
---|
comment:5 by , 14 years ago
Commited in hrev38207, leaving this ticket open for a while for regressions and so on.
comment:6 by , 14 years ago
I'm not completely sure, but after hrev38207 Terminal settings window looks like this:
Before there was white border which had been caused by some other changes.
follow-up: 8 comment:7 by , 14 years ago
Again, I'm not sure if it's related to hrev38207, but Mount settings window in tracker is empty now.
comment:8 by , 14 years ago
comment:10 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | in-progress → closed |
Everything seems to be working fine, so I'm closing this ticket as fixed.
Just out of interest, what's the need for a viewless BLayout? What's the use-case?