Class Hierarchy
Fl_Widget
|
+----Fl_Group
|
+----Fl_Pack, Fl_Scroll, Fl_Tabs, Fl_Tile, Fl_Window
Include Files
#include <FL/Fl_Group.H>
Description
The Fl_Group class 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.
Methods
Creates a new Fl_Group widget using the given position, size, and
label string. The default boxtype is FL_NO_BOX.
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. A kludge has been done so the
Fl_Group and all of it's children can be automatic (local)
variables, but you must declare the Fl_Group first, so
that it is destroyed last.
Adds a widget to the group at the end of the child array.
Adds a widget to the group and makes it the resizable widget.
Returns a pointer to the array of children. This pointer can change
when children are added or removed!
begin() sets the current group so you can build the widget tree
by just constructing the widgets. begin() is automatically called by
the constructor for Fl_Group (and thus for Fl_Window as well).
begin() does current(this).
Don't forget to end() the group or window!
Returns child n, where 0 <= n < children().
Returns how many child widgets the group has.
current() returns the currently active group in the widget tree.
To prevent widgets from being added to a group, call current()
with a NULL group.
end() does current(this->parent()). Any new widgets added
to the widget tree will be added to the parent of the group.
Searches the child array for the widget and returns the index. Returns
children() if the widget is
NULL or not found.
Inserts a widget into the child array. It is put at index n which
must be less or equal to children(). The second version does a
find(beforethis) and inserts using that index.
Removes a widget from the group. This does nothing if the widget
is not currently a child of this group.
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 are horizontally or vertically inside the dimensions
of the box are scaled to the new size. Widgets outside the box are moved.
In these examples the gray area is the resizable:
The resizable may be set to the group itself (this is the default value
for an Fl_Group, although NULL is the default for an
Fl_Window), in which case all the contents are resized. If the
resizable is NULL 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.