NAME

Curses::Toolkit::Widget::Label - a widget to display text

VERSION

version 0.208

DESCRIPTION

This widget consists of a text label. This widget is more powerful than it looks : it supports line wrapping, and color, bold, underline, etc.

MARKUPS SUPPORT

To be able to have more than simple text, the Label widget supports markup tags in its text, for example :

'foo <u>underlined bar</u> <span fgcolor="blue"> blue text <span
 bgcolor="red"> blue on red </span> normal on red </span> <b>bold</b>.'
<u>
<u>underlined string</u>

The <u> tag makes the enclosing text underlined

<b>
<b>bold string</b>

The <b> tag makes the enclosing text bold

<span>

The <span> tag allows more attributes to be set. Attributes can of course be combined :

<span wight="blink" fgcolor="black" bgcolor="red">Warning text!</span>

There is the list of attributes :

weight
<span weight="reverse">some reverse string</span>

Specifies display attributes. Weight values can be :

normal : force some text back to normal
standout : enable standout property
underline : enable underline property
blink : enable blink property
dim : enable dim property
bold : enable bold property

Somme properties may be unsupported on your terminal.

fgcolor
<span fgcolor="blue">some blue text</span>

Change the foreground color. values can be :

black
red
green
yellow
blue
magenta
cyan
white
bgcolor
<span bgcolor="red">some red background text</span>

Change the foreground color. values can be :

black
red
green
yellow
blue
magenta
cyan
white

CONSTRUCTOR

new

input : none
output : a Curses::Toolkit::Widget::Label object

METHODS

set_text

Set the text of the label. The text can be either normal text, or text with markups, to display colors, bold, underline, etc., see Markup Support above

input  : the text
output : the label object

get_text

Get the text of the Label

input  : none
output : STRING, the Label text

set_justify

Set the text justification inside the label widget.

input  : STRING, one of 'left', 'right', 'center'
output : the label object

get_justify

Get the text justification inside the label widget.

input  : none
output : STRING, one of 'left', 'right', 'center'

set_wrap_mode

Set the wrap mode. 'never' means the label stay on one line (cut if not enough space is available), paragraphs are not interpreted. 'active' means the label tries to occupy space vertically (thus wrapping instead of extending to the right). 'lazy' means the label wraps if it is obliged to (not enough space to display on the same line), and on paragraphs

input  : STRING, one of 'never', 'active', 'lazy'
output : the label widget

get_wrap_mode

Get the text wrap mode ofthe label widget.

input  : none
output : STRING, one of 'never', 'active', 'lazy'

set_wrap_method

Set the wrap method used. 'word' (the default) wraps on word. 'letter' makes the label wrap but at any point.

input  : STRING, one of 'word', 'letter'
output : the label widget

get_wrap_method

Get the text wrap method inside the label widget.

input  : none
output : STRING, one of 'word', 'letter'

get_desired_space

Given a coordinate representing the available space, returns the space desired The Label desires the minimum space that lets it display entirely

input : a Curses::Toolkit::Object::Coordinates object
output : a Curses::Toolkit::Object::Coordinates object

get_minimum_space

Given a coordinate representing the available space, returns the minimum space needed to properly display itself

input : a Curses::Toolkit::Object::Coordinates object
output : a Curses::Toolkit::Object::Coordinates object

AUTHOR

Damien "dams" Krotkine

COPYRIGHT AND LICENSE

This software is copyright (c) 2011 by Damien "dams" Krotkine.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.