class Fl_Group


Class Hierarchy

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

Fl_Group.Fl_Group(int x, int y, int w, int h, str label = "")

Creates a new Fl_Group widget using the given position, size, and label string. The default boxtype is FL_NO_BOX.

Fl_Group.add(Fl_Widget w)

The widget is removed from it's current group (if any) and then added to the end of this group.

Fl_Group.init_sizes()

The Fl_Group widget keeps track of the original widget sizes and positions when resizing occurs so that if you resize a window back to its original size the widgets will be in the correct places. If you rearrange the widgets in your group, call this method to register the new arrangement with the Fl_Group that contains them.

Fl_Group.insert(Fl_Widget w, int n)

The widget is removed from it's current group (if any) and then inserted into this group. It is put at index n (or at the end if n >= children(). This can also be used to rearrange the widgets inside a group.

Fl_Group.insert_before(Fl_Widget w, Fl_Widget beforethis)

This does insert(w, find(beforethis)). This will append the widget if beforethis is not in the group.

Fl_Group.remove(Fl_Widget w)

Removes a widget from the group. This does nothing if the widget is not currently a child of this group.

staticmethod Fl_Group Fl_Group.current()
staticmethod Fl_Group.current(Fl_Group w)

current() returns the currently active group. The Fl_Widget constructor automatically does current().add(widget) if this is not null. To prevent new widgets from being added to a group, call Fl_Group.current(0).

Fl_Group.begin()

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() is exactly the same as current(self).

Don't forget to end() the group or window!

Fl_Group.end()

end() is exactly the same as current(self.parent()). Any new widgets added to the widget tree will be added to the parent of the group.

Fl_Widget[] Fl_Group.array()

Returns a pointer to the array of children. This pointer is only valid until the next time a child is added or removed.

Fl_Widget Fl_Group.child(int n)

Returns array()[n]. No range checking is done!

int Fl_Group.children()

Returns how many child widgets the group has.

int Fl_Group::find(const Fl_Widget w)

Searches the child array for the widget and returns the index. Returns children() if the widget is NULL or not found.

Fl_Group.resizable(Fl_Widget box)
Fl_Widget Fl_Group.resizable()

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.

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.

Fl_Group Fl_Group.add_resizable(Fl_Widget box)

Adds a widget to the group and makes it the resizable widget.