NAME
LibUI::HBox - Horizontally Oriented Boxlike Container that Holds a Group of Controls
SYNOPSIS
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
$box
= LibUI::HBox->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::HBox object represents a boxlike container that holds a group of controls.
The contained controls are arranged to be displayed horizontally next to each other.
Functions
Not a lot here but... well, it's just a box.
new( ... )
my
$box
= LibUI::HBox->new( );
Creates a new LibUI::HBox.
append( ... )
$box
->append(
$lbl
, 1 );
Appends a control to the box.
Expected parameters include:
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::VBox for a vertically 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>