NAME

LibUI::Group - Control Container that Adds a Label to the Contained Child Control

SYNOPSIS

use LibUI ':all';
use LibUI::Group;
use LibUI::HBox;
use LibUI::Window;
use LibUI::ColorButton;
use LibUI::Label;
Init && die;
my $window = LibUI::Window->new( 'Hi', 320, 100, 0 );
$window->setMargined( 1 );
my $group  = LibUI::Group->new('Color Pickers');
my $box    = LibUI::HBox->new;
my $cbtn_l = LibUI::ColorButton->new();
my $cbtn_r = LibUI::ColorButton->new();
sub colorChanged {
    warn sprintf '#%02X%02X%02X%02X', map { $_ * 255 } shift->color();
}
$cbtn_l->onChanged( \&colorChanged, $cbtn_l );
$cbtn_r->onChanged( \&colorChanged, $cbtn_r );
$box->append( $_, 1 ) for $cbtn_l, $cbtn_r;
$group->setChild($box);
$window->setChild($group);
$window->onClosing(
    sub {
        Quit();
        return 1;
    },
    undef
);
$window->show;
Main();

DESCRIPTION

A LibUI::Group object represents a control container that adds a label to the contained child control.

This control is a great way of grouping related controls in combination with LibUI::HBox and LibUI::VBox.

A visual box will or will not be drawn around the child control dependent on the underlying OS implementation.

Functions

Not a lot here but... well, it's just a tab box.

new( ... )

my $grp = LibUI::Group->new( 'Login' );

Creates a new LibUI::Group.

margined( )

if( $grp->margined( ) ) {
    ...;
}

Returns whether or not the group has a margin.

setMargined( ... )

$grp->setMargined( 1 );

Sets whether or not the group has a margin.

The margin size is determined by the OS defaults.

Expected parameters include:

$margin - boolean value

setChild( ... )

$grp->append( $box );

Sets the group's child.

Expected parameters include:

$child - LibUI::Control instance

delete( ... )

$grp->delete( $index );

Removes the control at $index.

Note: The control is neither destroyed nor freed.

title( )

my $text = $grp->title( );

Returns the group title.

setTitle( ... )

$grp->setTitle( $text . '*' );

Sets the group title.

LICENSE

Copyright (C) Sanko Robinson.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

Sanko Robinson <sanko@cpan.org>