From 2b7266dc0591818d289ff215fff8acd031de7366 Mon Sep 17 00:00:00 2001 From: caramel Date: Wed, 12 Sep 2007 09:55:12 +0000 Subject: Amelioration optionnelle du RadioBouton, qui desormais accepte l'etat de survol --- src/MTools/Widget/MRadioBouton.pm | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src') diff --git a/src/MTools/Widget/MRadioBouton.pm b/src/MTools/Widget/MRadioBouton.pm index 1dfa1a4..768a00d 100644 --- a/src/MTools/Widget/MRadioBouton.pm +++ b/src/MTools/Widget/MRadioBouton.pm @@ -36,6 +36,7 @@ sub new { bless $self, $class; my $on = $options {g_on}; + my $over = defined $options {g_over} ? $options {g_over} : $on; my $off = $options {g_off}; $self -> recordEvent ('RELEASE'); @@ -44,6 +45,8 @@ sub new { my @gon; push (@gon, $on); + my @gover; + push (@gover, $over); my @goff; push (@goff, $off); @@ -59,17 +62,32 @@ sub new { my $sw = new MTools::MSwitch ( $self, on => \@gon, + over => \@gover, off => \@goff, ); my $st = new MTools::MState ( current_state => 'on', events => { + enter => [$self, ''], + leave => [$self, ''], press => [$self, ''], press2 => [$self, 'PRESS'], release => [$self, 'RELEASE'], }, transitions => { on => { + enter => { + to => 'over', + }, + press2 => { + to => 'off', + notify => 'PRESSED', + }, + }, + over => { + leave => { + to => 'on', + }, press => { to => 'off', notify => 'PRESSED', -- cgit v1.1