1Prima::Drawable::MarkupU(s3e)r Contributed Perl DocumentaPtriiomna::Drawable::Markup(3)
2
3
4
6 Prima::Drawable::Markup - allow markup in widgets
7
9 use Prima qw(Application Buttons Drawable::Markup);
10 Prima::Button->new(
11 text => Prima::Drawable::Markup->new(markup => "B<Bold> bU<u>tton"),
12 hotKey => 'u',
13 );
14 run Prima;
15
17 "Prima::Drawable::Markup" adds the ability to recognize POD-like markup
18 to Prima widgets. Supported markup sequences are "B" (bold text), "I"
19 (italic text), "U" (underlined text), "F" (change font), "S" (change
20 font size), "C" (change foreground color), "Q" (change background
21 color), "M" (move pointer), "W" (disable wrapping), and "P" (picture).
22
23 The "F" sequence is used as follows: "F<n|text>", where "n" is a
24 0-based index into the "fontPalette".
25
26 The "S" sequence is used as follows: "S<n|text>", where "n" is the
27 number of points relative to the current font size. The font size may
28 optionally be preceded by "+" or "-".
29
30 The "C" and "Q" sequences are used as follows: "C<c|text>", where "c"
31 is either: a color in any form accepted by Prima, including the "cl"
32 constants ("Black" "Blue" "Green" "Cyan" "Red" "Magenta" "Brown"
33 "LightGray" "DarkGray" "LightBlue" "LightGreen" "LightCyan" "LightRed"
34 "LightMagenta" "Yellow" "White" "Gray"). Or, a 0-based index into the
35 "colorPalette". Also, "default" can be used to set the color that the
36 canvas originaly had. For "Q" a special value "off" can be used to turn
37 off background color and set it as transparent.
38
39 The "M" command has three parameters, comma-separated: X, Y, and flags.
40 X and Y are coordinates how much to move the current pointer. By
41 default X and are in pixels, and do not extend block width. "flags" is
42 a set of characters, where each is:
43
44 m - set units to font height
45 p - set units to points
46 x - also extend the block width
47
48 The text inside "W" sequence will not be wrapped during "text_wrap"
49 calls.
50
51 The "P" sequence is used as follows:"P<n>", where "n" is a 0-based
52 index into the "picturePalette".
53
54 The methods "text_out" and "get_text_width" are affected by
55 "Prima::Drawable::Markup". "text_out" will write formatted text to the
56 canvas, and "get_text_width" will return the width of the formatted
57 text. NOTE: These methods do not save state between calls, so your
58 markup cannot span lines (since each line is drawn or measured with a
59 separate call).
60
62 The following properties are used:
63
64 colorPalette([@colorPalette])
65 Gets or sets the color palette to be used for "C" sequences within
66 this widget. Each element of the array should be a "cl::"
67 constant.
68
69 fontPalette([@fontPalette])
70 Gets or sets the font palette to be used for "F" sequences within
71 this widget. Each element of the array should be a hashref
72 suitable for setting a font.
73
74 picturePalette([@picturePalette])
75 Gets or sets the picture palette to be used for "P" sequences
76 within this widget. Each element of the array should be a
77 "Prima::Image" descendant.
78
80 Prima::Drawable::TextBlock
81
83 Copyright 2003 Teo Sankaro
84
85 You may redistribute and/or modify this module under the same terms as
86 Perl itself. (Although a credit would be nice.)
87
89 This module based on work by Teo Sankaro, <teo_sankaro@hotmail.com>.
90
91
92
93perl v5.32.1 2021-01-27 Prima::Drawable::Markup(3)