Hi all, On 5 May 2008, at 07:42, Per Inge Mathisen wrote: > On Sun, May 4, 2008 at 11:49 PM, Freddie Witherden > <[EMAIL PROTECTED]> wrote: >> The problem: we need a way for child widgets to position themselves >> within their parents. We do not want to use pixel co-ordinates and >> need the system to be flexible. > > My suggestion is simply to make it snap to another widget (not > necessarily a parent, could be a sibling), and then provide an (x, y) > constant offset from it in pixel independent values (millimeters?).
Seems good. So we could say something like: widgetAdd(parent, child, northSnap, eastSnap, southSnap, westSnap); Where 'snap' is a side of another widget. So to add a child widget to a parent we would do: widgetAdd(parent, child_1, widgetNorth(parent), widgetEast(parent), widgetSouth(parent), widgetWest(parent)); Then if we wanted to add another child widget (child_2), splitting it horizontally we would do: widgetAdd(parent, child_2, widgetSouth(child_1), widgetEast(parent), widgetSouth(parent), widgetWest(parent)); So we are making the north side of child_2 'touch' the south side of the first child. Saying this, I am still very much open for suggestions. The simpler the better. >> Currently, when a child widget is added to a parent no location- >> related information is passed. Instead there is an arbitration >> process between the parent and the child. Most likely (this is still >> undecided) it will be: the parent asks the child where it would like >> to be and then offers it a location/size. The child will then either >> accept or deny it. The arbitration process continues until *all* >> child widgets are satisfied. > > Sounds complicated. I'd rather not worry about negotiation loops when > adding widgets. On what grounds could a child refuse a location? Take a label widget for example, lets say it has worked out it needs to be *at least* 150 pixels large. We add it to a parent container, which has say, 120 pixels free. The parent offers it 120 pixels. This, however, is too small, so the child would refuse. At this point the parent would have a go at reducing the size of other child widgets, offering the additional space to the label. >> Furthermore how should the size be done? Should widgets have a min/ >> max/desired size? How can we have it so that a widget will fill >> up as >> much space as possible? > > I would suggest specifying size exactly using a pixel independent > value (millimeter? permille of screen size?). On Linux this would work. This is because X computes the screen DPI on the fly. So a piece of 12pt text will be the same size on *all* linux systems. Windows assumes a DPI of 96, while OS X assumes one of 72. Therefore a 10mm line on Windows/OS X will be smaller on a 20" screen than on a 15" one. Regards, Freddie. _______________________________________________ Warzone-dev mailing list Warzone-dev@gna.org https://mail.gna.org/listinfo/warzone-dev