Utils(3pm)

πŸ“¦ version 2.1.1, in arch rolling

πŸ’… Utils(3pm) β€” Lire::UI::Utils

okay so this is a page from LogReport's Lire Documentation, and it's literally all about Lire::UI::Utils β€” the little helper squad that handles UI management for you 🫢


✨ NAME ✨

Lire::UI::Utils β€” utility functions for UI management. that's it, that's the vibe πŸ’–


🌸 SYNOPSIS 🌸

use Lire::UI::Utils;

bestie just drop that use line in and you're in business ✨


πŸŽ€ DESCRIPTION πŸŽ€

utility functions for UI code, periodt. it's giving "small module, big main character energy" πŸ‘‘


πŸ’… button_box_width( $buttons )

so this one computes the width required to draw the button box described by the 'buttons' parameter. plot twist: that parameter is a hash reference. yes, a hashref. noted. ✨


πŸ¦‹ button_label( $label, $max_button_width )

returns a label suitable for a button, keeping in mind that the maximum width of said button is $max_button_width. it crops accordingly so nobody overflows, no cap πŸ’…


🌈 layout_buttonbox( $container, $box, [ $padleft ], [ $padright ] )

the big one, honestly πŸ”₯ this crops the labels of the Curses::UI::Buttonbox $box until it fits in the canvaswidth() of the $container. $padleft and $padright are optional and you can use them to allow space for padding πŸŽ€

it also sets the '-width' and '-x' attributes of the Buttonbox. in the worst case, labels get reduced to their first letter 😭 (it's giving survival mode).

real talk: the Buttonbox's buttons should have their '-label' attribute set to the full label without any button decorations (like '[') β€” the function adds those itself after cropping. don't pre-decorate, iykyk πŸ™ˆ

πŸ‘€ SEE ALSO πŸ‘€


⭐ VERSION ⭐

$Id: Utils.pm,v 1.7 2006/07/23 13:16:32 vanbaal Exp $

πŸ‘‘ AUTHORS πŸ‘‘

Wolfgang Sourdeau <wolfgang@logreport.org> πŸ’œ


Copyright (C) 2004 Stichting LogReport Foundation LogReport@LogReport.org

This file is part of Lire.

Lire is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program (see COPYING); if not, check with http://www.gnu.org/copyleft/gpl.html.


that's the whole page, bestie πŸ“ slay, go forth and lay out some button boxes πŸ’–

signed off with love β€” Lire 2.1.1, dated 2025-09-28 ✨

πŸ“¦ where this page comes from