"Resizer" is library for Win32Lib which will help you manage resizing windows.
Philosophy behind is that windows are placed in rows.
Windows can only be positioned in rows and columns.
(this is what is almost allways needed anyway).
no strange positioning of windows is possible.

It's not as powerful as xControls.ew but it's a lot simpler.

Normally you'd use it like this: call resizer () and run your program
to see which things need to be tweaked with rsSet ().

Automatic defining windows width and height:
Sizes for some controls are automatically set, like
buttons, combos, labels, ... Sizes of other controls
are set so that they fill whole parent window, in percentage,
if their width and height is 0, else they are left as they were.
Ofcourse you can define custom behavior for each control individually.


By Tone koda
Release Date: 5.Feb 2005


Contest:
1. ALL GLOBAL ROUTINES
2. KNOWN PROBLEMS



**************************************************************************
1. ALL GLOBAL ROUTINES:
**************************************************************************


procedure resizer (integer parentWin, sequence childrenRows)
    Defines how will child windows be arranged in rows.
    Windows in "childrenRows" should be children of "parentWin".
    Example:
        resizer (parentWin, {
	        {win1, win2},
	        {win3, win4}
            })
        resizer (win4, {
            {win5},
            {win6, win7}
            })


procedure rsSet (object child, integer property, object val)
    Sets a property of child window.
    "child": one of the windows which was included in "childrenRows" in "resizer()"
    It can be a sequence of windows.
    - "property" must be one of these:
        - RS_HALIGN: horizontal alignment of window in row
	        - "value":
	            - RS_LEFT
	            - RS_CENTER
	            - RS_RIGHT
        - RS_VALIGN: vertical alignment of window in row
	        - "value":
	            - RS_TOP
	            - RS_CENTER
	            - RS_BOTTOM
        - RS_WIDTH: width of window.
            - "value":
                Percent (atom) or constant width (integer) or a flag (see below).
                If percent then it's of row's width, ie of parent's width,
                and it doesn't need to be under 1.0 because relations between percents
                is what is looked at. For 100% use 0.99999 because 1.0 is integer not atom.
                Flags:
                - RS_FITTOTEXT: fit to window's text, both width and height
                - RS_LEAVE: leave as it is    
        - RS_HEIGHT: height of window.
            - "value":
                Same as RS_WIDTH plus:
                - RS_FITTOTEXTHEIGHT
                - RS_FITTOROW
        - RS_WIDHEI: width and height of window.
        - RS_LEFTSPACE: space that exists between this window and window left of it in row.
            - "value": constant (integer).
        - RS_RIGHTSPACE: space that exists between this window and window right of it in row.
            - "value": constant (integer).
        - RS_TOPSPACE: space that exists between this window's row and row above it.
            - "value": constant (integer).
        - RS_BOTTOMSPACE: space that exists between this window's row and row below it.
            - "value": constant (integer).
        - RS_ALL4SPACES: space that is on all four sides of window.
            - "value": constant (integer).
    Example:
    rsSet (win1, RS_WIDTH, 0.3)


function rsGet (integer childWin, integer property)
    Returns property value, error message box is displayed if could not get value.
    "childWin", "property": same as in rsSet().    
    Example:
    widthProp = rsGet (win1, RS_WIDTH)


procedure rsSetGlobal (integer option, object val, sequence params)
    Sets a global option for resizer.
    - "option" must be one of these:
        - RS_DEFSPACE: default spacing between windows and rows.
            - "val" should be integer.
            - "params" should be {}, is ignored.
    - "params" is some additional info and depends on "option".
    Example:
    rsSetGlobal (RS_DEFSPACE, 10, {})


function rsGetGlobal (integer option)
    Gets a global option for resizer.
    "option": same as in rsSetGlobal()
    Example:
    defSpace = rsGetGlobal (RS_DEFSPACE)


procedure rsResizeNow (integer parentWin)
    Forces that children of window are resized immediately.



UTILITY ROUTINES:


function getChildrenBoundingRect (integer id)
    Gets rectangle into which fit children of id.
    Returns {rect, extremeWins}
    rect is {left, top, right, bottom}
    Independent.


function getChildrenBoundingSize (integer id)
    Gets rectangle into which fit children of id.
    Returns {width, height}.    
    Also adds some needed space if "id" is managed with resized.


function fitToChildren (integer id, integer what)
    Resized window to its children.
    It's good to call it after children are already resized,
    like after rsResizeNow ().
    And call this before rsResizeNow():
    rsSet (id, RS_WIDHEI, RS_LEAVE)



**************************************************************************
2. KNOWN PROBLEMS:
**************************************************************************

-   ComboBoxEx is not working properly.
    To get around this create a dummy parent for this combo
    and fitToChildren() this parent and
    rsSet (parent, RS_WIDTH_HEIGHT, RS_LEAVE).
    Only constant width and height of combobex is possible.
    See ResizerTest1.exw.
-   ComboBox: some strange (rare) problems with it.
-   GroupBox: I would have to improve it to auto fit to chidren,
    but it's a little complicated.
-   Toolbar and Rebar don't work yet.
-   Buttons with icons don't work, you have to manually set size for them
    and rsSet (id, RS_WIDHEI, RS_LEAVE).