| 1 | package Tk::GraphItems::TextBox; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||
| 4 | =head1 NAME | ||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | Tk::GraphItems::TextBox - Display nodes of relation-graphs on a Tk::Canvas | ||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | require Tk::GraphItems::TextBox; | ||||||||||||||||||||||||||||
| 12 | require Tk::GraphItems::Connector; | ||||||||||||||||||||||||||||
| 13 | ... | ||||||||||||||||||||||||||||
| 14 | my $node = Tk::GraphItems::TextBox->new( canvas=> $can, | ||||||||||||||||||||||||||||
| 15 | text => "new_node", | ||||||||||||||||||||||||||||
| 16 | font => ['Courier',8], | ||||||||||||||||||||||||||||
| 17 | x => 50, | ||||||||||||||||||||||||||||
| 18 | y => 50 ); | ||||||||||||||||||||||||||||
| 19 | $node->move( 10, 0 ); | ||||||||||||||||||||||||||||
| 20 | $node->set_coords( 50, 50 ); | ||||||||||||||||||||||||||||
| 21 | $node->text( $node->text()."\nanother_line" ); | ||||||||||||||||||||||||||||
| 22 | $node->colour( 'red' ); | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | Tk::GraphItems::TextBox provides objects to display nodes of relation-graphs on a Tk::Canvas widget. | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | =head1 METHODS | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | B<Tk::GraphItems::TextBox> supports the following methods: | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | =over 4 | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | =item B<new(> canvas=> $a_canvas, | ||||||||||||||||||||||||||||
| 40 | x => $x_coord, | ||||||||||||||||||||||||||||
| 41 | y => $y_coord, | ||||||||||||||||||||||||||||
| 42 | text => $textB, | ||||||||||||||||||||||||||||
| 43 | font => $aTkFont B<)> | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | Return a new TextBox instance and display it on the given 'Canvas'. The canvas-items will be destroyed with the TextBox-instance when it goes out of scope. | ||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | =item B<set_coords(> $x, $y B<)> | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | Set the (center)coordinates of this node. | ||||||||||||||||||||||||||||
| 50 | If two references are given as argumnents, the referenced Scalar-variables will get tied to the coordinates properties of the node. | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | =item B<get_coords> | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | Return the (center)coordinates of this node. | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | =item B<move(> $d_x, $d_y B<)> | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | Move the node by ( $d_x, $d_y ) points. | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | =item B<text(> [$a_string] B<)> | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | Sets the displayed text to $a_string, if the argument is given. Returns the current text, if called without an argument. | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | =item B<colour(> [$a_Tk_colour] B<)> | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | Sets the background to $a_Tk_colour, if the argument is given. Returns the current colour, if called without an argument. | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | =item B<bind_class(> 'event', $coderef B<)> | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | Binds the given 'event' sequence to $coderef. This binding will exist for all TextBox instances on the Canvas displaying the invoking object. The binding will not exist for TextBox items that are displayed on other Canvas instances. The TextBox instance which is the 'current' one at the time the event is triggered will be passed to $coderef as an argument. If $coderef contains an empty string, the binding for 'event' is deleted. | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | =item B<was_dragged> | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | Returns a true value in case a <B1-Motion> occured after the last <B1>. You may want to check this when binding to <B1-Release>, to make sure the action was a 'click' and not a 'drag'. | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | =back | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | =head1 SEE ALSO | ||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | Documentation of Tk::GraphItems::Connector. | ||||||||||||||||||||||||||||
| 81 | Examples in Tk/GraphItems/Examples. | ||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | Christoph Lamprecht, ch.l.ngre@online.de | ||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | Copyright (C) 2007 by Christoph Lamprecht | ||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | This library is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||
| 92 | it under the same terms as Perl itself, either Perl version 5.8.7 or, | ||||||||||||||||||||||||||||
| 93 | at your option, any later version of Perl 5 you may have available. | ||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||
| 98 | =cut | ||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | 4 | ▶ | use 5.008; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 101 | 4 | our $VERSION = '0.11'; | |||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | #use Data::Dumper; | ||||||||||||||||||||||||||||
| 104 | 4 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 105 | 4 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 106 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 107 | 4 | require Tk::GraphItems::Node; | |||||||||||||||||||||||||||
| 108 | 4 | require Tk::GraphItems::TiedCoord; | |||||||||||||||||||||||||||
| 109 | 4 | our @ISA = ('Tk::GraphItems::Node'); | |||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | 0 | ▶ | sub initialize{ | ||||||||||||||||||||||||||
|
Subroutine
initialize: not called CC=10 SCAR=47.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 113 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | 0 | ▶ | if (@_%2) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 116 | 0 | croak "wrong number of args! "; | |||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||
| 119 | 0 | my %args = @_; | |||||||||||||||||||||||||||
| 120 | my ($can,$x,$y,$text,$font,$colour) | ||||||||||||||||||||||||||||
| 121 | 0 | = @args{qw/canvas x y text font colour/}; | |||||||||||||||||||||||||||
| 122 | 0 | eval {$can->isa('Tk::Canvas')}; | |||||||||||||||||||||||||||
| 123 | 0 | ▶ | croak "this is not a 'Canvas':<$can> $@" if $@; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 124 | 0 | ▶ | unless ($can->Exists){croak "This Canvas does not Exist:<$can>"}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 125 | 0 | my $text_id; | |||||||||||||||||||||||||||
| 126 | my @coords; | ||||||||||||||||||||||||||||
| 127 | 0 | ▶ | @coords= map {ref($_)?$$_:$_} ($x,$y); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 128 | 0 | ▶ | my @font = (-font=>$font) if $font; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||
| 130 | 0 | eval{$text_id = $can->createText(@coords, | |||||||||||||||||||||||||||
| 131 | -text => $text, | ||||||||||||||||||||||||||||
| 132 | @font, | ||||||||||||||||||||||||||||
| 133 | -tags =>['TextBoxText', | ||||||||||||||||||||||||||||
| 134 | 'TextBox', | ||||||||||||||||||||||||||||
| 135 | 'TextBoxBind']); | ||||||||||||||||||||||||||||
| 136 | }; | ||||||||||||||||||||||||||||
| 137 | 0 | ▶ | croak "could not create TextBox at coords <$x>,<$y>: $@" if $@; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||
| 139 | 0 | my $p = 3; | |||||||||||||||||||||||||||
| 140 | 0 | my @bbox = $can->bbox($text_id); | |||||||||||||||||||||||||||
| 141 | 0 | @bbox = ($bbox[0] -$p,$bbox[1]-$p,$bbox[2]+$p,$bbox[3]+$p); | |||||||||||||||||||||||||||
| 142 | 0 | my $box_id = $can->createRectangle( | |||||||||||||||||||||||||||
| 143 | @bbox, | ||||||||||||||||||||||||||||
| 144 | -fill => 'white', | ||||||||||||||||||||||||||||
| 145 | -tags =>['TextBoxBox', | ||||||||||||||||||||||||||||
| 146 | 'TextBox', | ||||||||||||||||||||||||||||
| 147 | 'TextBoxBind']); | ||||||||||||||||||||||||||||
| 148 | 0 | $self->{text_id} = $text_id; | |||||||||||||||||||||||||||
| 149 | 0 | $self->{box_id} = $box_id; | |||||||||||||||||||||||||||
| 150 | 0 | $self->{dependents} = {}; | |||||||||||||||||||||||||||
| 151 | 0 | $self->{canvas} = $can; | |||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||
| 153 | 0 | $self->SUPER::initialize; | |||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||
| 155 | 0 | $self->_create_canvas_layers; | |||||||||||||||||||||||||||
| 156 | 0 | $self->_set_layer(2); | |||||||||||||||||||||||||||
| 157 | 0 | $self->_set_canvas_bindings; | |||||||||||||||||||||||||||
| 158 | 0 | ▶ | if (ref $x and ref $y) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $x and ref $y
MC/DC0%0/2
ref $x and ref $y
ref $x
ref $y
Truth table0%0/3
A and B
A= ref $xB= ref $y
| |||||||||||||||||||||||||||||
| 159 | 0 | $self->_tie_coords($x,$y); | |||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||
| 161 | 0 | ▶ | $self->colour($colour) if $colour; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 162 | 0 | return $self; | |||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||
| 167 | 0 | ▶ | sub _set_canvas_bindings{ | ||||||||||||||||||||||||||
|
Subroutine
_set_canvas_bindings: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 168 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 169 | 0 | my $can = $self->{canvas}; | |||||||||||||||||||||||||||
| 170 | 0 | ▶ | return if $can->{TextBoxBindings_done}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||
| 172 | 0 | $self->_set_canvas_bindings_for_tag('TextBox'); | |||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||
| 174 | 0 | $can->{TextBoxBindings_done}= 1; | |||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||
| 178 | 0 | ▶ | sub bind_class{ | ||||||||||||||||||||||||||
|
Subroutine
bind_class: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 179 | 0 | my ($self,$event,$code) = @_; | |||||||||||||||||||||||||||
| 180 | 0 | my $can = $self->{canvas}; | |||||||||||||||||||||||||||
| 181 | 0 | $self->_bind_this_class($event,'TextBoxBind',$code); | |||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||
| 184 | 0 | ▶ | sub canvas_items{ | ||||||||||||||||||||||||||
|
Subroutine
canvas_items: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 185 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 186 | 0 | return (@$self{qw/ box_id text_id/}); | |||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||
| 189 | 0 | ▶ | sub connector_coords{ | ||||||||||||||||||||||||||
|
Subroutine
connector_coords: not called CC=9 SCAR=45.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 190 | 0 | my ($self,$dependent) = @_; | |||||||||||||||||||||||||||
| 191 | 0 | my ($x,$y) = $self->get_coords; | |||||||||||||||||||||||||||
| 192 | 0 | ▶ | if (!defined $dependent){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 193 | 0 | return($x,$y); | |||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||
| 195 | 0 | my $where = $dependent->{master}{$self}; | |||||||||||||||||||||||||||
| 196 | 0 | ▶ | my $other = $where eq 'source'? 'target':'source'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 197 | 0 | my $c_c = $dependent->get_coords($other); | |||||||||||||||||||||||||||
| 198 | 0 | my @bbox = ($self->{canvas})->coords($self->{box_id}); | |||||||||||||||||||||||||||
| 199 | 0 | my $height = $bbox[3]-$bbox[1]; | |||||||||||||||||||||||||||
| 200 | 0 | my $width = $bbox[2]-$bbox[0]; | |||||||||||||||||||||||||||
| 201 | 0 | my $b_r = $height / $width; | |||||||||||||||||||||||||||
| 202 | 0 | ▶ | my $c_r= ($c_c->[1]-$y)/(($c_c->[0]-$x)||0.01); | ||||||||||||||||||||||||||
|
Condition0%0/2
$c_c->[0] - $x || 0.01
MC/DC0%0/1
$c_c->[0] - $x || 0.01
$c_c->[0] - $x
Truth table0%0/2
A
A= $c_c->[0] - $x
| |||||||||||||||||||||||||||||
| 203 | 0 | ▶ | if (abs ($b_r) > abs ($c_r)) { #r or l | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 204 | 0 | ▶ | if ($c_c->[0] > $x) { #right | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 205 | #print "right\n"; | ||||||||||||||||||||||||||||
| 206 | 0 | $x = $bbox[2]; | |||||||||||||||||||||||||||
| 207 | 0 | $y = $y+($c_r * $width /2); | |||||||||||||||||||||||||||
| 208 | } else { #left | ||||||||||||||||||||||||||||
| 209 | #print "left\n"; | ||||||||||||||||||||||||||||
| 210 | 0 | $x = $bbox[0]; | |||||||||||||||||||||||||||
| 211 | 0 | $y = $y-($c_r * $width /2); | |||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||
| 213 | } else { # b or t | ||||||||||||||||||||||||||||
| 214 | 0 | ▶ | if ($c_c->[1] < $y) { #top | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 215 | #print "top\n"; | ||||||||||||||||||||||||||||
| 216 | 0 | $y = $bbox[1]; | |||||||||||||||||||||||||||
| 217 | 0 | ▶ | $x = $x-((1/($c_r||0.01))*$height /2); | ||||||||||||||||||||||||||
|
Condition0%0/2
$c_r || 0.01
MC/DC0%0/1
$c_r || 0.01
$c_r
Truth table0%0/2
A
A= $c_r
| |||||||||||||||||||||||||||||
| 218 | } else { #bottom | ||||||||||||||||||||||||||||
| 219 | #print "bottom\n"; | ||||||||||||||||||||||||||||
| 220 | 0 | $y = $bbox[3]; | |||||||||||||||||||||||||||
| 221 | 0 | ▶ | $x = $x+((1/($c_r||0.01))*$height /2); | ||||||||||||||||||||||||||
|
Condition0%0/2
$c_r || 0.01
MC/DC0%0/1
$c_r || 0.01
$c_r
Truth table0%0/2
A
A= $c_r
| |||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||
| 224 | 0 | return($x,$y); | |||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||
| 228 | 0 | ▶ | sub _set_coords{ | ||||||||||||||||||||||||||
|
Subroutine
_set_coords: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 229 | 0 | my ($self,$x,$y)=@_; | |||||||||||||||||||||||||||
| 230 | 0 | my ($can,$t_id,$b_id) = @$self{qw/canvas text_id box_id/}; | |||||||||||||||||||||||||||
| 231 | 0 | my $p = 3; | |||||||||||||||||||||||||||
| 232 | 0 | $can->coords($t_id,$x,$y); | |||||||||||||||||||||||||||
| 233 | 0 | my @bbox = $can->bbox($t_id); | |||||||||||||||||||||||||||
| 234 | 0 | @bbox = ($bbox[0] -$p,$bbox[1]-$p,$bbox[2]+$p,$bbox[3]+$p); | |||||||||||||||||||||||||||
| 235 | 0 | $can->coords($b_id,@bbox); | |||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||
| 237 | 0 | for ($self->dependents) { | |||||||||||||||||||||||||||
| 238 | 0 | $_->position_changed($self); | |||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||
| 242 | 0 | ▶ | sub text{ | ||||||||||||||||||||||||||
|
Subroutine
text: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 243 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 244 | 0 | my $can = $self->get_canvas; | |||||||||||||||||||||||||||
| 245 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 246 | 0 | $can->itemconfigure($self->{text_id},-text=>$_[0]); | |||||||||||||||||||||||||||
| 247 | #call _set_coords to resize TextBox | ||||||||||||||||||||||||||||
| 248 | 0 | $self->_set_coords($self->get_coords); | |||||||||||||||||||||||||||
| 249 | 0 | return $self; | |||||||||||||||||||||||||||
| 250 | } else { | ||||||||||||||||||||||||||||
| 251 | 0 | return $can->itemcget($self->{text_id},'-text'); | |||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||
| 253 | } | ||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||
| 255 | 0 | ▶ | sub colour{ | ||||||||||||||||||||||||||
|
Subroutine
colour: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 256 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 257 | 0 | my $can = $self->get_canvas; | |||||||||||||||||||||||||||
| 258 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 259 | 0 | eval{$can->itemconfigure($self->{box_id},-fill=>$_[0]);}; | |||||||||||||||||||||||||||
| 260 | 0 | ▶ | croak " setting colour to <$_[0]> not possible: $@" if $@; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 261 | 0 | return $self; | |||||||||||||||||||||||||||
| 262 | } else { | ||||||||||||||||||||||||||||
| 263 | 0 | return $can->itemcget($self->{box_id},'-fill'); | |||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||
| 265 | } | ||||||||||||||||||||||||||||
| 266 | 0 | ▶ | sub get_coords{ | ||||||||||||||||||||||||||
|
Subroutine
get_coords: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 267 | 0 | my$self = shift; | |||||||||||||||||||||||||||
| 268 | 0 | my $can = $self->get_canvas; | |||||||||||||||||||||||||||
| 269 | 0 | my @coords = $can->coords($self->{text_id}); | |||||||||||||||||||||||||||
| 270 | 0 | ▶ | return wantarray ? @coords:\@coords; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||
| 274 | 4 | 1; | |||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||
| 276 | __END__ | ||||||||||||||||||||||||||||