aboutsummaryrefslogtreecommitdiff
path: root/src/MTools
diff options
context:
space:
mode:
authorcaramel2007-08-24 16:19:35 +0000
committercaramel2007-08-24 16:19:35 +0000
commit1ecfa6ed54d93ee5e6d59ae2fe4cbf82a5ced5c7 (patch)
treebd1ad21cc978eff7854db3cd41e1f5a97abd598e /src/MTools
parent9611f8deb6b7d665ee8caa87473cb7b0872a82af (diff)
downloadmtc-1ecfa6ed54d93ee5e6d59ae2fe4cbf82a5ced5c7.zip
mtc-1ecfa6ed54d93ee5e6d59ae2fe4cbf82a5ced5c7.tar.gz
mtc-1ecfa6ed54d93ee5e6d59ae2fe4cbf82a5ced5c7.tar.bz2
mtc-1ecfa6ed54d93ee5e6d59ae2fe4cbf82a5ced5c7.tar.xz
modifications de la gestion des events par le MToggleButton
Diffstat (limited to 'src/MTools')
-rw-r--r--src/MTools/Widget/MToggleBouton.pm50
1 files changed, 27 insertions, 23 deletions
diff --git a/src/MTools/Widget/MToggleBouton.pm b/src/MTools/Widget/MToggleBouton.pm
index cc13fec..a373b48 100644
--- a/src/MTools/Widget/MToggleBouton.pm
+++ b/src/MTools/Widget/MToggleBouton.pm
@@ -42,9 +42,11 @@ sub new {
my $off2 = minstance ($options {g_off2}, $self);
my $over2 = defined $options {g_over2} ? minstance ($options {g_over2}, $self) : $on2;
- my $eventOn = defined $options {e_press} ? $options {e_press} : 'PRESS';
- my $eventOff = defined $options {e_release} ? $options {e_release} : 'RELEASED';
- my $cb = $options {call} if (defined $options {call});
+ my $event1On = defined $options {e_press1} ? $options {e_press1} : 'PRESS1';
+ my $event1Off = defined $options {e_release1} ? $options {e_release1} : 'RELEASED1';
+ my $event2On = defined $options {e_press2} ? $options {e_press2} : 'PRESS2';
+ my $event2Off = defined $options {e_release2} ? $options {e_release2} : 'RELEASED2';
+# my $cb = $options {call} if (defined $options {call});
my @gon1;
push (@gon1, $on1);
@@ -103,6 +105,7 @@ sub new {
'hover2' => \@gover2,
'pressed2' => \@goff2,
);
+
my $st = new MTools::MState (
current_state => 'idle1',
events => {
@@ -118,13 +121,13 @@ sub new {
},
'press' => {
to => 'pressed1',
- notify => $eventOn,
+ notify => $event1On,
},
},
'hover1' => {
'press' => {
to => 'pressed1',
- notify => $eventOn,
+ notify => $event1On,
},
'leave' => {
to => 'idle1',
@@ -133,7 +136,7 @@ sub new {
'pressed1' => {
'release' => {
to => 'hover2',
- notify => $eventOff,
+ notify => $event1Off,
},
'leave' => {
to => 'idle1',
@@ -145,13 +148,13 @@ sub new {
},
'press' => {
to => 'pressed2',
- notify => $eventOn,
+ notify => $event2On,
},
},
'hover2' => {
'press' => {
to => 'pressed2',
- notify => $eventOn,
+ notify => $event2On,
},
'leave' => {
to => 'idle2',
@@ -160,7 +163,7 @@ sub new {
'pressed2' => {
'release' => {
to => 'hover1',
- notify => $eventOff,
+ notify => $event2Off,
},
'leave' => {
to => 'idle2',
@@ -170,18 +173,17 @@ sub new {
switchs => [$sw],
);
- $self -> propagate ($st, $eventOn);
- $self -> propagate ($st, $eventOff);
-
- if (defined $cb)
- {
- $st -> binding ($eventOn, sub {
- executer ($cb);
- });
- }
+# if (defined $cb)
+# {
+# $st -> binding ($eventOn, sub {
+# executer ($cb);
+# });
+# }
- $self -> propagate ($st, $eventOn);
- $self -> propagate ($st, $eventOff);
+ $self -> propagate ($st, $event1On);
+ $self -> propagate ($st, $event1Off);
+ $self -> propagate ($st, $event2On);
+ $self -> propagate ($st, $event2Off);
delete $options {g_on1} if defined $options {g_on1};
delete $options {g_off1} if defined $options {g_off1};
@@ -189,9 +191,11 @@ sub new {
delete $options {g_on2} if defined $options {g_on2};
delete $options {g_off2} if defined $options {g_off2};
delete $options {g_over2} if defined $options {g_over2};
- delete $options {e_press} if defined $options {e_press};
- delete $options {e_release} if defined $options {e_release};
- delete $options {call} if defined $options {call};
+ delete $options {e_press1} if defined $options {e_press1};
+ delete $options {e_release1} if defined $options {e_release1};
+ delete $options {e_press2} if defined $options {e_press2};
+ delete $options {e_release2} if defined $options {e_release2};
+# delete $options {call} if defined $options {call};
delete $options {text1} if defined $options {text1};
delete $options {g_text1} if defined $options {g_text1};
delete $options {text2} if defined $options {text2};