NAME
Tk::GraphItems::Connector - Display edges of relation-graphs on a Tk::Canvas
SYNOPSIS
require Tk::GraphItems::TextBox;
require Tk::GraphItems::Connector;
my $conn = Tk::GraphItems::Connector->new(
source=>$a_TextBox,
target=>$another_TextBox],
);
$conn->colour('red');
$conn->arrow('both');
$conn->width(2);
$conn->detach;
$conn = undef;
DESCRIPTION
Tk::GraphItems::Connector provides objects to display edges of relation-graphs on a Tk::Canvas widget.
SEE ALSO
Documentation of Tk::GraphItems::TextBox . Examples in Tk/GraphItems/Examples
METHODS
Tk::GraphItems::Connector supports the following methods:
- new(source => $a_GraphItems-Node, target => $a_GraphItems-NodeB, colour => $a_TkColour, width => $width_pixels, arrow => $where, autodestroy => $bool<)>
-
Create a new Connector instance and display it on the Canvas of 'source' and 'target'. If 'autodestroy' is set to a true value, the Connector will get destroyed when its reference goes out of scope. This is recommended for easy use with Graph.pm or other models which allow to store objects for their edges. See gi-graph.pl for an example. The default for 'autodestroy' is 0. That means the Connector will stay 'alive' until either one of its source/target nodes gets destroyed or Connector->detach is called and references to Connector are deleted.
- colour([$a_Tk_colour])
-
Sets the colour to $a_Tk_colour, if the argument is given. Returns the current colour, if called without an argument.
- arrow('source'|'target'|'none'|'both')
-
Sets the style of the Connectors line-endings. Defaults to 'target'.
- width($line_width)
-
Sets Connectors linewidth in pixels. Defaults to 1.
- detach
-
Detach the Connector instance from its source and target so it can be DESTROYED. - It will however stay 'alive' as long as you hold any references to it. If you do not hold a reference to 'Connector' (you don't have to, unless you want to change it's properties...), it will be DESTROYED when either of its 'source'- or 'target'-nodes is destroyed.
AUTHOR
Christoph Lamprecht, ch.l.ngre@online.de
COPYRIGHT AND LICENSE
Copyright (C) 2006 by Christoph Lamprecht
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.7 or, at your option, any later version of Perl 5 you may have available.