Tickit...Ribbon(3pm)
π Tickit::Widget::Tabbed::Ribbon π
okay bestie, so this one's a Perl manual page β User Contributed Perl Documentation, no big deal, just the docs for a lil' Perl module. and the module is...
β¨ NAME β¨
Tickit::Widget::Tabbed::Ribbon β the base class for the Tickit::Widget::Tabbed control ribbon π
πΈ DESCRIPTION πΈ
so like. this class is where the default implementation of the control ribbon for Tickit::Widget::Tabbed lives, AND it doubles as the base class you'd build a custom ribbon on top of. two jobs, main character energy fr fr π
the deets about this class and how it works? genuinely useful to know when you're out here implementing your own custom control ribbon. so don't skip it π
but ngl, if you're just using Tickit::Widget::Tabbed with its default control ribbon? you can fully ignore this class. not your problem, babe π
π¦ CUSTOM RIBBON CLASS π¦
wanna make your own ribbon? slay. here's the vibe:
make a subclass of Tickit::Widget::Tabbed::Ribbon, and give it a constructor that behaves like this π
use Object::Pad;
class Custom::Ribbon::Class :isa(Tickit::Widget::Tabbed::Ribbon);
sub new_for_orientation # note: Not a method
{
my $class = shift;
my ( $orientation, %args ) = @_;
...
}
π notice that # note: Not a method β keep that in mind, it's literally not a method.
ok but alternatively β if you don't do that β then one of two subclasses gets used for the constructor instead, by appending ::horizontal or ::vertical onto the class name. and in that case your custom class should provide those too, bestie:
use Object::Pad;
class Custom::Ribbon::Class
:isa(Tickit::Widget::Tabbed::Ribbon);
class Custom::Ribbon::Class::horizontal
:isa(Custom::Ribbon::Class);
...
class Custom::Ribbon::Class::vertical
:isa(Custom::Ribbon::Class);
...
now, how do you actually get the tabbed widget to use your class? two ways, pick your fighter π
option one: pass its name as a constructor argument called ribbon_class:
my $tabbed = Tickit::Widget::Tabbed->new(
ribbon_class => "Ribbon::Class::Name"
);
option two: override a method called RIBBON_CLASS:
use constant RIBBON_CLASS => "Ribbon::Class::Name";
either one, chef's kiss π
π METHODS π
β tabs
@tabs = $ribbon->tabs
$count = $ribbon->tabs
gives you a list of the contained Tickit::Widget::Tabbed tab objects when you're in list context. and in scalar context? you get the count of them instead. context is everything, iykyk β¨
β active_tab_index
$index = $ribbon->active_tab_index
returns the index of the currently-active tab. the one that's got the spotlight π₯
β active_tab
$tab = $ribbon->active_tab
returns the currently-active tab as a Tickit::Widget::Tabbed tab object. that's your girl π
π SUBCLASS METHODS π
ok so if you're subclassing, you're gonna need to provide implementations of these. no skipping, bestie, the vibes depend on it π«Ά
π render
$ribbon->render( %args )
π lines
$lines = $ribbon->lines
π cols
$cols = $ribbon->cols
both lines and cols work as per the Tickit::Widget methods. β¨
π on_key
$handled = $ribbon->on_key( $ev )
π on_mouse
$handled = $ribbon->on_mouse( $ev )
also as per the Tickit::Widget methods. these two are optional though β and listen, if you don't supply them, then the ribbon simply won't respond to keyboard or mouse events. it's giving unbothered π
π scroll_to_visible
$ribbon->scroll_to_visible( $index )
asks a scrollable control ribbon to scroll itself so that the given $index tab becomes visible. like, scoot over, we need to see this one π
π AUTHOR π
Paul Evans <leonerd@leonerd.org.uk> β thank you for your service π«‘π
and that's the whole page, bestie!! this was perl v5.36.0, dated 2023-09-30, and it's the Tickit...Ribbon(3pm) page β go forth and build the cutest ribbon ever, mwah π
β¨π
π¦ where this page comes from
- debian trixie: libtickit-widget-tabbed-perl 0.028-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libtickit-widget-tabbed-perl 0.028-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libtickit-widget-tabbed-perl 0.028-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libtickit-widget-tabbed-perl 0.028-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