Fl::Group - The FLTK Container Widget
my $group = Fl::Group->new(100, 200, 340, 180); $group->begin(); # Create new widgets here $group->end();
Fl::Group is the FLTK container widget.
It maintains an array of child widgets. These children can themselves be any widget including Fl::Group. The most important subclass of Fl::Group is Fl::Window, however groups can also be used to control radio buttons or to enforce resize behavior.
The tab and arrow keys are used to move the focus between widgets of this group, and to other groups. The only modifier grabbed is shift (for shift-tab), so that ctrl-tab, alt-up, and such are free for the app to use as shortcuts.
Fl::Group is a subclass of Fl::Widget but also supports these methods:
The constructor creates a group of a given size and position on screen or within the parent.
my $group_a = Fl::Group->new(100, 150, 300, 500);
my $group_b = Fl::Group->new(100, 150, 300, 500, 'Math is singular');
In these examples, the new group is placed 100 pixels from the left and 150 pixels down from the top of either the display area or parent widget.
The destructor also deletes all children. This allows a whole tree to be deleted at once, without having to keep a pointer to all children in the user code.
my $button = Fl::Button->new(...); $group->add($button);
Adds a widget to the end of this group. If the widget already has a parent, it is first removed from that parent.
my $button = Fl::Button->new(...); $group->add_resizable($button);
Adds the widget to the group and makes it the resizable widget.
Sets the current group so youcan build the widget tree by just constructing the widgets.
$group_a->begin(); Fl::Box->new(100, 75); # Automatically added to $group_a
begin() is automatically called by the constructor for Fl::Group (and thus Fl::Window as well). <begin()> is exactly the same as
Fl::current(...). Don't gorget to
end() the group or window!
Returns how many child widgets the group has.
my $kid = $group->child(1);
Returns the N'th child of the group. Please not that no index checks are made.
Deletes all child widgets from memory recursively.
This method differs from the
remove() method in that it affects all child widgets and deletes them from memory.
The resizable widget defines the resizing box for the group.
When the group is resized, it calculates a new size and position for all of its children. Widgets that rae horizontally or vertically inside the dimensions of the box are scaled to the new size. Widgets outside othe box are moved.In these examples, the gray area is the resizable:
The resizable may be set to the group itself, in which case all the contents are resized. This is the default value for Fl::Group, although undef is the default for Fl::Window and Fl::Pack.
If the resizable is undef then all widgets remain a fixed size and distance from the top-left corner.
It is possible to achieve any type of resize behavior by using an invisible Fl::Box as the resizable and/or by using a hierarchy of child Fl::Group's.
Any new widgets added to the widget tree will be added to the parent of the group.
Copyright (C) Sanko Robinson.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Sanko Robinson <email@example.com>