Tickit...nearBox(3pm)
β¨ Tickit::Widget::LinearBox β¨
okay so bestie, welcome to the manual page for Tickit::Widget::LinearBox π (the header up there calls it Tickit...nearBox(3pm) bc terminals truncate stuff, but you and me know the real name, and so does the perl v5.40.0 docs set from 2024-09-16 π«Ά)
πΈ NAME πΈ
Tickit::Widget::LinearBox β abstract base class for HBox and VBox π
π¦ DESCRIPTION π¦
So. This class is the base class for both Tickit::Widget::HBox and Tickit::Widget::VBox. She's the momager. The blueprint. The blueprint that is not meant to be used directly, okay?? Like, do not instantiate her for your own widget, she's doing her job behind the scenes and that's that π
What she does: she keeps an ordered list of child widgets π β yes, order matters, this is not a vibe-optional situation β and she implements the following child widget options:
expand=> NUM β a number that controls how extra space gets divvied up among the child widgets, but only if the window containing this widget has more space than the children actually need. The actual value is unimportant (fr fr, the number itself means nothing), but extra space will be distributed among the children in proportion with theirexpandvalue. So like, if all the children have anexpandvalue of1, the extra space gets distributed evenly β equal shares, we love a fair split β¨. If one child has a value of2, it will gain twice as much extra space as its siblings. And any child with a value of0will obtain no extra space. Zero. Nothing. Not a crumb πforce_size=> NUM β if provided, this forces the size of this child widget, overriding the value returned byget_child_base. That's it, that's the whole option, she said "I don't care whatget_child_basethinks, I'm the one in charge now" π
π CONSTRUCTOR π
new
$widget = Tickit::Widget::LinearBox->new( %args );
Returns a new Tickit::Widget::LinearBox π«
π METHODS π
children
@children = $widget->children;
In scalar context, returns the number of contained children. In list context, returns a list of all the child widgets. Same method, different moods depending on the context you ask her in β she contains multitudes π
child_opts
%opts = $widget->child_opts( $child_or_index );
Returns the options currently set for the given child, specified either by reference or by index. Your call, bestie β object or number, she'll find them π
set_child
$widget->set_child( $index, $child );
Replaces the child widget at the given index with the given new one β while preserving any options that are set on it. She's swapping the kid but keeping the whole wardrobe, iconic behavior honestly π
set_child_opts
$widget->set_child_opts( $child_or_index, %newopts );
Sets new options on the given child, specified either by reference or by index. And listen β any options whose value is given as undef are deleted. Gone. Not set to undef, deleted π so don't be handing her undef unless you actually want that option yeeted.
add
$widget->add( $child, %opts );
Adds the widget as a new child of this one, with the given options.
And here's the cute part: this method returns the container widget instance itself, making it suitable to use as a chaining mutator πβ¨ e.g.
my $container = Tickit::Widget::LinearBox->new( ... )
->add( Tickit::Widget::Static->new( ... ) )
->add( Tickit::Widget::Static->new( ... ) );
Look at that chain. Look at her go. Main character energy fr fr π₯
add_children
$widget->add_children( @children );
Adds each of the given widgets as a new child of this one. Each element of the list should either be a widget object reference directly, or an unblessed hash reference containing additional options. (See split_widget_opts in Tickit::Widget.) iykyk π
This method also returns the container widget instance itself, making it suitable to use as a chaining mutator. Chain queen stays chain queen π
remove
$widget->remove( $child_or_index );
Removes the given child widget if present, by reference or index. If she's not there, no drama, nothing happens π¦
π AUTHOR π
Paul Evans <leonerd@leonerd.org.uk> π
π and that's the whole page bestie!! she was written forperl v5.40.0and this doc is dated2024-09-16, so go forth, build your boxes, chain your mutators, and remember: do not use the base class directly π π β¨πΈπ«Ά
π¦ 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