'From Cuis 2.4 of 17 June 2010 [latest update: #509] on 2 August 2010 at 10:24:48 am'!

!AlignmentMorph methodsFor: 'construction' stamp: 'jmv 8/2/2010 10:24'!
addInRow: morphs widths: widths leftMargins: leftMargins topOffsets: topOffsets
	"Each morph can have a fixed width, or proportional to row width.
	for each width,
		width = 0 => Use actual morph width
		width < 1, => a fraction of row where widget should end,
		width > 1 => width in pixels."

	| currentFraction currentOffset layout w |
	currentFraction _ 0.0.
	currentOffset _ 0.
	morphs doWithIndex: [ :morph :i |
		layout _ LayoutFrame new.
		layout
			topFraction: 0 offset: (topOffsets at: i);
			bottomFraction: 1 offset: 0.
		currentOffset _ currentOffset + (leftMargins at: i).
		layout
			leftFraction: currentFraction offset: currentOffset.
		w _ widths at: i.
		w = 0
			ifTrue: [ currentOffset _ currentOffset + morph width ]
			ifFalse: [
				w > 1
					ifTrue: [ currentOffset _ currentOffset + w ]
					ifFalse: [
						currentFraction _ w.
						currentOffset _ 0 ]].
		layout rightFraction: currentFraction offset: currentOffset.
		self
			addMorph: morph
			fullFrame: layout ]! !

