## class fltk::Pack

### Class Hierarchy

    fltk::Group
       |
       +----fltk::Pack

### Include Files

    #include <fltk/Pack.h>

### Description

This grouping widget arranges and resizes all of it's children so they are all packed close together and completely fill the widget. This is similar to layout widgets used by TK and some other toolkits.

In the above image the widgets 1,4,7, and 8 have the `fltk::PACK_VERTICAL` bit on in their flags(). The widgets are numbered with the order they were added to the pack.

Each child widget is stretched (ie one of it's dimensions is changed and the other left alone) to completely fill the remaining space on one edge of the pack and placed against all the previous widgets on that edge.

Any widget with the `fltk::PACK_VERTICAL` bit (8) set in the flags() are placed against the left or right edge, otherwise against the top or bottom edge. (If type() of the pack is set to `fltk::Pack::HORIZONTAL` then it will "pack horzontally" which means that all widgets are packed against the left or right edges, whether or not they have `fltk::PACK_VERTICAL` turned on)

All widgets before the resizable() widget are placed against the top and left edge, all widgets after the resizable() widget are placed against the bottom and right edge in backwards order. If the resizable() is not set, all widgets are placed against the top and left edge, and the pack itself resizes to surround them. Such a pack must be imbedded in another pack or be the only child of a window so that this resizing can be used to layout the parent widget.

If any child changes size the pack automatically re-layouts and possibly changes it's own size to accomodate it. If you add, move, remove, hide, or show a child widget, or change the `fltk::PACK_VERTICAL` flag, you should call relayout() on the pack yourself.

The default box is `fltk::FLAT_BOX`. If you set it to something else the border of the box is drawn and the widgets are packed against the inside of this border.

### Methods

- fltk::Pack
- ~Pack
- spacing

#### fltk::Pack::Pack(int x, int y, int w, int h, const char *label = 0)

Creates a new empty fltk::Pack.

#### virtual fltk::Pack::~Pack()

Like all groups, the destructor also deletes all the children. This allows a whole tree to be deleted at once, without having to keep a pointer to all the children in the user code.

#### int fltk::Pack::spacing() const
void fltk::Pack::spacing(int)

Gets or sets the number of extra pixels of blank space that are added between each child widget.