The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Tickit::Pen - store a collection of rendering attributes

DESCRIPTION

Stores rendering attributes for text to display.

Supports the following named pen attributes:

fg => COL
bg => COL

Foreground or background colour. COL may be an integer 0-7 or one of the eight colour names. May also be prefixed by hi- for the high-intensity version (may not be supported by all terminals).

b => BOOL
u => BOOL
i => BOOL
rv => BOOL

Bold, underline, italics, reverse video.

af => INT

Alternate font.

Note that not all terminals can render the italics or alternate font attributes.

CONSTRUCTORS

$pen = Tickit::Pen->new( %attrs )

Returns a new pen, initialised from the given attributes.

$pen = Tickit::Pen->new_from_attrs( $attrs )

Returns a new pen, initialised from keys in the given HASH reference. Used keys are deleted from the hash.

METHODS

$value = $pen->getattr( $attr )

Returns the current value of the given attribute

%values = $pen->getattrs

Returns a key/value list of all the attributes

$pen->chattr( $attr, $value )

Change the value of an attribute. Setting undef implies default value. To delete an attribute altogether, see instead delattr.

$pen->chattrs( \%attrs )

Change the values of all the attributes given in the hash. Recgonised attributes will be deleted from the hash.

$pen->delattr( $attr )

Delete an attribute from this pen. This attribute will no longer be modified by this pen.

$pen->add_on_changed( $observer )

Add an observer to the list of objects which will be informed when the pen attributes change. The observer will be informed by invoking a method

 $observer->on_pen_changed( $pen )

The observer object is stored weakly, so it is safe to add the Tickit::Widget object that is using the pen as an observer.

$pen->remove_on_changed( $observer )

Remove an observer previously added by add_on_changed.

AUTHOR

Paul Evans <leonerd@leonerd.org.uk>