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: "n|text", where "n" is a 0-based
30       index into the "fontPalette".
31
32       The "S" sequence is used as follows: "n|text", where "n" is the number
33       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|text"", where "c" is
37       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 URL sequence parsing is resulted into making 1) "text" of color
63       "linkColor", and 2) wrapping the text with "OP_LINK" commands in the
64       block, that do nothing by default but could be used by whoever uses the
65       block. See Prima::Widget::Link for more and Prima::Label as an example.
66
67       The methods "text_out" and "get_text_width" are affected by
68       "Prima::Drawable::Markup".  "text_out" will write formatted text to the
69       canvas, and "get_text_width" will return the width of the formatted
70       text.  NOTE: These methods do not save state between calls, so your
71       markup cannot span lines (since each line is drawn or measured with a
72       separate call).
73
74       The module can export a single method "M" that is a shortcut over
75       creation of a new markup object with default color, font, and image
76       palettes. These can be accessed directly as "@COLORS, @FONTS, @IMAGES"
77       correspondingly.
78

PROPERTIES

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

SEE ALSO

98       Prima::Drawable::TextBlock, examples/markup.pl
99
101       Copyright 2003 Teo Sankaro
102
103       You may redistribute and/or modify this module under the same terms as
104       Perl itself.  (Although a credit would be nice.)
105

AUTHOR

107       This module based on work by Teo Sankaro, <teo_sankaro@hotmail.com>.
108
109
110
111perl v5.38.0                      2023-07-21        Prima::Drawable::Markup(3)
Impressum