2010/11/8 Igor Stasenko <[email protected]> > On 7 November 2010 22:38, Schwab,Wilhelm K <[email protected]> wrote: > > Sig, > > > > I disagree; the layout policy should arrange the morphs it controls. To > do otherwise demands that the morphs be able to cope with any type of layout > one might want. The various algorithms have to go somewhere; they might as > well go in the layouts. > > > > Some layouts, like table, indeed requiring a cooperation between > container morph and its submorphs. > > But still, i think that it should be based on a simple things: > - morph should have a single layout command: lay within certain > bounds. It doesn't matters where these bounds came from or how they > are calculated. > > Then child morph could decide for itself how to lay within given > bounds (like fill whole area or align to botton or top etc etc), and > avoid querying parent morph or layout policy/whatever to determine own > bounds, unless, of course it also having submorphs and own layout > policy. > > So, if parent morph having no layout policy, it will simply pass its > own bounds to submoprhs. > And if parent having , say table layout policy, then it will calculate > table cells and pass each cell bounds to each submorph for given cell.
and yes, implementing this stuff is always harder than just talking about it > :) > I remember interesting design for layout logic in newspeak Brazil framefork. http://blog.3plus4.org/2008/11/23/brazil-example-a-classic-smalltalk-browser/ See part about "area" concept
