The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Tk::GraphItems::Circle - Display nodes of relation-graphs on a Tk::Canvas

SYNOPSIS

  require Tk::GraphItems::Circle;
  ...
  my $node = Tk::GraphItems::Circle->new(canvas => $can,
                                         colour => $a_TkColour,
                                         size   => $points,
                                         'x'    => 50,
                                         'y'    => 50);
  $node->move(10,0);
  $node->set_coords(50,50);
  $node->text($node->text()."\nanother_line");
  $node->colour('red');

DESCRIPTION

Tk::GraphItems::Circle provides objects to display nodes of relation-graphs on a Tk::Canvas widget.

METHODS

Tk::GraphItems::Circle supports the following methods:

new( canvas => $a_canvas, colour => $a_TkColour, x => $x_coord, y => $y_coord, size => $points )

Return a new Circle instance and display it on the given 'Canvas'. The canvas-items will be destroyed with the Circle-instance when it goes out of scope.

set_coords( $x, $y )

Set the (center)coordinates of this node. If two references are given as arguments, the referenced Scalar-variables will get tied to the coordinates properties of the node.

get_coords

Return the (center)coordinates of this node.

move( $d_x, $d_y )

Move the node by ( $d_x, $d_y ) points.

size( $size )

Resize the node to $size points. Returns the current size, if called without an argument.

colour( $a_Tk_colour )

Sets the Circles colour to $a_Tk_colour, if the argument is given. Returns the current colour, if called without an argument.

bind_class( 'event', $coderef )

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

was_dragged

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'.

SEE ALSO

Documentation of Tk::GraphItems::Connector. 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.