1Prima::Drawable::MarkupU(s3e)r Contributed Perl DocumentaPtriiomna::Drawable::Markup(3)
2
3
4

NAME

6       Prima::Drawable::Markup - allow markup in widgets
7

SYNOPSIS

9           use Prima qw(Application Buttons);
10           use Prima::Drawable::Markup q(M);
11           my $m = Prima::MainWindow->new;
12           $m-> insert( Button =>
13               text   => Prima::Drawable::Markup->new(markup => "B<Bold> bU<u>tton"),
14               hotKey => 'u',
15               pack   => {},
16           );
17           $m->insert( Button => pack => {}, text => M "I<Italic> button" );
18           $m->insert( Button => pack => {}, text => \ "Not an Q<I<italic>> button" );
19
20           run Prima;
21

DESCRIPTION

23       "Prima::Drawable::Markup" adds the ability to recognize POD-like markup
24       to Prima widgets. Supported markup sequences are "B" (bold text), "I"
25       (italic text), "U" (underlined text), "F" (change font), "S" (change
26       font size), "C" (change foreground color), "G" (change background
27       color), "M" (move pointer), "W" (disable wrapping), and "P" (picture).
28
29       The "F" sequence is used as follows: "F<n|text>", where "n" is a
30       0-based index into the "fontPalette".
31
32       The "S" sequence is used as follows: "S<n|text>", where "n" is the
33       number of points relative to the current font size. The font size may
34       optionally be preceded by "+" or "-".
35
36       The "C" and "G" sequences are used as follows: "C<c|text>", where "c"
37       is either: a color in any form accepted by Prima, including the "cl"
38       constants ("Black" "Blue" "Green" "Cyan" "Red" "Magenta" "Brown"
39       "LightGray" "DarkGray" "LightBlue" "LightGreen" "LightCyan" "LightRed"
40       "LightMagenta" "Yellow" "White" "Gray").  Or, a 0-based index into the
41       "colorPalette". Also, "default" can be used to set the color that the
42       canvas originaly had. For "G" a special value "off" can be used to turn
43       off background color and set it as transparent.
44
45       The "M" command has three parameters, comma-separated: X, Y, and flags.
46       X and Y are coordinates how much to move the current pointer. By
47       default X and are in pixels, and do not extend block width. "flags" is
48       a set of characters, where each is:
49
50           m - set units to font height
51           p - set units to points
52           x - also extend the block width
53
54       The text inside "W" sequence will not be wrapped during "text_wrap"
55       calls.
56
57       The text inside "Q" sequence will not be treated as markup.
58
59       The "P" sequence is used as follows:"P<n>", where "n" is a 0-based
60       index into the "picturePalette".
61
62       The methods "text_out" and "get_text_width" are affected by
63       "Prima::Drawable::Markup".  "text_out" will write formatted text to the
64       canvas, and "get_text_width" will return the width of the formatted
65       text.  NOTE: These methods do not save state between calls, so your
66       markup cannot span lines (since each line is drawn or measured with a
67       separate call).
68
69       The module can export a single method "M" that is a shortcut over
70       creation of a new markup object with default color, font, and image
71       palettes. These can be accessed directly as "@COLORS, @FONTS, @IMAGES"
72       correspondingly.
73

PROPERTIES

75       The following properties are used:
76
77       colorPalette([@colorPalette])
78           Gets or sets the color palette to be used for "C" sequences within
79           this widget.  Each element of the array should be a "cl::"
80           constant.
81
82       fontPalette([@fontPalette])
83           Gets or sets the font palette to be used for "F" sequences within
84           this widget.  Each element of the array should be a hashref
85           suitable for setting a font.
86
87       picturePalette([@picturePalette])
88           Gets or sets the picture palette to be used for "P" sequences
89           within this widget.  Each element of the array should be a
90           "Prima::Image" descendant.
91

SEE ALSO

93       Prima::Drawable::TextBlock, examples/markup.pl
94
96       Copyright 2003 Teo Sankaro
97
98       You may redistribute and/or modify this module under the same terms as
99       Perl itself.  (Although a credit would be nice.)
100

AUTHOR

102       This module based on work by Teo Sankaro, <teo_sankaro@hotmail.com>.
103
104
105
106perl v5.34.1                      2022-04-20        Prima::Drawable::Markup(3)
Impressum