In order to incorporate minimum size constraints, the following fields are added into the WindowNode:
Basically for each window users can specify a minimum width and height. However, due to the nested hierarchy of windows, the calculated minimum width and height may be larger than user specified minimums. Minimum size constraints for a hierarchy of windows is calculated by the UpdateMinSize function as shown below.
UpdateMinSize function initially checks if the window is a packed window. In that case calculated minimum width and height are set to fixed values. Otherwise, UpdateMinSize is recursively called for each children and calculated minimum values are stored in an array. Depending on the type of the window either the sum or the maximum of these values are taken and compared to the user specified minimum values. The calculated minimum values are then assigned to the greater of them.
The UpdateMinSize function is called after each window operation to ensure that new minimum size constraints are calculated. However, a change to the PropagateChanges function is also necessary to enforce these constraints. Basically, this update checks whether the minimum size constraints are satisfied before propagating changes to the child windows.
The modified PropagateChanges function first checks for each
child window whether the calculated minimum sizes are larger than the
new size of the window. In that case the calculated minimum size is
reduced from the the total length of the partition (PWidth),
thus guaranteeing the minimum size for the children window. Such
windows are also marked as failed to satisfy minimum size constraints
for later use. When at the end PWidth turns out to be less than
0, it means that all constraints cannot be satisfied and an error is
issued. Otherwise, Position array is updated where packed child
windows get a fixed size, windows that do not satisfy the minimum size
constraint get their guaranteed minimum size, and the rest of the
space is proportionally distributed to the remaining windows. Finally,
the effects are propagated to lower level windows. Since minimum size
constraints are calculated before calling the PropagateChanges
function, lower level windows can not violate the constraints. The
pseudo-code algorithms for both the modified propagate changes and the
update minimum size (UpdateMinSize) are listed in
Appendix .