Class Hierarchy
Fl_Group
|
+----Fl_Tabs
Include Files
#include <FL/Fl_Tabs.H>
Description
The Fl_Tabs widget is the "file card tabs"
interface that allows you to put lots and lots of buttons and
switches in a panel, as popularized by many toolkits.

Clicking the tab makes a child visible() by calling
show() on it, and all other children are made invisible
by calling hide() on them. Usually the children are Fl_Group widgets
containing several widgets themselves.
Each child makes a card, and it's label() is printed
on the card tab, including the label font and style. The
selection color of that child is used to color the tab, while
the color of the child determines the background color of the
pane.
The size of the tabs is controlled by the bounding box of the
children (there should be some space between the children and
the edge of the Fl_Tabs), and the tabs may be placed
"inverted" on the bottom, this is determined by which
gap is larger. It is easiest to lay this out in fluid, using the
fluid browser to select each child group and resize them until
the tabs look the way you want them to.
Methods
Creates a new Fl_Tabs widget using the given position, size,
and label string. The default boxtype is FL_THIN_UP_BOX.
Use add(Fl_Widget
*) to add each child, which are usually
Fl_Group widgets. The children should be sized to stay
away from the top or bottom edge of the Fl_Tabs widget,
which is where the tabs will be drawn.
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_Tabs and all of it's children
can be automatic (local) variables, but you must declare the
Fl_Tabs widget first so that it is destroyed
last.
Gets or sets the currently visible widget/tab.
From blacklight, 12:31 Sep 19, 2008 (score=3)
There was no .cxx example of tabs in the test folder (only fluid), so I didn't quite know where to start.
Here is an example I got running. It demonstrates the basic usage of Fl_Tabs in fltk1.1.x
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Box.H>
#include <FL/Fl_Tabs.H>
#include <FL/Fl_Group.H>
int main(int argc, char ** argv)
{
Fl_Window *window = new Fl_Window(550, 300);
{
Fl_Tabs* o = new Fl_Tabs(0, 0, 545, 150);
{ Fl_Group* o = new Fl_Group(0, 20, 540, 125, "tab1");
{
Fl_Box *box1 = new Fl_Box(50, 40, 70, 20,"box1");//x,y,w,h
}
o->end();
}
{ Fl_Group* o = new Fl_Group(0, 20, 540, 125, "tab2");
o->hide();
{
Fl_Box *box2 = new Fl_Box(50, 40, 70, 20,"box2");//x,y,w,h
}
o->end();
}
o->end();
}
window->end();
window->show(argc, argv);
return(Fl::run());
}
[ Reply ] |