Gtk2::Ex::MindMapView::HotSpot::Grip - Manage a grip type "hot spot"


Gtk2-Ex-MindMapView documentation Contained in the Gtk2-Ex-MindMapView distribution.

Index


Code Index:

NAME

Top

Gtk2::Ex::MindMapView::HotSpot::Grip - Manage a grip type "hot spot" on a view item.

VERSION

Top

This document describes Gtk2::Ex::MindMapView::HotSpot::Grip version 0.0.1

SYNOPSIS

Top

use base 'Gtk2::Ex::MindMapView::HotSpot::Grip';

DESCRIPTION

Top

The Gtk2::Ex::MindMapView::HotSpot::Grip defined grip type hotspots. This kind of hot spot is used to resize Gtk2::Ex::MindMapView::Items.

INTERFACE

Top

Properties

'x' (double)

The x-coordinate of the mouse location when resizing an item.

'y' (double)

The y-coordinate of the mouse location when resizing an item.

'x_prime' (double)

The x-coordinate of the previous mouse location when resizing an item.

'y_prime' (double)

The y-coordinate of the previous mouse location when resizing an item.

Methods

new (item=>$item)

Instantiates a grip type hotspot.

hotspot_button_press

Overrides method defined in Gtk2::Ex::MindMapView::HotSpot. This method records the position of the cursor when the mouse is first pressed.

hotspot_button_release

Overrides method defined in Gtk2::Ex::MindMapView::HotSpot. This method signals that the mind map should be redrawn.

hotspot_motion_notify

Overrides method defined in Gtk2::Ex::MindMapView::HotSpot. This method actually resizes the Gtk2::Ex::MindMapView::Item.

DIAGNOSTICS

Top

No Diagnostics.

DEPENDENCIES

Top

None.

BUGS AND LIMITATIONS

Top

No bugs have been reported.

Please report any bugs or feature requests to bug-gtk2-ex-mindmapview@rt.cpan.org, or through the web interface at http://rt.cpan.org.

AUTHOR

Top

James Muir <hemlock@vtlink.net>

LICENCE AND COPYRIGHT

Top

DISCLAIMER OF WARRANTY

Top

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.


Gtk2-Ex-MindMapView documentation Contained in the Gtk2-Ex-MindMapView distribution.

package Gtk2::Ex::MindMapView::HotSpot::Grip;

our $VERSION = '0.000001';

use warnings;
use strict;
use Carp;

use Glib ':constants';

use Gnome2::Canvas;

use base 'Gtk2::Ex::MindMapView::HotSpot';

sub new
{
    my $class = shift(@_);

    my $self = $class->SUPER::new(@_);

    $self->{x}       = 0;

    $self->{y}       = 0;

    $self->{x_prime} = 0;

    $self->{y_prime} = 0;

    return $self;
}


# $self->hotspot_button_press($item, $event);

sub hotspot_button_press
{
    my ($self, $item, $event) = @_;

    my @coords = $self->{item}->w2i($event->coords); # cursor position.

    $self->{x_prime} = $coords[0];

    $self->{y_prime} = $coords[1];
}


# $self->hotspot_button_release($item, $event);

sub hotspot_button_release
{
    my ($self, $item, $event) = @_;

    $self->{item}->signal_emit('layout');
}


# $self->hotspot_motion_notify($item, $event);

sub hotspot_motion_notify
{
    my ($self, $item, $event) = @_;

    my @coords = $self->{item}->w2i($event->coords); # cursor position.

    $self->{x} = $coords[0];

    $self->{y} = $coords[1];

    $self->{item}->resize($self->{side}, ($self->{x} - $self->{x_prime}), ($self->{y} - $self->{y_prime}));

    $self->{x_prime} = $self->{x};

    $self->{y_prime} = $self->{y};
}



1; # Magic true value required at end of module
__END__