Tickit...Tabbed(3pm)
π Tickit::Widget::Tabbed β the manual page, but make it a group chat π
okay bestie, welcome to Tickit::Widget::Tabbed from the User Contributed Perl Documentation section (that's the 3pm part, iykyk). it's giving "I have tabs and I'm not afraid to use them" β¨
πΈ NAME πΈ
Tickit::Widget::Tabbed β provide tabbed window support. that's it. that's the whole vibe. tabs. windows. slay. π
β¨ SYNOPSIS β¨
look at this. so clean. so demure.
use Tickit::Widget::Tabbed;
my $tabbed = Tickit::Widget::Tabbed->new;
$tabbed->add_tab(Tickit::Widget::Static->new(text => 'some text'), label => 'First tab');
$tabbed->add_tab(Tickit::Widget::Static->new(text => 'some text'), label => 'Second tab');
two tabs. two labels. main character energy fr fr π
π¦ DESCRIPTION π¦
so basically it provides a container that operates as a tabbed window. a container!! with tabs!! obsessed.
it's a subclass of Tickit::ContainerWidget, just so we're all clear on the family tree π
π STYLE π
the default style pen is used as the widget pen. periodt. and these style pen prefixes are also used, bestie, take notes:
ribbon=> PEN β the pen used for the ribbon ποΈactive=> PEN β the pen attributes used for the active tab on the ribbon βmore=> PEN β the pen used for "more" ribbon scroll markers π
and these style keys are used:
more_left=> STRINGmore_right=> STRING β these two are the text used to indicate that there is more content scrolled to the left or right, respectively, in the ribbon ππ
π METHODS π
π new
Instantiate a new tabbed window. fresh out the box, no cap.
takes the following named parameters:
tab_positionβ (optional) location of the tabs, should be one ofleft,top,right,bottom. π
π tab_position
Accessor for the tab position (top, left, right, bottom). yes queen, tell me where the tabs go.
π active_tab_index
Returns the 0-based index of the currently-active tab. zero-based, because we're programmers and we suffer π«Ά
π active_tab
Returns the currently-active tab as a tab object. see below π
π active_tab_widget
Returns the widget in the currently active tab. the actual content!! the moment!!
π add_tab
Add a new tab to this tabbed widget. Returns an object representing the tab; see "METHODS ON TAB OBJECTS" below.
First parameter is the widget to use.
Remaining form a hash:
labelβ label to show on the new tab π·οΈ
π remove_tab
Remove tab given by 0-based index or tab object. bye bestie π
π move_tab
Move tab given by 0-based index or tab object forward the given number of positions. scoot scoot π
π activate_tab
Switch to the given tab; by 0-based index, or object.
π next_tab
Switch to the next tab. This may be bound as a key action. β¨οΈ
π prev_tab
Switch to the previous tab. This may be bound as a key action. β¨οΈ
π METHODS ON TAB OBJECTS π
The following methods may be called on the objects returned by add_tab or active_tab. these are the tab objects themselves, bestie, they have lore π
π index
Returns the 0-based index of this tab
π widget
Returns the Tickit::Widget contained by this tab
π label
Returns the current label text
π set_label
Set new label text for the tab βοΈ
π is_active
Returns true if this tab is the currently active one β
π activate
Activate this tab π₯
π set_on_activated
Set a callback or method name to invoke when the tab is activated π
π set_on_deactivated
Set a callback or method name to invoke when the tab is deactivated π
π pen
Returns the Tickit::Pen used to draw the label.
β οΈ heads up bestie: Pen observers are no longer registered on the return value; to set a different pen on the tab, use the set_pen method instead. don't come for me, I'm just the messenger π«Ά
π§ CUSTOM TAB CLASS π§
okay so plot twist: rather than use the default built-in object class for tab objects, a Tickit::Widget::Tabbed or subclass thereof can return objects in another class instead. This is most useful for subclasses of the tabbed widget itself. it's giving DIY, it's giving customization, it's giving you π
To perform this, create a subclass of Tickit::Widget::Tabbed::Tab. Since version 0.022 this module is implemented using Object::Pad, so you can rely on having that available for implementing a subclass:
use Object::Pad;
class MyCustomTabClass :isa(Tickit::Widget::Tabbed::Tab);
Arrange for this class to be used by the tabbed widget either by passing its name as a constructor argument called tab_class, or by overriding a method called TAB_CLASS.
my $tabbed = Tickit::Widget::Tabbed->new(
tab_class => "MyCustomTabClass"
);
or
use constant TAB_CLASS => "MyCustomTabClass";
both valid. pick your fighter π
π CUSTOM RIBBON CLASS π
same energy, different object. rather than use the default built-in object class for the ribbon object, a Tickit::Widget::Tabbed or subclass thereof can use an object in another subclass instead. This is most useful for subclasses of the tabbed widget itself.
For more detail, see the documentation in Tickit::Widget::Tabbed::Ribbon. go read it, I'll wait π¦
β SEE ALSO β
Tickit::Widget::TableTickit::Widget::HBoxTickit::Widget::VBoxTickit::Widget::TreeTickit::Window
the whole friend group, fr fr π«Ά
π«Ά AUTHOR π«Ά
Tom Molesworth <cpan@entitymodel.com>, Paul Evans <leonerd@leonerd.org.uk>
legends. icons. the moment. π
π LICENSE π
Copyright Tom Molesworth 2011; Paul Evans 2014. Licensed under the same terms as Perl itself.
and that's the page bestie π this was documented under perl v5.36.0 and dated 2023-09-30, so when you're out here reading Tickit...Tabbed(3pm) just remember: tabs were slaying long before you got here. periodt. πβ¨
π¦ 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