Tickit...::Item(3pm)

๐Ÿ“ฆ
version 0.33 ยท 5 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

โœจ Tickit::Widget::Scroller::Item ๐Ÿ’…

okay bestie, so this is the User Contributed Perl Documentation page for Tickit::Widget::Scroller::Item, and honestly? it's giving interface royalty. pull up a chair ๐Ÿซถ


๐ŸŒธ NAME ๐ŸŒธ

Tickit::Widget::Scroller::Item โ€” the interface for renderable scroller items, no cap ๐Ÿ’–


๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

So here's the tea, bestie: if you wanna add items to a Tickit::Widget::Scroller, those items have got to follow the interface documented right here. That's the whole vibe. Not optional. It's the contract, and the contract ate. ๐Ÿ‘‘


๐ŸŽ€ METHODS ๐ŸŽ€

โœจ height_for_width โœจ

$height = $item->height_for_width( $width )

She tells you how many screen lines the item would take up if you rendered it at that given width. That's it. That's the method. predictive queen behavior ๐Ÿ”ฎ


๐Ÿ’… render ๐Ÿ’…

$item->render( $rb, %args )

Renders the item onto the given Tickit::RenderBuffer. and %args? bestie, %args is bringing the following keys to the function ๐Ÿ‘‡

  • firstline => INT, lastline => INT โ€” these are the inclusive bounds of the line numbers you're rendering. and listen: if they don't cover the entire height of the item, that lowkey means clipping is about to happen, so the item only needs to draw the lines that were indicated. no need to do extra credit. ๐Ÿ™ˆ
ngl, these two are passed along for informational purposes only. Item implementations are totally free to ignore them if they want to, because the clipping itself gets performed by the RenderBuffer. it's handled. chill. ๐Ÿ’†
  • top => INT โ€” the line of $rc to consider as the top of the item. this one is passed for legacy purposes and will always be zero, fr fr. Item implementations are free to ignore this value too, because it's now performed using the translate facility of the RenderBuffer. the way that legacy parameter is just... sitting there being zero ๐Ÿ˜ญ iconic honestly.
  • width => INT, height => INT โ€” the width in columns and the height in lines to render the item. these correspond to the most recent call to height_for_width, and they're passed in for consistency and convenience of the item's render method. and important bestie: this is given as the full dimensions of the item, which may be bigger than the subset of lines requested by the firstline and lastline parameters. so don't get it twisted โ€” full dimensions means full dimensions. ๐Ÿ“โœจ

๐Ÿ‘‘ AUTHOR ๐Ÿ‘‘

Paul Evans <leonerd@leonerd.org.uk> โ€” the icon, the legend, the moment. ๐Ÿ’œ


okay and for the cute sign-off: this little masterpiece is running on perl v5.38.2, dated 2024-08-10, and it lives its best life as part of the Tickit::Widget::Scroller::Item(3pm) manual. go render something gorgeous, bestie ๐Ÿฆ‹๐ŸŒธ๐Ÿ’– periodt.

๐Ÿ“ฆ where this page comes from