Tickit...chText(3pm)

πŸ“¦
version 0.33 Β· 5 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

πŸ’– NAME πŸ’–

Tickit::Widget::Scroller::Item::RichText β€” static text, but make it ✨fashion✨ (aka with render attributes)

okay bestie, real talk: this is the glow-up edition of scroller text. Same vibe, extra sparkle. Let's get into it 🫢


🌸 SYNOPSIS 🌸

use Tickit::Widget::Scroller;
use Tickit::Widget::Scroller::Item::RichText;
use String::Tagged;

my $str = String::Tagged->new( "An important message" );
$str->apply_tag( 3, 9, b => 1 );

my $scroller = Tickit::Widget::Scroller->new;

$scroller->push(
   Tickit::Widget::Scroller::Item::RichText->new( $str )
);

like, look at her go πŸ’… you build a String::Tagged, tag a lil slice of it, yeet it into the scroller, done. no cap.


πŸ¦‹ DESCRIPTION πŸ¦‹

So this class is a subclass of Tickit::Widget::Scroller::Item::Text, and what it does is draw static text with rendering attributes β€” basically formatting, the whole point, the moment. πŸ’–

Where do those attributes live? Not in vibes. They're stored by handing the text over inside an instance of a String::Tagged object. That's the whole delivery mechanism, periodt.

The attributes it recognises are the attributes of Tickit::Pen β€” same names, same values, no remixing, no rebranding. And if what you've actually got on your hands is a String::Tagged::Formatting instance instead? Then babe, you want the new_from_formatting constructor. Different door, same house πŸšͺ✨


πŸŽ€ CONSTRUCTOR πŸŽ€

new_from_formatting

$item = Tickit::Widget::Scroller::Item::RichText->new_from_formatting( $str, %opts )

Constructs a brand new item holding the text given by that String::Tagged instance β€” and the slay part is that it converts the tags from the String::Tagged::Formatting convention over into native Tickit::Pen format. Translation service, but make it text rendering 🧚


πŸ‘‘ AUTHOR πŸ‘‘

Paul Evans <leonerd@leonerd.org.uk> β€” the icon who wrote this. we stan. 🫢


and that's the whole page, bestie β€” written by Paul Evans, shipped in perl v5.38.2, dated 2024-08-10, and documented under User Contributed Perl Documentation. mwah πŸ’‹ go tag some text πŸ’œ

πŸ“¦ where this page comes from