Update of /cvsroot/htoolkit/gio/src/examples/simple
In directory sc8-pr-cvs1:/tmp/cvs-serv11074/gio/src/examples/simple
Modified Files:
Hanoi.hs SimpleMenu.hs
Log Message:
Simplified API for MenuRadioItems
Index: Hanoi.hs
===================================================================
RCS file: /cvsroot/htoolkit/gio/src/examples/simple/Hanoi.hs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Hanoi.hs 13 Jul 2003 18:25:58 -0000 1.2
--- Hanoi.hs 15 Aug 2003 21:24:54 -0000 1.3
***************
*** 34,49 ****
mhanoi <- menu [title =: "&Hanoi"] mainMenu
mrun <- menu [title =: "&Run (nr disks)"] mhanoi
! rg1 <- menuRadioGroup [] mrun
! sequence [menuRadioItem [title =: show i, on command =: onRun i mrun mcont mhalt t w ref] rg1
! | i <- [minDisks..maxDisks]]
mhalt <- menuitem [title =: "Halt", accel =: KeyChar '.', enabled =: False, on command =: onHalt mrun mcont mhalt t] mhanoi
mcont <- menuitem [title =: "Continue", accel =: KeyChar ',', enabled =: False, on command =: onCont mrun mcont mhalt t] mhanoi
! mspeed <- menu [title =: "&Speed"] mhanoi
! rg2 <- menuRadioGroup [] mspeed
! menuRadioItem [title =: "V&ery Slow", accel =: KeyChar '\^A', on command =: onSetSpeed speed1 t] rg2
! menuRadioItem [title =: "&Slow", accel =: KeyChar '\^S', on command =: onSetSpeed speed2 t] rg2
! menuRadioItem [title =: "&Normal", accel =: KeyChar '\^D', on command =: onSetSpeed speed3 t] rg2
! menuRadioItem [title =: "&Fast", accel =: KeyChar '\^F', on command =: onSetSpeed speed4 t] rg2
! menuRadioItem [title =: "&Very Fast", accel =: KeyChar '\^G', on command =: onSetSpeed speed5 t] rg2
menuline mhanoi
menuitem [title =: "E&xit", on command =: halt] mhanoi
--- 34,48 ----
mhanoi <- menu [title =: "&Hanoi"] mainMenu
mrun <- menu [title =: "&Run (nr disks)"] mhanoi
! sequence [menuRadioItem [title =: show i, on command =: onRun i mrun mcont mhalt t w ref] mrun
! | i <- [minDisks..maxDisks]] >>= setMenuRadioGroup
mhalt <- menuitem [title =: "Halt", accel =: KeyChar '.', enabled =: False, on command =: onHalt mrun mcont mhalt t] mhanoi
mcont <- menuitem [title =: "Continue", accel =: KeyChar ',', enabled =: False, on command =: onCont mrun mcont mhalt t] mhanoi
! mspeed <- menu [title =: "&Speed"] mhanoi
! mVerySlow <- menuRadioItem [title =: "V&ery Slow", accel =: KeyChar '\^A', on command =: onSetSpeed speed1 t] mspeed
! mSlow <- menuRadioItem [title =: "&Slow", accel =: KeyChar '\^S', on command =: onSetSpeed speed2 t] mspeed
! mNormal <- menuRadioItem [title =: "&Normal", accel =: KeyChar '\^D', on command =: onSetSpeed speed3 t] mspeed
! mFast <- menuRadioItem [title =: "&Fast", accel =: KeyChar '\^F', on command =: onSetSpeed speed4 t] mspeed
! mVeryFast <- menuRadioItem [title =: "&Very Fast", accel =: KeyChar '\^G', on command =: onSetSpeed speed5 t] mspeed
! setMenuRadioGroup [mVerySlow,mSlow,mNormal,mFast,mVeryFast]
menuline mhanoi
menuitem [title =: "E&xit", on command =: halt] mhanoi
Index: SimpleMenu.hs
===================================================================
RCS file: /cvsroot/htoolkit/gio/src/examples/simple/SimpleMenu.hs,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** SimpleMenu.hs 12 Jul 2003 08:08:49 -0000 1.8
--- SimpleMenu.hs 15 Aug 2003 21:24:54 -0000 1.9
***************
*** 32,43 ****
menuitem [title =: "&Exit", on command =: halt] fm
! cm <- menu [title =: "&Color"] mainMenu
! tgl <- menucheck [title =: "&Transparent", accel =: KeyChar '\^T'] cm
! set tgl [on command =: onToggleTransparent tgl]
! menuline cm
! rg <- menuRadioGroup [] cm
! menuRadioItem [title =: "&Red", on command =: messageAlert "RED COLOR" ] rg
! menuRadioItem [title =: "&Green", on command =: messageAlert "GREEN COLOR"] rg
! menuRadioItem [title =: "&Blue", on command =: messageAlert "BLUE COLOR" ] rg
where
onToggleTransparent tgl = do
--- 32,42 ----
menuitem [title =: "&Exit", on command =: halt] fm
! mColor <- menu [title =: "&Color"] mainMenu
! menucheck [title =: "&Transparent", accel =: KeyChar '\^T', on command =:: onToggleTransparent] mColor
! menuline mColor
! mRed <- menuRadioItem [title =: "&Red", on command =: messageAlert "RED COLOR" ] mColor
! mGreen <- menuRadioItem [title =: "&Green", on command =: messageAlert "GREEN COLOR"] mColor
! mBlue <- menuRadioItem [title =: "&Blue", on command =: messageAlert "BLUE COLOR" ] mColor
! setMenuRadioGroup [mRed, mGreen, mBlue]
where
onToggleTransparent tgl = do
|