|
From: <kr_...@us...> - 2003-05-30 12:07:39
|
Update of /cvsroot/htoolkit/gio/src/examples/simple
In directory sc8-pr-cvs1:/tmp/cvs-serv12556
Modified Files:
BitmapViewer.hs BouncingBalls.hs SimpleDrawing.hs
Log Message:
Update samples after changes in Canvas API
Index: BitmapViewer.hs
===================================================================
RCS file: /cvsroot/htoolkit/gio/src/examples/simple/BitmapViewer.hs,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** BitmapViewer.hs 26 Apr 2003 21:05:44 -0000 1.6
--- BitmapViewer.hs 30 May 2003 11:58:16 -0000 1.7
***************
*** 10,14 ****
main
! = start MDI [title =: "Bitmap Viewer"] $
do mfile <- menu [title =: "&File"] mainMenu
mopen <- menuitem [title =: "&Open"] mfile
--- 10,14 ----
main
! = start "Bitmap Viewer" "1.0" MDI [] $
do mfile <- menu [title =: "&File"] mainMenu
mopen <- menuitem [title =: "&Open"] mfile
***************
*** 31,35 ****
paintImage image can updFrame updAreas
! = do bitmap (pt 0 0) image can
openBitmapWindow mclose fname = do
--- 31,35 ----
paintImage image can updFrame updAreas
! = do drawBitmap (pt 0 0) image can
openBitmapWindow mclose fname = do
Index: BouncingBalls.hs
===================================================================
RCS file: /cvsroot/htoolkit/gio/src/examples/simple/BouncingBalls.hs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** BouncingBalls.hs 2 Apr 2003 21:33:55 -0000 1.3
--- BouncingBalls.hs 30 May 2003 11:58:16 -0000 1.4
***************
*** 4,13 ****
main
! = start SDI [] balls
balls
= do vballs <- newVar []
! w <- window [title =: "Bouncing balls", resizeable =: True, view =: sz maxX maxY]
set w [ on paint =: paintBalls vballs
, on click =: dropBall w vballs
--- 4,13 ----
main
! = start "Bouncing balls" "1.0" SDI [] balls
balls
= do vballs <- newVar []
! w <- window [resizeable =: True, view =: sz maxX maxY]
set w [ on paint =: paintBalls vballs
, on click =: dropBall w vballs
***************
*** 40,50 ****
paintBalls vballs can updframe updareas
! = do box updframe [color =: lightgray] can
balls <- getVar vballs
mapM_ (drawBall can) (map head (filter (not.null) balls))
drawBall can pt
! = do oval pt radius radius [color =: red] can
! ellipse pt radius radius [] can
--- 40,53 ----
paintBalls vballs can updframe updareas
! = do setCanvasPen can [color =: lightgray]
! fillRect updframe can
balls <- getVar vballs
mapM_ (drawBall can) (map head (filter (not.null) balls))
drawBall can pt
! = do setCanvasPen can [color =: red]
! fillEllipse pt radius radius can
! setCanvasPen can [color =: black]
! drawEllipse pt radius radius can
Index: SimpleDrawing.hs
===================================================================
RCS file: /cvsroot/htoolkit/gio/src/examples/simple/SimpleDrawing.hs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** SimpleDrawing.hs 2 Apr 2003 21:33:55 -0000 1.4
--- SimpleDrawing.hs 30 May 2003 11:58:16 -0000 1.5
***************
*** 4,34 ****
main
! = start SDI [] $
! do w <- window [title =: "Hello world", width =: 600, height =: 600
! ,on paint =: mypaint
]
set w [on motion =: \p -> set w [title =: ("mouse is at " ++ show p)]]
where
! mypaint c updFrame updArea
! = do rectangle (rect (pt 50 50) (pt 200 200)) [thickness =: 10, color =: blue] c
! polyline [pt 150 250,pt 50 300,pt 200 300] [color =: red] c
! ellipse (pt 100 375) 50 25 [color=:green, thickness =: 5] c
! arc (pt 100 450) 50 25 0 (0.5*pi) [color=:red, thickness=:5] c
! box (rect (pt 250 50) (pt 450 200)) [color =: red] c
! polygon [pt 350 250,pt 250 300,pt 400 300] [color =: red] c
! oval (pt 300 375) 50 25 [color=:green] c
! pie (pt 300 450) 50 25 0 (0.5*pi) [color=:red] c
!
! line (pt 30 30) (pt 200 150) [thickness =: 15, color =: magenta] c
! disc (pt 70 70) 10 [color =: yellow] c
! circle (pt 70 70) 10 [color =: black] c
!
! write (pt 100 100) [text =: "Some text", color =: blue] c
!
! sserif14b <- (createFont (sansSerifFontDef{ fontSize = 14, fontWeight = fontBoldWeight })
! `catch` \err -> return defaultFont)
! write (pt 120 120) [text =: "14pt bold sans serif text", color =: black, font =: sserif14b ] c
--- 4,47 ----
main
! = start "SimpleDrawing" "1.0" SDI [] $
! do sserif14b <- createFont (sansSerifFontDef{fontSize = 14, fontWeight = fontBoldWeight})
! w <- window [title =: "Hello world", width =: 600, height =: 600
! ,on paint =: mypaint sserif14b
]
set w [on motion =: \p -> set w [title =: ("mouse is at " ++ show p)]]
where
! mypaint sserif14b c updFrame updArea
! = do setCanvasPen c [thickness =: 10, color =: blue]
! drawRect (rect (pt 50 50) (pt 200 200)) c
! setCanvasPen c [color =: red]
! drawPolyline [pt 150 250,pt 50 300,pt 200 300] c
!
! setCanvasPen c [color=:green, thickness =: 5]
! drawEllipse (pt 100 375) 50 25 c
!
! setCanvasPen c [color=:red]
! drawArc (pt 100 450) 50 25 0 (0.5*pi) c
! fillRect (rect (pt 250 50) (pt 450 200)) c
! drawPolygon [pt 350 250,pt 250 300,pt 400 300] c
!
! setCanvasPen c [color=:green]
! fillEllipse (pt 300 375) 50 25 c
!
! setCanvasPen c [color=:red]
! fillPie (pt 300 450) 50 25 0 (0.5*pi) c
+ setCanvasPen c [thickness =: 15, color =: magenta]
+ drawLine (pt 30 30) (pt 200 150) c
+
+ setCanvasPen c [color =: yellow]
+ fillCircle (pt 70 70) 10 c
+ setCanvasPen c [color =: black]
+ drawCircle (pt 70 70) 10 c
+ setCanvasPen c [color =: blue]
+ drawString (pt 100 100) "Some text" c
+
+ setCanvasPen c [color =: black, font =: sserif14b]
+ drawString (pt 120 120) "14pt bold sans serif text" c
|