[squeak-dev] A LayoutPolicy for non-formulaic layouts

tim Rowledge tim at rowledge.org
Thu Mar 13 00:56:54 UTC 2014


Currently there are three morphic layout polices; TableLayout, ProportionalLayout and nil. Table & Proportional do formula based laying out and nil just leaves each morph where its position put it.

For various reasons I need a policy that can be more morph specific, without wanting to go overboard with sophisticated gew-gaws. So I implemented (well honestly it’s a bit of a stretch to call a subclass with one method implementing, but there y’go) ‘DelegatedLayout’ which is a singleton class that just passes the #layout:in: message off to the morph that is the first argument by sending it  #fixUpLayoutIn: {the second argument}. My morphs (that need this policy) then just implement #layoutPolicy to return `DelegatedLayout new`, which returns the singleton instance. After that, they are integrated into the whole #fullBounds/#doLayoutIn: system of updating. I’ve had so very much fun debugging the side-effects of this change, finding an amazing number of recursions and other semantic infelicities.

One could of course go for a parameterised version where the selector is set by the user but I think that may be going too far. 

If anyone is interested in the idea I’m happy to stick it into the general trunk but I thought I’d
a) see if it has any attraction
b) see if anyone has clever improvements
before just doing it.

tim
--
tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
Strange OpCodes: DST: Deadlock System Tables




More information about the Squeak-dev mailing list