|
From: <kr_...@us...> - 2003-06-21 10:14:50
|
Update of /cvsroot/htoolkit/gio/src/examples/simple
In directory sc8-pr-cvs1:/tmp/cvs-serv18900a
Modified Files:
Calculator.hs Progress.hs SimpleMenu.hs
Log Message:
Formatting
Index: Calculator.hs
===================================================================
RCS file: /cvsroot/htoolkit/gio/src/examples/simple/Calculator.hs,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Calculator.hs 17 Jun 2003 17:05:39 -0000 1.5
--- Calculator.hs 21 Jun 2003 10:14:47 -0000 1.6
***************
*** 10,16 ****
calculator
= do varst <- newVar (0,id)
! w <- window []
display <- label [title =: "0"] w
! keys <- mapM (\c -> button [title =: [c], on command =: cmd varst display c] w) "123+456-789*C0=/"
set w [layout =: (pad 10 (hglue <<< display)) ^^^ grid (matrix 4 (map (hfix 50) keys))]
where
--- 10,18 ----
calculator
= do varst <- newVar (0,id)
! w <- window [resizeable =: True]
display <- label [title =: "0"] w
! keys <- mapM (\c -> button [title =: [c]
! ,on command =: cmd varst display c] w)
! "123+456-789*C0=/"
set w [layout =: (pad 10 (hglue <<< display)) ^^^ grid (matrix 4 (map (hfix 50) keys))]
where
Index: Progress.hs
===================================================================
RCS file: /cvsroot/htoolkit/gio/src/examples/simple/Progress.hs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Progress.hs 30 May 2003 13:07:06 -0000 1.3
--- Progress.hs 21 Jun 2003 10:14:47 -0000 1.4
***************
*** 9,27 ****
demo = do
! w <- window [view =: sz 800 100, domain =: sz 800 80]
! tm <- timer [interval =: maxSpeed `div` 2]
! prg <- hProgressBar True [range =: (0,maxProgress)] w
! lbl <- label [title =: "Speed"] w
! sld <- hslider [range =: (0,maxSpeed), selectedPos =: maxSpeed `div` 2] w
! set w [layout =: (hfill prg ^^^ (lbl <<< hfill sld))]
! set tm [on command =: set prg [selectedPos ~: next]]
! set sld [on command =: changeSpeed tm sld]
! set w [on destroy =: destroyWidget tm]
! return ()
! where
! next x | x >= maxProgress = 0
! | otherwise = x+1
! changeSpeed tm sld = do
! pos <- get sld selectedPos
! set tm [interval =: maxSpeed-pos+20]
--- 9,27 ----
demo = do
! w <- window [view =: sz 800 100, domain =: sz 800 80]
! tm <- timer [interval =: maxSpeed `div` 2]
! prg <- hProgressBar True [range =: (0,maxProgress)] w
! lbl <- label [title =: "Speed"] w
! sld <- hslider [range =: (0,maxSpeed), selectedPos =: maxSpeed `div` 2] w
! set w [layout =: (hfill prg ^^^ (lbl <<< hfill sld))]
! set tm [on command =: set prg [selectedPos ~: next]]
! set sld [on command =: changeSpeed tm sld]
! set w [on destroy =: destroyWidget tm]
! return ()
! where
! next x | x >= maxProgress = 0
! | otherwise = x+1
! changeSpeed tm sld = do
! pos <- get sld selectedPos
! set tm [interval =: maxSpeed-pos+20]
Index: SimpleMenu.hs
===================================================================
RCS file: /cvsroot/htoolkit/gio/src/examples/simple/SimpleMenu.hs,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** SimpleMenu.hs 17 Jun 2003 17:05:39 -0000 1.6
--- SimpleMenu.hs 21 Jun 2003 10:14:47 -0000 1.7
***************
*** 12,20 ****
fm <- menu [title =: "&File"] mainMenu
! menuitem [title =: "&New", accel =: KeyChar '\^N', on command =: messageAlert "NEW", menuicon =: Just bmpNew] fm
! menuitem [title =: "&Open", accel =: KeyChar '\^O', on command =: messageAlert "OPEN", menuicon =: Just bmpOpen] fm
menuitem [title =: "&Close"] fm
menuline fm
! menuitem [title =: "&Save", accel =: KeyChar '\^S', on command =: messageAlert "SAVE", menuicon =: Just bmpSave] fm
menuline fm
menuitem [title =: "&Exit", on command =: halt] fm
--- 12,32 ----
fm <- menu [title =: "&File"] mainMenu
! menuitem [title =: "&New"
! ,accel =: KeyChar '\^N'
! ,on command =: messageAlert "NEW"
! ,menuicon =: Just bmpNew
! ] fm
! menuitem [title =: "&Open"
! ,accel =: KeyChar '\^O'
! , on command =: messageAlert "OPEN"
! , menuicon =: Just bmpOpen
! ] fm
menuitem [title =: "&Close"] fm
menuline fm
! menuitem [title =: "&Save"
! ,accel =: KeyChar '\^S'
! ,on command =: messageAlert "SAVE"
! , menuicon =: Just bmpSave
! ] fm
menuline fm
menuitem [title =: "&Exit", on command =: halt] fm
|