| 1 | package Gtk3::ImageView::Tool; | ||
| 2 | |||
| 3 | use warnings; | ||
| 4 | use strict; | ||
| 5 | use Glib qw(TRUE FALSE); # To get TRUE and FALSE | ||
| 6 | |||
| 7 | our $VERSION = 8; | ||
| 8 | |||
| 9 | sub new { | ||
| 10 | my $class = shift; | ||
| 11 | my $view = shift; | ||
| 12 | return bless { _view => $view, }, $class; | ||
| 13 | } | ||
| 14 | |||
| 15 | sub view { | ||
| 16 | my $self = shift; | ||
| 17 | return $self->{_view}; | ||
| 18 | } | ||
| 19 | |||
| 20 | sub button_pressed { | ||
| 21 | my $self = shift; | ||
| 22 | my $event = shift; | ||
| 23 | return FALSE; | ||
| 24 | } | ||
| 25 | |||
| 26 | sub button_released { | ||
| 27 | my $self = shift; | ||
| 28 | my $event = shift; | ||
| 29 | return FALSE; | ||
| 30 | } | ||
| 31 | |||
| 32 | sub motion { | ||
| 33 | my $self = shift; | ||
| 34 | my $event = shift; | ||
| 35 | return FALSE; | ||
| 36 | } | ||
| 37 | |||
| 38 | sub cursor_at_point { | ||
| 39 | my ( $self, $x, $y ) = @_; | ||
| 40 | my $display = Gtk3::Gdk::Display::get_default; | ||
| 41 | my $cursor_type = $self->cursor_type_at_point( $x, $y ); | ||
| 42 | if ( defined $cursor_type ) { | ||
| 43 | return Gtk3::Gdk::Cursor->new_from_name( $display, $cursor_type ); | ||
| 44 | } | ||
| 45 | return; | ||
| 46 | } | ||
| 47 | |||
| 48 | sub cursor_type_at_point { | ||
| 49 | my ( $self, $x, $y ) = @_; | ||
| 50 | return; | ||
| 51 | } | ||
| 52 | |||
| 53 | # compatibility layer | ||
| 54 | |||
| 55 | sub signal_connect { | ||
| 56 | my ( $self, @args ) = @_; | ||
| 57 | return $self->view->signal_connect(@args); | ||
| 58 | } | ||
| 59 | |||
| 60 | sub signal_handler_disconnect { | ||
| 61 | my ( $self, @args ) = @_; | ||
| 62 | return $self->view->signal_handler_disconnect(@args); | ||
| 63 | } | ||
| 64 | |||
| 65 | 1; |