Lamprecht Christoph > Tk-GraphItems-0.12 > Tk::GraphItems::Connector

Download:
Tk-GraphItems-0.12.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.11   Source  

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.

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 points. Defaults to 1.

bind_class( 'event', $coderef )

Binds the given 'event' sequence to $coderef. This binding will exist for all Connector instances on the Canvas displaying the invoking object. The binding will not exist for Connectors that are displayed on other Canvas instances. The Connector 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.

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.

SEE ALSO ^

Documentation of Tk::GraphItems::TextBox . Examples in Tk/GraphItems/Examples

AUTHOR ^

Christoph Lamprecht, ch.l.ngre@online.de

COPYRIGHT AND LICENSE ^

Copyright (C) 2007 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.

syntax highlighting: