The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

FLTK::PackedGroup - Group that packs all it's child widgets against the edges

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 embedded in a surrounding PackedGroup or ScrollGroup. This only works if all objects are horizontal or all are vertical.

Functions

margin

$packedgroup->margin( $m );

Set the left, right, top, and bottom margins to the same value.

margin_bottom

my $b = $packedgroup->margin_bottom( );

Get the bottom margin for child widgets.

$packedgroup->margin_bottom( $b );

Set the bottom margin for child widgets.

margin_left

my $l = $packedgroup->margin_left( );

Get the left margin for child widgets.

$packedgroup->margin_left( $l );

Set the left margin for child widgets.

margin_right

my $r = $packedgroup->margin_right( );

Get the right margin for child widgets.

$packedgroup->margin_right( $r );

Set the right margin for child widgets.

margin_top

my $t = $packedgroup->margin_top( );

Get the top margin for child widgets.

$packedgroup->margin_top( $t );

Set the top margin for child widgets.

new

my $group = $packedgroup->new( $x, $y, $w, $h, $label, $begin );

Creates a new PackedGroup.

spacing

$packedgroup->spacing( $s );

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

my $s = $packedgroup->spacing( );

Returns the fixed-size gap between all children.

Layout Types

These are the current schemes built into PackedGroup.

  • FLTK::PackedGroup::NORMAL

  • FLTK::PackedGroup::ALL_CHILDREN_VERTICAL

Setting $pg->type(FLTK::PackedGroup::ALL_CHILDREN_VERTICAL) will make it act like all the children have vertical() set.

Author

Sanko Robinson <sanko@cpan.org> - http://sankorobinson.com/

License and Legal

Copyright (C) 2008-2010 by Sanko Robinson <sanko@cpan.org>

This program is free software; you can redistribute it and/or modify it under the terms of The Artistic License 2.0. See the LICENSE file included with this distribution or notes on the Artistic License 2.0 for clarification.

When separated from the distribution, all original POD documentation is covered by the Creative Commons Attribution-Share Alike 3.0 License. See the clarification of the CCA-SA3.0.