| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package UI::Various::RichTerm::Text; | 
| 2 |  |  |  |  |  |  |  | 
| 3 |  |  |  |  |  |  | # Author, Copyright and License: see end of file | 
| 4 |  |  |  |  |  |  |  | 
| 5 |  |  |  |  |  |  | =head1 NAME | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | UI::Various::RichTerm::Text - concrete implementation of L | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | # This module should never be used directly! | 
| 12 |  |  |  |  |  |  | # It is used indirectly via the following: | 
| 13 |  |  |  |  |  |  | use UI::Various::Text; | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | =head1 ABSTRACT | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  | This module is the specific implementation of L using the | 
| 18 |  |  |  |  |  |  | rich terminal UI. | 
| 19 |  |  |  |  |  |  |  | 
| 20 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 21 |  |  |  |  |  |  |  | 
| 22 |  |  |  |  |  |  | The documentation of this module is only intended for developers of the | 
| 23 |  |  |  |  |  |  | package itself. | 
| 24 |  |  |  |  |  |  |  | 
| 25 |  |  |  |  |  |  | =cut | 
| 26 |  |  |  |  |  |  |  | 
| 27 |  |  |  |  |  |  | ######################################################################### | 
| 28 |  |  |  |  |  |  |  | 
| 29 | 6 |  |  | 6 |  | 60 | use v5.14; | 
|  | 6 |  |  |  |  | 114 |  | 
| 30 | 6 |  |  | 6 |  | 26 | use strictures; | 
|  | 6 |  |  |  |  | 10 |  | 
|  | 6 |  |  |  |  | 25 |  | 
| 31 | 6 |  |  | 6 |  | 816 | no indirect 'fatal'; | 
|  | 6 |  |  |  |  | 10 |  | 
|  | 6 |  |  |  |  | 24 |  | 
| 32 | 6 |  |  | 6 |  | 559 | no multidimensional; | 
|  | 6 |  |  |  |  | 13 |  | 
|  | 6 |  |  |  |  | 26 |  | 
| 33 | 6 |  |  | 6 |  | 327 | use warnings 'once'; | 
|  | 6 |  |  |  |  | 11 |  | 
|  | 6 |  |  |  |  | 304 |  | 
| 34 |  |  |  |  |  |  |  | 
| 35 |  |  |  |  |  |  | our $VERSION = '0.24'; | 
| 36 |  |  |  |  |  |  |  | 
| 37 | 6 |  |  | 6 |  | 29 | use UI::Various::core; | 
|  | 6 |  |  |  |  | 9 |  | 
|  | 6 |  |  |  |  | 26 |  | 
| 38 | 6 |  |  | 6 |  | 32 | use UI::Various::Text; | 
|  | 6 |  |  |  |  | 8 |  | 
|  | 6 |  |  |  |  | 186 |  | 
| 39 | 6 |  |  | 6 |  | 34 | use UI::Various::RichTerm::base; | 
|  | 6 |  |  |  |  | 11 |  | 
|  | 6 |  |  |  |  | 1406 |  | 
| 40 |  |  |  |  |  |  |  | 
| 41 |  |  |  |  |  |  | require Exporter; | 
| 42 |  |  |  |  |  |  | our @ISA = qw(UI::Various::Text UI::Various::RichTerm::base); | 
| 43 |  |  |  |  |  |  | our @EXPORT_OK = qw(); | 
| 44 |  |  |  |  |  |  |  | 
| 45 |  |  |  |  |  |  | ######################################################################### | 
| 46 |  |  |  |  |  |  | ######################################################################### | 
| 47 |  |  |  |  |  |  |  | 
| 48 |  |  |  |  |  |  | =head1 METHODS | 
| 49 |  |  |  |  |  |  |  | 
| 50 |  |  |  |  |  |  | =cut | 
| 51 |  |  |  |  |  |  |  | 
| 52 |  |  |  |  |  |  | ######################################################################### | 
| 53 |  |  |  |  |  |  |  | 
| 54 |  |  |  |  |  |  | =head2 B<_prepare> - prepare UI element | 
| 55 |  |  |  |  |  |  |  | 
| 56 |  |  |  |  |  |  | ($width, $height) = $ui_element->_prepare($content_width); | 
| 57 |  |  |  |  |  |  |  | 
| 58 |  |  |  |  |  |  | =head3 example: | 
| 59 |  |  |  |  |  |  |  | 
| 60 |  |  |  |  |  |  | my ($w, $h) = $_->_prepare($content_width); | 
| 61 |  |  |  |  |  |  | $width < $w  and  $width = $w; | 
| 62 |  |  |  |  |  |  | $height += $h; | 
| 63 |  |  |  |  |  |  |  | 
| 64 |  |  |  |  |  |  | =head3 parameters: | 
| 65 |  |  |  |  |  |  |  | 
| 66 |  |  |  |  |  |  | $content_width      preferred width of content | 
| 67 |  |  |  |  |  |  |  | 
| 68 |  |  |  |  |  |  | =head3 description: | 
| 69 |  |  |  |  |  |  |  | 
| 70 |  |  |  |  |  |  | Prepare output of the UI element by determining and returning the space it | 
| 71 |  |  |  |  |  |  | wants or needs.  I | 
| 72 |  |  |  |  |  |  | C container elements!> | 
| 73 |  |  |  |  |  |  |  | 
| 74 |  |  |  |  |  |  | =head3 returns: | 
| 75 |  |  |  |  |  |  |  | 
| 76 |  |  |  |  |  |  | width and height the UI element will require or need when printed | 
| 77 |  |  |  |  |  |  |  | 
| 78 |  |  |  |  |  |  | =cut | 
| 79 |  |  |  |  |  |  |  | 
| 80 |  |  |  |  |  |  | # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # | 
| 81 |  |  |  |  |  |  |  | 
| 82 |  |  |  |  |  |  | sub _prepare($$) | 
| 83 |  |  |  |  |  |  | { | 
| 84 | 0 |  |  | 0 |  |  | my ($self, $content_width) = @_; | 
| 85 | 0 |  |  |  |  |  | return $self->_size($self->text, $content_width); | 
| 86 |  |  |  |  |  |  | } | 
| 87 |  |  |  |  |  |  |  | 
| 88 |  |  |  |  |  |  | ######################################################################### | 
| 89 |  |  |  |  |  |  |  | 
| 90 |  |  |  |  |  |  | =head2 B<_show> - return formatted UI element | 
| 91 |  |  |  |  |  |  |  | 
| 92 |  |  |  |  |  |  | $string = $ui_element->_show($prefix, $width, $height); | 
| 93 |  |  |  |  |  |  |  | 
| 94 |  |  |  |  |  |  | =head3 example: | 
| 95 |  |  |  |  |  |  |  | 
| 96 |  |  |  |  |  |  | my ($w, $h) = $_->_prepare($content_width); | 
| 97 |  |  |  |  |  |  | ... | 
| 98 |  |  |  |  |  |  | $_->_show('    ', $w, $h, $my_width, 0); | 
| 99 |  |  |  |  |  |  |  | 
| 100 |  |  |  |  |  |  | =head3 parameters: | 
| 101 |  |  |  |  |  |  |  | 
| 102 |  |  |  |  |  |  | $prefix             text in front of first line | 
| 103 |  |  |  |  |  |  | $width              the width returned by _prepare above | 
| 104 |  |  |  |  |  |  | $height             the height returned by _prepare above | 
| 105 |  |  |  |  |  |  |  | 
| 106 |  |  |  |  |  |  | =head3 description: | 
| 107 |  |  |  |  |  |  |  | 
| 108 |  |  |  |  |  |  | Return the formatted (rectangular) text box of the UI element.  Its height | 
| 109 |  |  |  |  |  |  | will be exactly as specified, unless there hasn't been enough space.  The | 
| 110 |  |  |  |  |  |  | weight is similarly as specified plus the width needed for the prefix. | 
| 111 |  |  |  |  |  |  | I | 
| 112 |  |  |  |  |  |  | elements!> | 
| 113 |  |  |  |  |  |  |  | 
| 114 |  |  |  |  |  |  | =head3 returns: | 
| 115 |  |  |  |  |  |  |  | 
| 116 |  |  |  |  |  |  | the rectangular text box for UI element | 
| 117 |  |  |  |  |  |  |  | 
| 118 |  |  |  |  |  |  | =cut | 
| 119 |  |  |  |  |  |  |  | 
| 120 |  |  |  |  |  |  | # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # | 
| 121 |  |  |  |  |  |  |  | 
| 122 |  |  |  |  |  |  | sub _show($$$$$$) | 
| 123 |  |  |  |  |  |  | { | 
| 124 | 0 |  |  | 0 |  |  | my ($self, $prefix, $width, $height) = @_; | 
| 125 | 0 |  |  |  |  |  | return $self->_format($prefix, '', '', $self->text, '', '', $width, $height); | 
| 126 |  |  |  |  |  |  | } | 
| 127 |  |  |  |  |  |  |  | 
| 128 |  |  |  |  |  |  | 1; | 
| 129 |  |  |  |  |  |  |  | 
| 130 |  |  |  |  |  |  | ######################################################################### | 
| 131 |  |  |  |  |  |  | ######################################################################### | 
| 132 |  |  |  |  |  |  |  | 
| 133 |  |  |  |  |  |  | =head1 SEE ALSO | 
| 134 |  |  |  |  |  |  |  | 
| 135 |  |  |  |  |  |  | L, L | 
| 136 |  |  |  |  |  |  |  | 
| 137 |  |  |  |  |  |  | =head1 LICENSE | 
| 138 |  |  |  |  |  |  |  | 
| 139 |  |  |  |  |  |  | Copyright (C) Thomas Dorner. | 
| 140 |  |  |  |  |  |  |  | 
| 141 |  |  |  |  |  |  | This library is free software; you can redistribute it and/or modify it | 
| 142 |  |  |  |  |  |  | under the same terms as Perl itself.  See LICENSE file for more details. | 
| 143 |  |  |  |  |  |  |  | 
| 144 |  |  |  |  |  |  | =head1 AUTHOR | 
| 145 |  |  |  |  |  |  |  | 
| 146 |  |  |  |  |  |  | Thomas Dorner Edorner (at) cpan (dot) orgE | 
| 147 |  |  |  |  |  |  |  | 
| 148 |  |  |  |  |  |  | =cut |