Tickit...tainer(3pm)
β¨ NAME β¨
Tickit::WidgetRole::SingleChildContainer β it's a role for widgets that contain a single other widget, bestie π (yes it's a Perl thing, from the User Contributed Perl Documentation collection, iykyk)
πΈ SYNOPSIS πΈ
class Some::Widget::Class
:isa(Tickit::Widget)
:does(Tickit::WidgetRole::SingleChildContainer);
...
That's it. That's the whole vibe. Slap that role on and your widget's whole personality changes β¨
π¦ DESCRIPTION π¦
Okay so here's the tea π β when you apply this role to a subclass of Tickit::Widget, you're lowkey giving it a whole new behaviour: it now acts as a container widget, like a lil basket that holds exactly one child widget inside it. Not two. Not zero. One. Main character container energy π
π METHODS π
π child
$child = $widget->child;
Returns the contained child widget. That's it, that's the method, it just hands you the child π«Ά
π set_child
$widget->set_child( $child );
Sets the child widget, or passes undef to remove it entirely (no child era π).
And here's the iconic part: this method returns the container widget instance itself, which makes it perfect as a chaining mutator. Like, look at this:
my $container = Tickit::SingleChildWidget->new( ... )
->set_child( Tickit::Widget::Static->new( ... ) );
Chain it, stack it, serve it π β¨
π AUTHOR π
Paul Evans <leonerd@leonerd.org.uk> β the legend who wrote this fr fr π
Okay bestie that's the whole page, mwah π β this was lifted from perl v5.40.0, dated 2024-09-16, and honestly? Iconic behaviour from a manpage. Go build something cute with it πΈπ¦π
π¦ 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