« lib/App/SeismicUnixGui/misc/use_pkg.pm
↑ Summary
lib/App/SeismicUnixGui/script/post_install_c_compile.pl »
| 1 | package App::SeismicUnixGui::misc::value_boxes; | ||
| 2 | |||
| 3 | use Moose; | ||
| 4 | our $VERSION = '0.0.1'; | ||
| 5 | use Tk; | ||
| 6 | use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants'; | ||
| 7 | my $get = L_SU_global_constants->new(); | ||
| 8 | my $var = $get->var(); | ||
| 9 | |||
| 10 | =head1 DOCUMENTATION | ||
| 11 | |||
| 12 | =head2 SYNOPSIS | ||
| 13 | |||
| 14 | PERL PROGRAM NAME: value_boxes.pm | ||
| 15 | AUTHOR: Juan Lorenzo | ||
| 16 | DATE: June 23 2017 | ||
| 17 | |||
| 18 | DESCRIPTION: | ||
| 19 | Create | ||
| 20 | many empty values | ||
| 21 | and empty value-entry spaces | ||
| 22 | |||
| 23 | USED FOR: | ||
| 24 | |||
| 25 | BASED ON: | ||
| 26 | |||
| 27 | NEEDS: | ||
| 28 | |||
| 29 | =cut | ||
| 30 | |||
| 31 | =head2 private hash references | ||
| 32 | |||
| 33 | =cut | ||
| 34 | |||
| 35 | my $value_boxes = { | ||
| 36 | |||
| 37 | _first => '', | ||
| 38 | _length => '', | ||
| 39 | _frame => '', | ||
| 40 | _values_w_aref => '', | ||
| 41 | |||
| 42 | }; | ||
| 43 | |||
| 44 | =head2 sub texts | ||
| 45 | |||
| 46 | populate Label widget box with new text | ||
| 47 | |||
| 48 | =cut | ||
| 49 | |||
| 50 | sub texts { | ||
| 51 | my ( $self, $value_aref ) = @_; | ||
| 52 | |||
| 53 | my (@values_w); | ||
| 54 | my ( $first, $last, $frame_ref ); | ||
| 55 | my @value; | ||
| 56 | |||
| 57 | @value = @$value_aref; | ||
| 58 | |||
| 59 | $first = $value_boxes->{_first}; | ||
| 60 | $last = $value_boxes->{_length}; | ||
| 61 | $frame_ref = $value_boxes->{_frame}; | ||
| 62 | |||
| 63 | for ( my $i = $first ; $i < $last ; $i++ ) { | ||
| 64 | |||
| 65 | my $value = $value[$i]; | ||
| 66 | |||
| 67 | $values_w[$i] = $$frame_ref->Entry( | ||
| 68 | -width => $var->{_40_characters}, | ||
| 69 | -background => $var->{_my_light_grey}, | ||
| 70 | -foreground => $var->{_my_black}, | ||
| 71 | -borderwidth => $var->{_no_borderwidth}, | ||
| 72 | ); | ||
| 73 | |||
| 74 | $values_w[$i]->delete(0,'end'); | ||
| 75 | $values_w[$i]->insert(0,$value); | ||
| 76 | |||
| 77 | } | ||
| 78 | |||
| 79 | $value_boxes->{_values_w_aref} = \@values_w; | ||
| 80 | } | ||
| 81 | |||
| 82 | =head2 get_aref | ||
| 83 | in future | ||
| 84 | use the get_w_aref version instead | ||
| 85 | =cut | ||
| 86 | |||
| 87 | sub get_aref { | ||
| 88 | |||
| 89 | my ($self) = @_; | ||
| 90 | |||
| 91 | return ( $value_boxes->{_values_w_aref} ); | ||
| 92 | |||
| 93 | } | ||
| 94 | |||
| 95 | =head2 get_w_aref | ||
| 96 | |||
| 97 | =cut | ||
| 98 | |||
| 99 | sub get_w_aref { | ||
| 100 | |||
| 101 | my ($self) = @_; | ||
| 102 | |||
| 103 | return ( $value_boxes->{_values_w_aref} ); | ||
| 104 | |||
| 105 | } | ||
| 106 | |||
| 107 | =head2 sub specs | ||
| 108 | |||
| 109 | dimensions of the array | ||
| 110 | |||
| 111 | =cut | ||
| 112 | |||
| 113 | sub specs { | ||
| 114 | |||
| 115 | my ( $self, $specs_href ) = @_; | ||
| 116 | |||
| 117 | $value_boxes->{_first} = $specs_href->{_first_entry_idx}; | ||
| 118 | $value_boxes->{_length} = $specs_href->{_length}; | ||
| 119 | |||
| 120 | } | ||
| 121 | |||
| 122 | =head2 sub frame | ||
| 123 | |||
| 124 | reference of holding widget frame for values | ||
| 125 | |||
| 126 | =cut | ||
| 127 | |||
| 128 | sub frame { | ||
| 129 | my ( $self, $frame_ref ) = @_; | ||
| 130 | $value_boxes->{_frame} = $frame_ref; | ||
| 131 | |||
| 132 | } | ||
| 133 | |||
| 134 | 1; |