NAME

LibUI::VBox - Vertically Oriented Boxlike Container that Holds a Group of Controls

SYNOPSIS

use LibUI ':all';
use LibUI::VBox;
use LibUI::Window;
use LibUI::ColorButton;
use LibUI::Label;
Init && die;
my $window = LibUI::Window->new( 'Hi', 320, 100, 0 );
$window->setMargined( 1 );
my $box    = LibUI::VBox->new;
my $lbl    = LibUI::Label->new('Pick a color');
my $cbtn   = LibUI::ColorButton->new();
$cbtn->onChanged(
    sub {
        my @rgba = $cbtn->color();
        $lbl->setText(
            sprintf "#%02X%02X%02X%02X\nrgba(%d, %d, %d, %.2f)",
            ( map { $_ * 255 } @rgba ),
            ( map { $_ * 255 } @rgba[ 0 .. 2 ] ),
            $rgba[-1]
        );
    },
    undef
);
$box->setPadded(1);
$box->append( $cbtn, 1 );
$box->append( $lbl,  1 );
$window->setChild($box);
$window->onClosing(
    sub {
        Quit();
        return 1;
    },
    undef
);
$window->show;
Main();

DESCRIPTION

A LibUI::VBox object represents a boxlike container that holds a group of controls.

The contained controls are arranged to be displayed vertically on top of each other.

Functions

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

new( ... )

my $box = LibUI::VBox->new( );

Creates a new LibUI::VBox.

append( ... )

$box->append( $lbl, 1 );

Appends a control to the box.

Expected parameters include:

$child - LibUI::Control instance to append
$stretchy - true to stretch control, otherwise false

Stretchy items expand to use the remaining space within the box. In the case of multiple stretchy items the space is shared equally.

delete( ... )

$box->delete( $index );

Removes the control at $index from the box.

Note: The control is neither destroyed nor freed.

numChildren( )

my $tally = $box->numChildren( );

Returns the number of controls contained within the box.

padded( )

if( $box->padded ) {
    ...;
}

Returns whether or not controls within the box are padded.

Padding is defined as space between individual controls.

setPadded( ... )

$box->setPadded( 1 );

Sets whether or not controls within the box are padded.

Padding is defined as space between individual controls. The padding size is determined by the OS defaults.

See Also

LibUI::HBox for a horizontally oriented box.

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>