Tickit::Widget::Tabbed::Ribbon - base class for Tickit::Widget::Tabbed control ribbon
Tickit::Widget::Tabbed::Ribbon
Tickit::Widget::Tabbed
This class contains the default implementation for the control ribbon used by Tickit::Widget::Tabbed, and also acts as a base class to assist in the creation of a custom ribbon. Details of this class and its operation are useful to know when implenting a custom control ribbon.
It is not necessary to consider this class if simply using the Tickit::Widget::Tabbed with its default control ribbon.
To perform create a custom ribbon class, create a subclass of Tickit::Widget::Tabbed::Ribbon with a constructor having the following behaviour:
package Custom::Ribbon::Class; use base qw( Tickit::Widget::Tabbed::Ribbon ); sub new_for_orientation { my $class = shift; my ( $orientation, %args ) = @_; ... return $self; }
Alternatively if this is not done, then one of two subclasses will be used for the constructor, by appending ::horizontal or ::vertical to the class name. In this case, the custom class should provide these as well.
::horizontal
::vertical
package Custom::Ribbon::Class; use base qw( Tickit::Widget::Tabbed::Ribbon ); package Custom::Ribbon::Class::horizontal; use base qw( Custom::Ribbon::Class ); ... package Custom::Ribbon::Class::vertical; use base qw( Custom::Ribbon::Class ); ...
Arrange for this class to be used by the tabbed widget either by passing its name as a constructor argument called ribbon_class, or by overriding a method called RIBBON_CLASS.
ribbon_class
RIBBON_CLASS
my $tabbed = Tickit::Widget::Tabbed->new( ribbon_class => "Ribbon::Class::Name" );
or
use constant RIBBON_CLASS => "Ribbon::Class::Name";
Returns a list of the contained Tickit::Widget::Tabbed tab objects in list context, or the count of them in scalar context.
Returns the index of the currently-active tab
Returns the currently-active tab as a Tickit::Widget::Tabbed tab object.
The subclass will need to provide implementations of the following methods.
As per the Tickit::Widget methods.
As per the Tickit::Widget methods. Optional. If not supplied then the ribbon will not respond to keyboard or mouse events.
Requests that a scrollable control ribbon scrolls itself so that the given $index tab is visible.
$index
Paul Evans <leonerd@leonerd.org.uk>
To install Tickit::Widget::Tabbed, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Tickit::Widget::Tabbed
CPAN shell
perl -MCPAN -e shell install Tickit::Widget::Tabbed
For more information on module installation, please visit the detailed CPAN module installation guide.