Fl

 view release on metacpan or  search on metacpan

lib/Fl/Tabs.pod  view on Meta::CPAN

class 'Fl::Tabs';
isa 'Fl::Group';
include 'FL/Fl_Tabs.H';

=pod

=head1 NAME

Fl::Tabs - "File Card Tabs" interface widget

=head1 Description

The Fl::Tabs 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.

=for html <center><img src="http://www.fltk.org/doc-1.3/tabs.png" /></center>

A full example of this widget can be found in C<eg/tabs.pl>

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 its 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.

The background area behind and to the right of the tabs is "transparent",
exposing the background detail of the parent. The value of Fl::Tabs->box()
does not affect this area. So if Fl::Tabs is resized by itself without the
parent, force the appropriate parent (visible behind the tabs) to redraw() to
prevent artifacts.

See "L<Resizing Caveats|/"Resizing Caveats>" below on how to keep tab heights
constant. See "L<Callback's Use Of when()|/"Callback's Use Of when()">" on how
to control the details of how clicks invoke the callback().

A typical use of the Fl::Tabs widget:

    my $tabs = Fl::Tabs->new(10, 10, 300, 200);
    my $grp1 = Fl::Group->new(20, 30, 280, 170, 'Tab1');
        # Widgets that go in tab #1
        $grp1->end;
    my $grp2 = Fl::Group->new(20, 30, 280, 170, 'Tab2');
        # Widgets that go in tab #2
        $grp21->end;
    $tabs->end;

=head2 Default Appearance

The appearance of each "tab" is taken from the label() and color() of the
child group corresponding to that "tab" and panel. Where the "tabs" appear
depends on the position and size of the child groups that make up the panels
within the Fl_Tab, i.e. whether there is more space above or below them. The
height of the "tabs" depends on how much free space is available.

=for html <center><img src="http://www.fltk.org/doc-1.3/tabs_default.png" /></center>

=head2 Highlighting The Selected Tab

The selected "tab" can be highlighted further by setting the selection_color()
of the Fl::Tab itself, e.g.

    $tabs = Fl::Tabs->new(...);
    $tabs->selection_color(FL_DARK3);

The result of the above looks like:

=for html <center><img src="http://www.fltk.org/doc-1.3/tabs_selection.png" /></center>

=head2 Uniform Tab and Panel Appearance

In order to have uniform tab and panel appearance, not only must the color()
and selection_color() for each child group be set, but also the
selection_color() of the Fl::Tab itself any time a new "tab" is selected. This
can be achieved within the Fl::Tab callback, e.g.


    use Fl;

    sub myTabsCallback{
        my ($tabs, $data) = @_;
        # When tab changed, make sure it has same color as its group
        $tabs->selection_color( ($tabs->value())->color() );
    }

    #
    my $w = Fl::Window->new(...);



( run in 0.442 second using v1.01-cache-2.11-cpan-99c4e6809bf )