Tickit::WidgetRole::Alignable - implement widgets with adjustable alignment
Tickit::WidgetRole::Alignable
Mixing this parametric role into a Tickit::Widget subclass adds behaviour to implement alignment of content within a possibly-larger space.
The following methods are provided parametrically on the caller package when the module is imported by
use Tickit::WidgetRole::Alignable name => NAME, style => STYLE
The parameters are
Optional. The name to use for NAME in the following generated methods. Defaults to 'align' if not provided.
NAME
'align'
Optional. The direction, horizontal or vertical, that the alignment represents. Used to parse symbolic names into fractions. Defaults to 'h' if not provided.
'h'
Return the current alignment value
Set the new alignment value
Gives a value in the range from 0.0 to 1.0 to align the content display within the window.
0.0
1.0
For vertical direction alignments, the symbolic values top, middle and bottom can be supplied instead of 0.0, 0.5 and 1.0 respectively.
top
middle
bottom
0.5
For horizontal direction alignments, the symbolic values left, centre and right can be supplied instead of 0.0, 0.5 and 1.0 respectively.
left
centre
right
Returns a list of three integers created by aligning the $value to the given alignment position within the $total. See also align in Tickit::Utils.
$value
$total
align
Paul Evans <leonerd@leonerd.org.uk>
To install Tickit, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Tickit
CPAN shell
perl -MCPAN -e shell install Tickit
For more information on module installation, please visit the detailed CPAN module installation guide.