Provided by: libtickit-console-perl_0.10-5_all
NAME
"Tickit::Console::Tab" - represent a single tab on a "Tickit::Console"
DESCRIPTION
Objects in this class represent a single switchable tab within a Tickit::Console. They are not constructed directly, but instead are returned by the "add_tab" method of the underlying "Tickit::Console" object.
PARAMETERS
The following extra parameters may be passed to the constructor, or via the "add_tab" method on the "Tickit::Console" object: timestamp_format => STRING or String::Tagged If defined, every line is prefixed with a timestamp built by applying the "POSIX::strftime" function to this string. If a String::Tagged instance is applied it will preserve all the formatting from it. datestamp_format => STRING or String::Tagged If defined, every time a line is added to the buffer, if it starts a new day since the previous message (because the format yields a different string), this message is added as well to the scroller. localtime => CODE If defined, provides an alternative function to "CORE::localtime" for converting an epoch value into a timestamp. For example, this may be set to sub { gmtime $_[0] } to generate timestamps in UTC instead of using the local timezone.
METHODS
name set_name $name = $tab->name $tab->set_name( $name ) Returns or sets the tab name text append_line $tab->append_line( $string, %opts ) Appends a line of text to the tab. $string may either be a plain perl string, or an instance of String::Tagged containing formatting tags, as specified by Tickit::Widget::Scroller. Options will be passed to the Tickit::Widget::Scroller::Item::Line used to contain the string. Also recognises the following options: time => NUM Overrides the epoch "time()" value used to generate a timestamp for this line timestamp_format => STRING or String::Tagged Overrides the stored format for generating a timestamp string. datestamp_format => STRING or String::Tagged Overrides the stored format for generating a datestamp string. prepend_line $tab->prepend_line( $string, %opts ) As "append_line", but prepends it at the beginning of the scroller. bind_key $tab->bind_key( $key, $code ) Installs a callback to invoke if the given key is pressed while this tab has focus, overwriting any previous callback for the same key. The code block is invoked as $result = $code->( $tab, $key ) If $code is missing or "undef", any existing callback is removed. This callback will be invoked before one defined on the console object itself, if present. If it returns a false value, then the one on the console will be invoked instead.
AUTHOR
Paul Evans <leonerd@leonerd.org.uk>