From: <kr_...@us...> - 2003-05-30 22:07:35
|
Update of /cvsroot/htoolkit/gio/src/Graphics/UI/GIO In directory sc8-pr-cvs1:/tmp/cvs-serv13786/src/Graphics/UI/GIO Modified Files: Attributes.hs Bitmap.hs Canvas.hs Window.hs Log Message: The bufferMode is added to Drawn class. Added functions drawInBitmap and drawInWindow functions. Index: Attributes.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Attributes.hs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Attributes.hs 30 May 2003 13:07:05 -0000 1.11 --- Attributes.hs 30 May 2003 21:55:06 -0000 1.12 *************** *** 52,56 **** -- ** Drawn ! , Drawn, pen, color, bgcolor, hatch , thickness, capstyle, linestyle, joinstyle --- 52,57 ---- -- ** Drawn ! , Drawn, bufferMode, pen ! , color, bgcolor, hatch , thickness, capstyle, linestyle, joinstyle *************** *** 221,224 **** --- 222,231 ---- class HasFont w => Drawn w where + + -- | The buffering mode. If the window is buffered then all + -- drawing operations are first performed to memory buffer and after + -- that the buffer is copied to the output device. + bufferMode :: Attr w BufferMode + -- | The pen pen :: Attr w Pen *************** *** 257,260 **** --- 264,268 ---- bkDrawMode :: Attr w Bool bkDrawMode = mapAttr penBkDrawMode (\pen m -> pen{penBkDrawMode=m}) pen + -- | Widgets with a title. Index: Bitmap.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Bitmap.hs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Bitmap.hs 7 Apr 2003 21:03:10 -0000 1.2 --- Bitmap.hs 30 May 2003 21:55:06 -0000 1.3 *************** *** 52,57 **** frame = newAttr (\b -> do sz <- Lib.getBitmapSize b; return (rectOfSize sz)) (\b r -> do Lib.setBitmapSize b (rectSize r)) - - {-------------------------------------------------------------------- - - --------------------------------------------------------------------} --- 52,53 ---- Index: Canvas.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Canvas.hs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Canvas.hs 30 May 2003 11:39:08 -0000 1.9 --- Canvas.hs 30 May 2003 21:55:06 -0000 1.10 *************** *** 31,34 **** --- 31,36 ---- Canvas, CanvasPen, Pen(..) , setCanvasPen, getCanvasPen + + , drawInBitmap -- * Drawing primitives *************** *** 77,86 **** data Canvas = Canvas{ hcanvas :: CanvasHandle , vpen :: Var Pen } ! newtype CanvasPen = CanvasPen (Var Pen) instance Drawn CanvasPen where ! pen = newAttr (\(CanvasPen vpen) -> getVar vpen) ! (\(CanvasPen vpen) -> setVar vpen) instance HasFont CanvasPen where --- 79,91 ---- data Canvas = Canvas{ hcanvas :: CanvasHandle , vpen :: Var Pen + , vmode :: BufferMode } ! data CanvasPen = CanvasPen (Var Pen) BufferMode instance Drawn CanvasPen where ! pen = newAttr (\(CanvasPen vpen _) -> getVar vpen) ! (\(CanvasPen vpen _) -> setVar vpen) ! ! bufferMode = readAttr "bufferMode" (\(CanvasPen _ vmode) -> return vmode) instance HasFont CanvasPen where *************** *** 88,102 **** setCanvasPen :: Canvas -> [Prop CanvasPen] -> IO () ! setCanvasPen (Canvas handle vpen) props = do ! set (CanvasPen vpen) props pen <- getVar vpen Port.changeCanvasPen pen handle getCanvasPen :: Canvas -> Attr CanvasPen a -> IO a ! getCanvasPen (Canvas handle vpen) = get (CanvasPen vpen) ! ! -- | The current font. ! penfont :: Attr CanvasPen Font ! penfont = mapAttr penFont (\pen c -> pen{penFont=c}) pen -- | The font metrics (read-only). --- 93,104 ---- setCanvasPen :: Canvas -> [Prop CanvasPen] -> IO () ! setCanvasPen (Canvas handle vpen vmode) props = do ! set (CanvasPen vpen vmode) props pen <- getVar vpen Port.changeCanvasPen pen handle getCanvasPen :: Canvas -> Attr CanvasPen a -> IO a ! getCanvasPen (Canvas handle vpen vmode) = get (CanvasPen vpen vmode) ! -- | The font metrics (read-only). *************** *** 139,143 **** withCanvas bmode pen handle f = do vpen <- newVar pen ! Port.withCanvas pen bmode handle (f (Canvas handle vpen)) -------------------------------------------------------------------- --- 141,151 ---- withCanvas bmode pen handle f = do vpen <- newVar pen ! Port.withCanvas pen bmode handle (f (Canvas handle vpen bmode)) ! ! -- | The drawInBitmap executes the given function with canvas ! -- associated with given Bitmap. ! drawInBitmap :: BufferMode -> Pen -> Bitmap -> (Canvas -> IO a) -> IO a ! drawInBitmap bmode pen bmp f = do ! Port.drawInBitmap bmp (\hcanvas -> withCanvas bmode pen hcanvas f) -------------------------------------------------------------------- Index: Window.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Window.hs,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Window.hs 30 May 2003 11:39:09 -0000 1.16 --- Window.hs 30 May 2003 21:55:07 -0000 1.17 *************** *** 14,17 **** --- 14,18 ---- ( Window, window, domain, resizeable, view, layout, autosize, bufferMode , dialog, runDialog + , drawInWindow -- * Internal , hwindow *************** *** 138,147 **** (\w sz-> Lib.setWindowViewSize (hwindow w) sz) - -- | The buffering mode for Window. If the window is buffered then all - -- drawing operations are first performed to memory buffer and after - -- that the buffer is copied to the screen. - bufferMode :: Attr Window BufferMode - bufferMode = newAttr (getVar . vbufferMode) (setVar . vbufferMode) - instance Dismissible Window where dismissWidget w = Lib.dismissWindow (hwindow w) --- 139,142 ---- *************** *** 159,162 **** --- 154,159 ---- pen = newAttr (getVar . vpen) (\w pen -> setVar (vpen w) pen >> recolorWindow w) + bufferMode = newAttr (getVar . vbufferMode) (setVar . vbufferMode) + instance HasFont Window where font = mapAttr penFont (\pen c -> pen{penFont=c}) pen *************** *** 201,203 **** layout :: Control c => Attr Window c layout ! = writeAttr "layout" (\w c -> do setVar (vlayout w) (pack c); relayoutWindow w) \ No newline at end of file --- 198,207 ---- layout :: Control c => Attr Window c layout ! = writeAttr "layout" (\w c -> do setVar (vlayout w) (pack c); relayoutWindow w) ! ! -- | The drawInWindow executes the given function with canvas ! -- associated with given window. ! drawInWindow :: BufferMode -> Window -> (Canvas -> IO a) -> IO a ! drawInWindow bmode w f = do ! pen <- get w pen ! Lib.drawInWindow (hwindow w) (\hcanvas -> withCanvas bmode pen hcanvas f) |