Curie/Component/JacquardCanvas/Role/MouseCursor.pm untested

filter: Statementstmt 0.0% 0 / 29 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 40 CC 1 SCAR 6.9
CC
1
Cov
0%
_set_cursor_to_name
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 use Renard::Incunabula::Common::Setup;
2 package Renard::Curie::Component::JacquardCanvas::Role::MouseCursor;
3 # ABSTRACT: Role for changing cursor shape
4 $Renard::Curie::Component::JacquardCanvas::Role::MouseCursor::VERSION = '0.005';
5 use Role::Tiny;
6 use Glib qw(TRUE FALSE);
7  
8 sub _set_cursor_to_name {
9 my ($self, $name) = @_;
10 $self->get_window->set_cursor(
11 Gtk3::Gdk::Cursor->new_from_name($self->get_display, $name)
12 );
13 }
14  
15 after do_pointer_data => sub {
16 my ($self, $event_point, $pointer_data, $text_data ) = @_;
17  
18 if( defined $text_data ) {
19 if( @$text_data ) {
20 my $block = $text_data->[0];
21 $self->{text}{substr} = $block->{extent}->substr;
22 $self->{text}{data} = $block;
23  
24 $self->{text}{layers} = $text_data;
25  
26 if( $text_data->[-1]{tag} eq 'char' ) {
27 $self->_set_cursor_to_name('text');
28 } else {
29 $self->_set_cursor_to_name('default');
30 }
31  
32 $self->signal_emit( 'text-found' );
33 } else {
34 delete $self->{text};
35 $self->_set_cursor_to_name('default');
36 }
37 $self->queue_draw;
38 }
39  
40 return TRUE;
41 };
42  
43 1;
44  
45 __END__