diff options
Diffstat (limited to 'src/MTools')
-rw-r--r-- | src/MTools/Widget/MToggleBouton.pm | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/src/MTools/Widget/MToggleBouton.pm b/src/MTools/Widget/MToggleBouton.pm index a373b48..fe598a9 100644 --- a/src/MTools/Widget/MToggleBouton.pm +++ b/src/MTools/Widget/MToggleBouton.pm @@ -21,6 +21,8 @@ use MTools; use MTools::GUI::MGroup; use MTools::MSwitch; use MTools::MState; +use MTools::MTimer; + use vars qw /@ISA/; @@ -90,18 +92,20 @@ sub new { push (@gover2, $self -> {gp_over}); -# my $timer = new MTools::MTimer (5, 1); -# my @gon_tmp = @gon; -# push (@gon_tmp, $timer); - - + my $timer = new MTools::MTimer (5, 1); + my @gon1_tmp = @gon1; + push (@gon1_tmp, $timer); + my @gon2_tmp = @gon2; + push (@gon2_tmp, $timer); my $sw = new MTools::MSwitch ( $self, 'idle1' => \@gon1, + 'idle1_tmp' => \@gon1_tmp, 'hover1' => \@gover1, 'pressed1' => \@goff1, 'idle2' => \@gon2, + 'idle2_tmp' => \@gon2_tmp, 'hover2' => \@gover2, 'pressed2' => \@goff2, ); @@ -113,6 +117,7 @@ sub new { release => [$self, '<ButtonRelease-1>'], enter => [$self, '<Enter>'], leave => [$self, '<Leave>'], + timeout => [$timer, 'TIME_OUT'] }, transitions => { 'idle1' => { @@ -124,13 +129,22 @@ sub new { notify => $event1On, }, }, + 'idle1_tmp' => { + 'press' => { + to => 'pressed1', + notify => $event1On, + }, + 'timeout' => { + to => 'idle1', + }, + }, 'hover1' => { 'press' => { to => 'pressed1', notify => $event1On, }, 'leave' => { - to => 'idle1', + to => 'idle1_tmp', } }, 'pressed1' => { @@ -151,13 +165,22 @@ sub new { notify => $event2On, }, }, + 'idle2_tmp' => { + 'press' => { + to => 'pressed2', + notify => $event2On, + }, + 'timeout' => { + to => 'idle2', + }, + }, 'hover2' => { 'press' => { to => 'pressed2', notify => $event2On, }, 'leave' => { - to => 'idle2', + to => 'idle2_tmp', } }, 'pressed2' => { |