NAME

Prima::Label - static text widget

DESCRIPTION

The class is designed for the display of text and provides no user interaction. The text output capabilities include wrapping, horizontal and vertical alignment, and automatic widget resizing to match text extensions. If the text contains a tilde-escaped ( hot ) character, the label can explicitly focus the specified widget upon pressing of the character key; this feature is useful for the design of dialogs.

Labels can display rich text with links. See Prima::Drawable::Markup for more.

SYNOPSIS

use Prima qw(Label InputLine Application);
my $w = Prima::MainWindow->new;
$w->insert( 'Prima::Label',
	text      => 'Enter ~name:',
	focusLink => 'InputLine1',
	alignment => ta::Center,
	pack => { fill => 'x', side => 'top', pad => 10 },
);
$w->insert(
	'Prima::InputLine',
	text => '',
	pack => { fill => 'x', side => 'top', pad => 10 },
);
run Prima;

API

Properties

alignment INTEGER

One of the following ta::XXX constants:

ta::Left
ta::Center
ta::Right

Selects the horizontal text alignment.

Default value: ta::Left

autoHeight BOOLEAN

If 1, the widget height is automatically changed as text extensions change.

Default value: 0

autoWidth BOOLEAN

If 1, the widget width is automatically changed as text extensions change.

Default value: 1

Points to a widget or a widget name (has to be a sibling widget), which is explicitly focused when the user presses the combination of the hotkey with the Alt key.

Prima::Label does not provide a separate property to access the hotkey value from the tilde-escaped string, however, it can be read from the {accel} variable.

Default value: undef.

hotKey CHAR

A key (defined by CHAR) that the label will react to if pressed if the label has the focus The combination ALT + Key works always whether the label has the focus or not

linkColor COLOR

The color of text in links.

The default value is taken from Prima::Widget::Link and is currently hardcoded as green. So far there is no support for the system link color.

showAccelChar BOOLEAN

If 0, the tilde ( ~ ) character is collapsed from the text, and the hot character is underlined. When the user presses the combination of the escaped character with the Alt key, the focusLink widget is explicitly focused.

If 1, the text is shown as is, and no hot character is underlined. Key combinations with the Alt key are not recognized. See also: hotKey.

Default value: 0

showPartial BOOLEAN

Used to determine if the last line of text should be drawn if it can not be vertically fit in the widget interior. If 1, the last line is shown even if not visible in full. If 0, only full lines are drawn.

Default value: 1

textJustify $BOOL | { letter => 0, word => 0, kashida => 0, min_kashida => 0 } | %VALUES

If set, justifies wrapped text according to the option passed in the hash ( see "arabic_justify" in Prima::Drawable::Glyphs and "interspace_justify" in Prima::Drawable::Glyphs ). Can accept three forms:

If an anonymous hash is used, overwrites all the currently defined options.

If $BOOL is used, treated as a shortcut for { letter => $BOOL, word => $BOOL, kashida => $BOOL }; consequent get-calls return a full hash, not the $BOOL value.

If the %VALUES form is used, overwrites only values found in %VALUES.

Only actual when wordWrap is set.

textDirection BOOLEAN

If set, indicates RTL text direction.

wordWrap BOOLEAN

If 0, the text is not wrapped unless new line characters are present in the text.

If 1, the text is wrapped if it can not be fit horizontally in the widget interior. The text is also wrapped over new lines.

Default value: 0

valignment INTEGER

One of the following ta::XXX constants:

ta::Top
ta::Middle or ta::Center
ta::Bottom

Selects the vertical text alignment.

Note: the ta::Middle value is not equal to ta::Center's, however, both constants produce an equal effect here.

Default value: ta::Top

AUTHOR

Dmitry Karasik, <dmitry@karasik.eu.org>.

SEE ALSO

Prima, Prima::Widget, Prima::Drawable::Markup, Prima::Widget::Links, examples/label.pl