== Resizing ==

* goals:
  * box layout containers:
    * fit content on one dimension, full width/height on another
      * example: accordions
    * even/fraction divide
      * strict or lenient?
      * example: menu screens
    * rubber table?
    * scroller - can take any size, can fit any size
    * proportional resizer (takes any size, stretches while preserving proportion of one child)?
      * example: main menu buttons

* a minimum root window size (640x480), to avoid ridiculous layout issues
  * we could let content of all windows dictate minimum size, but added controls could no longer fit
* shrink resizes might fail?
  * binary search for minimum acceptable size?

* resize events:
  * inbound (container resize, e.g. due to resolution change)
  * outbound, when container fits content
    * e.g. expanding a collapsed box inside an accordion
    * only inside scrollable containers?
  * an inbound event shouldn't result in an outbound event

* inbound resize event:
  * pass recommended size


problem:
- box that takes at most 100px







inbound:
 * resize REQUESTS - they pass size recommendations, but controls may or may not resize themselves

outbound:
 * the size changed, so notify parent to rearrange children


methods:
 * arrange() [protected]
   * calculate recommended sizes
   * for each child:
     * call child.fit(recommendedSize)
       * a recommended size of 0 (on an axis) means to use minimum space
     * query and use real child size
   * iterate, as needed
   * set own size
 * rearrange() [final]           <- upwards
   * arrange()
   * if size changed, call parent.rearrange()
 * fit(recommendedSize)          <- downwards
   * set size to recommended or whatever
   * arrange()

controls:
 * fixed: fixed size, fill or ??? inner
 * centered: fill outer, fill or center inner

 Null: pass recommendedSize to child; use child dimensions
 SizeW/H: pass given W/H instead of recommendedSize to child, use child dimensions
 ShrinkW/H: pass 0 instead of recommendedSize to child, use child dimensions
 CenterW/H: pass recommendedSize to child; if child is sized smaller than our size, center it; use recommendedSize if it is > child's size
 PaddingW/H: pass recommendedSize - 2*given size to child; use child dimensions + 2*padding

 Table:
  - Take a 2D dyn array of controls
  - Use dummy SpanAbove and SpanLeft types to indicate spans
  - Arranging:
    - First, probe using 0x0 recommendedSize, to query the cells' minimal size
    - Stretch any extra remaining space among cells proportionally to their minimal size
    - If a cell does not use the newly-allocated space, redistribute remaining space among remaining rows/columns
      This allows creating fixed-size rows/columns while stretching others.
  Row / Column: 1D table

alternative:
 * arrange method
   * arrange children, set size
 * sizeChanged method (bool outwards)
   * arrange
   * if size changed && outwards
     * parent.sizeChanged

self resize:
 * parent.rearrange()
 * parent will call .fit(allocatedSize)

--------------------------------------------------

Qt:
 * size hint, minimum size hint
 * size policy:
   - horizontal and vertical, with a flag that controls if it's proportional
   - one direction's policy:
     - can it shrink?
     - can it grow?
     - should it grow?
