Boost logo

Boost :

Subject: Re: [boost] [rfc] cppgui
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2009-07-01 16:09:07


Felipe Magno de Almeida
> On Wed, Jul 1, 2009 at 4:41 PM, Stewart,
>
> > One layout mechanism that I've found very easy to use and
> > easy enough to implement is a "spring tab" which I first saw
> > in Borland's Sprint word processor eons ago. (I realize I'm
> > crossing domains, but I think the idea applies readily.) The
> > notion of a spring tab is that it exerts equal force on each
> > side to separate things.
>
> > If you juxtapose spring tabs, they act as though there is a
> > zero space, invisible widget between them. Thus,
> > <ST><ST>widget<ST> puts the widget 2/3 of the way across the
> > horizontal extent.
>
> Why 2/3 if there's four widgets?

I never said a spring tab was a widget. Call it and treat it how you like. It merely consumes space, though in a layout mode, were there a GUI editor, they would be visible.

Why 2/3?

   |<oooooooooooo><oooooooooooo><widget><oooooooooooo>|

All spring tabs exert the same space-consuming force, so they divide the available space evenly among them. Thus, each spring tab consumes (width - widget.width)/N of the space. (Extend accordingly when there are more widgets in the "line.")

The center of the widget is, thus, 2/3 of the way across the available width.

> > Anyway, the idea is that they are relatively trivial widgets
> > that can be assembled together quickly to get a reasonable
> > arrangement that adapts as a window is resized. Perhaps
> > that's a tool to include in your library.
>
> Probably. But I wanted something more generic. Maybe the
> proportion can be assigned.

You could do that, but the simplicity of a spring tab is expressed in the formula shown above. There's no need to indicate the relative strength of any; just add more where needed to effect the needed alignment.

> Also vertical springs are needed.

Undoubtedly.

> And I'm not sure I want it to be a widget. It doesn't have most
> operations a window has. It only occupies space.

I never called it a widget. As you say, it only occupies space.

> And what happens if two widgets are side-by-side to a spring.
> Should it press both?

Yes:

   |<ooooooooooooooo><widget><widget><ooooooooooooooo>|

The pair is centered by surrounding the pair with spring tabs.

> Do we link springs with widgets?

I don't understand the question, but I'm hoping you understand the idea better now.

> I see a window as having a depth dimension, should springs
> press work on a layer, or all depths of a window?

I don't know, but I guess it would be layer specific.

_____
Rob Stewart robert.stewart_at_[hidden]
Software Engineer, Core Software using std::disclaimer;
Susquehanna International Group, LLP http://www.sig.com

IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk