Prima::...::Markup(3)
okay bestie, welcome to Prima::...::Markup(3), straight outta the User Contributed Perl Documentation pile. β¨ This one is about letting widgets get all dressed up with POD-ish markup, and yes, she ate.
π NAME π
Prima::Drawable::Markup β allow markup in widgets. π
β¨ SYNOPSIS β¨
hereβs the vibe in code, exactly as written:
use Prima qw(Application Buttons);
use Prima::Drawable::Markup q(M);
my $m = Prima::MainWindow->new;
$m-> insert( Button =>
text => Prima::Drawable::Markup->new(markup => "B<Bold> bU<u>tton"),
hotKey => 'u',
pack => {},
);
$m->insert( Button => pack => {}, text => M "I<Italic> button" );
$m->insert( Button => pack => {}, text => \ "Not an Q<I<italic>> button" );
run Prima;
πΈ DESCRIPTION πΈ
Prima::Drawable::Markup adds the ability to recognize POD-like markup to Prima widgets. The supported markup sequences are B (bold text), I (italic text), U (underlined text), F (change font), S (change font size), C (change foreground color), G (change background color), M (move pointer), W (disable wrapping), and P (picture). π
The F sequence is used as follows: n|text, where n is a 0-based index into the fontPalette.
The S sequence is used as follows: n|text, where n is the number of points relative to the current font size. The font size may optionally be preceded by + or -. no cap.
The C and G sequences are used as follows: c|text, where c is either:
- a color in any form accepted by Prima, including the
clconstants (BlackBlueGreenCyanRedMagentaBrownLightGrayDarkGrayLightBlueLightGreenLightCyanLightRedLightMagentaYellowWhiteGray); - or, a 0-based index into the
colorPalette.
Also, default can be used to set the color that the canvas originally had. For G, a special value off can be used to turn off the background color and set it as transparent. π«Ά
The M command has three parameters, comma-separated: X, Y, and flags. X and Y are coordinates of how much to move the current pointer. By default X and Y are in pixels, and do not extend block width. flags is a set of characters, where each is:
mβ set units to font heightpβ set units to pointsxβ also extend the block width
The text inside the W sequence will not be wrapped during text_wrap calls.
The text inside the Q sequence will not be treated as markup.
The P sequence is used as follows: P<n>, where n is a 0-based index into the picturePalette.
The URL sequence parsing results in making 1) text of color linkColor, and 2) wrapping the text with OP_LINK commands in the block, that do nothing by default but could be used by whoever uses the block. See Prima::Widget::Link for more and Prima::Label as an example. π¦
The methods text_out and get_text_width are affected by Prima::Drawable::Markup. text_out will write formatted text to the canvas, and get_text_width will return the width of the formatted text.
NOTE: These methods do not save the state between calls, so your markup cannot span lines (since each line is drawn or measured with a separate call). π
The module can export a single method M which is a shortcut over the creation of a new markup object with default color, font, and image palettes. These can be accessed directly as @COLORS, @FONTS, @IMAGES correspondingly.
π API π
The following properties are used:
colorPalette([@colorPalette])β gets or sets the color palette to be used forCsequences within this widget. Each element of the array should be acl::constant. π¨fontPalette([@fontPalette])β gets or sets the font palette to be used forFsequences within this widget. Each element of the array should be a hashref suitable for setting a font. π€picturePalette([@picturePalette])β gets or sets the picture palette to be used forPsequences within this widget. Each element of the array should be aPrima::Imagedescendant. πΌοΈ
π¦ SEE ALSO π¦
Prima::Drawable::TextBlock, examples/markup.pl
π COPYRIGHT π
Copyright 2003 Teo Sankaro.
You may redistribute and/or modify this module under the same terms as Perl itself. (Although a credit would be nice.) π₯Ί
β AUTHOR β
This module is based on work by Teo Sankaro, <teo_sankaro@hotmail.com>.
and thatβs the whole page, bestie: perl v5.42.0, dated 2024-08-20, for Prima::...::Markup(3). bye π
π¦ where this page comes from
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms