Tickit...ignable(3pm)
β¨ Tickit::WidgetRole::Alignable β¨
π NAME π
Tickit::WidgetRole::Alignable β bestie, this is the role that lets your widgets have adjustable alignment π
πΈ DESCRIPTION πΈ
Okay so picture this: you mix this parametric role into a Tickit::Widget subclass, and boom π₯ β now your widget knows how to align its content inside a space that might be bigger than the content itself. Main character behaviour, fr fr. π«Ά
π METHODS π
The way this works is parametric, meaning these methods get generated onto your caller package when you import the module like this:
use Tickit::WidgetRole::Alignable
name => NAME,
style => STYLE,
reshape => RESHAPE;
Now the parameters, bestie β read these carefully π
name => STRINGβ Optional, lowkey. This is the name that gets swapped in for"NAME"in all the generated methods down below. If you don't pass it, it just defaults to'align'. πdir => "h"or"v"β Also optional. This is the direction β horizontal or vertical β that the alignment is representing. It's what gets used to parse symbolic names into fractions. Defaults to'h'if you don't say anything. πreshape => BOOLβ Optional too. If it's true, your widget gets reshaped after the value is set, by calling the"reshape"method. If it's false or justβ¦ absent? Then it only gets redrawn, via the"redraw"method. No reshape, just a lil refresh. β¨
π¦ NAME π¦
$align = $widget->NAME;
Returns the current alignment value. That's it, that's the vibe. π
π
set_NAME π
$widget->set_NAME( $value );
Sets the new alignment value, periodt.
You hand it a value anywhere in the range from 0.0 to 1.0, and that's how the content display gets aligned within the window. π₯
- For vertical direction alignments, you can pass the symbolic values
top,middleandbottominstead of0.0,0.5and1.0respectively. π - For horizontal direction alignments, you can pass the symbolic values
left,centreandrightinstead of0.0,0.5and1.0respectively. πΈ
π§ _NAME_allocation π§
( $before, $alloc, $after ) = $widget->_NAME_allocation( $value, $total );
Returns a list of three integers β yes, three β created by aligning the $value to the given alignment position within the $total. If you wanna know more, go peek at "align" in Tickit::Utils. iykyk π«
β AUTHOR β
Paul Evans <leonerd@leonerd.org.uk> β thank you legend, we stan π
Okay that's the whole page bestie, you're officially aligned (pun absolutely intended π). This was Tickit...ignable(3pm), part of the User Contributed Perl Documentation, running on perl v5.40.0, dated 2024-09-16. Slay, go align something iconic πβ¨π
π¦ where this page comes from
- ubuntu resolute: libtickit-widgets-perl 0.42-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libtickit-widgets-perl 0.42-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms