fltk::PackedGroup Class Reference

Inherits fltk::Group.

List of all members.

Public Member Functions

void layout ()
void spacing (int i)

Detailed Description

Resizes all the child widgets to be the full width and stacks them. All widgets before the resizable() (or all of them if there is no resizable()) are pushed against the top of this widget, all widgets after the resizable() are pushed against the bottom, and the resizable() fills the remaining space. Child widgets that have vertical() true are pushed against the left/right edge.


This is most useful for layout menu/toolbars and work areas in your main window. You can get many layouts with this, except the top widgets always extend to the right edge and the left widgets always extend to the bottom. To change this, put the top or left widgets and resizable in a PackedGroup and nest that inside another one with the bottom and right widgets.

A child widget can change it's size by calling layout() on itself and this will rearrange all other widgets to accomodate the new height.

If resizable is not set, the PackedGroup itself resizes to surround the items, allowing it to be imbedded in a surrounding PackedGroup or ScrollGroup. This only works if all objects are horizontal or all are vertical.

Setting type(PackedGroup::ALL_CHILDREN_VERTICAL) will make it act like all the children have vertical() set.

Member Function Documentation

void PackedGroup::layout ( ) [virtual]

Virtual function to respond to layout_damage(), it should calculate the correct size of this widget and all it's children. This function is called by fltk or by the layout() method in other widgets. User programs should not call it.

A widget is allowed to alter it's own size in a layout() method, to indicate a size that the data will fit in. A parent widget is then expected to rearrange itself to accomodate the new size. This may mean it will move the widget and thus layout() will be called again.

You can look at layout_damage() to find out why this is being called.

The base class redraws the widget.

Reimplemented from fltk::Group.

void PackedGroup::spacing ( int  i) [inline]

Set a fixed-size gap between all the children. This defaults to zero. If you change this in an already-existing one, call relayout().

The documentation for this class was generated from the following files: