SIL.FieldWorks.SharpViews.Box.Relayout C# (CSharp) Method

Relayout() private method

When the contents of a box changes, and its size consequently might change, something needs to be done about the layout of that box and all its containers. The process begins by constructing a FixupMap, which contains the changed box and all its parents, each recording (against the box as a key) the invalidate rectangle appropriate to the old box layout. We then pass this to the Relayout method of the root box. By default, any box which finds itself in the map, or which has never been laid out (its height is zero), does a full normal layout, and invalidates its old (if any) rectangle. It can't invalidate its new rectangle, because at the point where relayout is called, the parent box may not have finalized the new position of the child... so return true if the parent needs to invalidate the new position. Relayout should not be used in cases where the available width may have changed, as this could affect the layout of boxes that are not in the map. Note that, if the box moves, invalidating its new size at its old position, or vice versa, may not do much good. If it moves, the containing box must do appropriate extra invalidating. Some boxes, notably VwDivBox, may not need to relayout all their children, or even to invalidate all their own contents. This can be an important optimization, but must be done with care to ensure that what is actually drawn is always correct.
private Relayout ( LayoutInfo transform, Rectangle>.Dictionary fixupMap, LayoutCallbacks lcb ) : bool
transform LayoutInfo
fixupMap Rectangle>.Dictionary
lcb LayoutCallbacks
return bool
		internal virtual bool Relayout(LayoutInfo transform, Dictionary<Box, Rectangle> fixupMap, LayoutCallbacks lcb)
		{
			if (Height == 0)
			{
				// Never been laid out. Can't need to invalidate, before or after.
				Layout(transform);
				return false;

			}
			Rectangle invalidRect;
			if (fixupMap.TryGetValue(this, out invalidRect))
			{
				lcb.InvalidateInRoot(invalidRect);
				Layout(transform);
				return true;
			}
			// Previously laid-out box unaffected by current events. Do nothing, caller need not invalidate unless moved.
			return false;
		}