From: <kr_...@us...> - 2003-08-21 23:42:29
|
Update of /cvsroot/htoolkit/gio/src/Graphics/UI/GIO In directory sc8-pr-cvs1:/tmp/cvs-serv26881/gio/src/Graphics/UI/GIO Modified Files: CommonDialogs.hs Controls.hs Events.hs Layout.hs Window.hs Log Message: Implementation for CompoundControl Index: CommonDialogs.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/CommonDialogs.hs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** CommonDialogs.hs 12 Aug 2003 17:38:12 -0000 1.5 --- CommonDialogs.hs 20 Aug 2003 21:37:25 -0000 1.6 *************** *** 24,27 **** --- 24,28 ---- import Graphics.UI.GIO.Types import Graphics.UI.GIO.Attributes + import Graphics.UI.GIO.Layout import Graphics.UI.GIO.Window import qualified Graphics.UI.Port as Lib Index: Controls.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Controls.hs,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Controls.hs 17 Jul 2003 19:30:04 -0000 1.18 --- Controls.hs 20 Aug 2003 21:37:26 -0000 1.19 *************** *** 22,25 **** --- 22,26 ---- , CheckGroup, checkGroup, checkLayout , RadioGroup, radioGroup, radioLayout + , CompoundControl, compoundControl -- * Primitive , Check, check *************** *** 31,35 **** import Graphics.UI.GIO.Attributes import Graphics.UI.GIO.Events ! import Graphics.UI.GIO.Window import Graphics.UI.GIO.Layout import Control.Monad(when, mapM_, filterM) --- 32,36 ---- import Graphics.UI.GIO.Attributes import Graphics.UI.GIO.Events ! import Graphics.UI.GIO.Canvas import Graphics.UI.GIO.Layout import Control.Monad(when, mapM_, filterM) *************** *** 61,65 **** -- | Create a text label. ! label :: [Prop Label] -> Window -> IO Label label props w = do lab <- do hlab <- Port.createLabel (hwindow w) --- 62,66 ---- -- | Create a text label. ! label :: Container w => [Prop Label] -> w -> IO Label label props w = do lab <- do hlab <- Port.createLabel (hwindow w) *************** *** 99,103 **** -- | Create a button. ! button :: [Prop Button] -> Window -> IO Button button props w = do but <- do hbut <- Port.createButton (hwindow w) --- 100,104 ---- -- | Create a button. ! button :: Container w => [Prop Button] -> w -> IO Button button props w = do but <- do hbut <- Port.createButton (hwindow w) *************** *** 141,145 **** -- | Create an entry. ! entry :: [Prop Entry] -> Window -> IO Entry entry props w = do e <- do hentry <- Port.createEdit (hwindow w) --- 142,146 ---- -- | Create an entry. ! entry :: Container w => [Prop Entry] -> w -> IO Entry entry props w = do e <- do hentry <- Port.createEdit (hwindow w) *************** *** 189,193 **** -- | Create a popup selection box. ! popup :: [Prop Popup] -> Window -> IO Popup popup props w = do p <- do hpop <- Port.createPopUp (hwindow w) --- 190,194 ---- -- | Create a popup selection box. ! popup :: Container w => [Prop Popup] -> w -> IO Popup popup props w = do p <- do hpop <- Port.createPopUp (hwindow w) *************** *** 269,273 **** -- | Create a list box. ! listBox :: Bool -> [Prop ListBox] -> Window -> IO ListBox listBox multi props w = do lb <- do --- 270,274 ---- -- | Create a list box. ! listBox :: Container w => Bool -> [Prop ListBox] -> w -> IO ListBox listBox multi props w = do lb <- do *************** *** 356,360 **** -- The items are specified by their label, their initial check state and their -- event handlers (that receive the current check state as an argument). ! checkGroup :: [(String,Bool,Bool -> IO ())] -> [Prop CheckGroup] -> Window -> IO CheckGroup checkGroup items props w = do cg <- do cs <- mapM (\(txt,c,cmd) -> check txt [checked =: c, on command =:: checkCommand cmd] w) items --- 357,361 ---- -- The items are specified by their label, their initial check state and their -- event handlers (that receive the current check state as an argument). ! checkGroup :: Container w => [(String,Bool,Bool -> IO ())] -> [Prop CheckGroup] -> w -> IO CheckGroup checkGroup items props w = do cg <- do cs <- mapM (\(txt,c,cmd) -> check txt [checked =: c, on command =:: checkCommand cmd] w) items *************** *** 410,414 **** -- | Create a new radio control group that is initially layed out vertically. ! radioGroup :: [(String,IO ())] -> [Prop RadioGroup] -> Window -> IO RadioGroup radioGroup items props w = do rg <- do rs <- mapM (\(first,(txt,cmd)) -> radioEx first txt [] w) (zip (True:repeat False) items) --- 411,415 ---- -- | Create a new radio control group that is initially layed out vertically. ! radioGroup :: Container w => [(String,IO ())] -> [Prop RadioGroup] -> w -> IO RadioGroup radioGroup items props w = do rg <- do rs <- mapM (\(first,(txt,cmd)) -> radioEx first txt [] w) (zip (True:repeat False) items) *************** *** 465,469 **** -- | Create a check control with a certain label. ! check :: String -> [Prop Check] -> Window -> IO Check check txt props w = do c <- do hcheck <- Port.createCheckBox (hwindow w) txt --- 466,470 ---- -- | Create a check control with a certain label. ! check :: Container w => String -> [Prop Check] -> w -> IO Check check txt props w = do c <- do hcheck <- Port.createCheckBox (hwindow w) txt *************** *** 500,504 **** -- | Create a radio control with a certain label. ! radio :: String -> [Prop Radio] -> Window -> IO Radio radio txt props w = radioEx True txt props w --- 501,505 ---- -- | Create a radio control with a certain label. ! radio :: Container w => String -> [Prop Radio] -> w -> IO Radio radio txt props w = radioEx True txt props w *************** *** 506,510 **** -- | Create a radio control. Takes an extra argument that specifies -- that this is the first control in a group. ! radioEx :: Bool -> String -> [Prop Radio] -> Window -> IO Radio radioEx first txt props w = do r <- do hradio <- Port.createRadioBox (hwindow w) first txt --- 507,511 ---- -- | Create a radio control. Takes an extra argument that specifies -- that this is the first control in a group. ! radioEx :: Container w => Bool -> String -> [Prop Radio] -> w -> IO Radio radioEx first txt props w = do r <- do hradio <- Port.createRadioBox (hwindow w) first txt *************** *** 556,560 **** -- | Create a horizontal slider control. ! hslider :: [Prop Slider] -> Window -> IO Slider hslider props w = do r <- do shandle <- Port.createHorzSlider (hwindow w) --- 557,561 ---- -- | Create a horizontal slider control. ! hslider :: Container w => [Prop Slider] -> w -> IO Slider hslider props w = do r <- do shandle <- Port.createHorzSlider (hwindow w) *************** *** 564,568 **** -- | Create a vertical slider control. ! vslider :: [Prop Slider] -> Window -> IO Slider vslider props w = do r <- do shandle <- Port.createVertSlider (hwindow w) --- 565,569 ---- -- | Create a vertical slider control. ! vslider :: Container w => [Prop Slider] -> w -> IO Slider vslider props w = do r <- do shandle <- Port.createVertSlider (hwindow w) *************** *** 599,603 **** -- | Create a horizontal progress bar. -- The boolean parameter specify whether the bar shows continuous or discrete values. ! hProgressBar :: Bool -> [Prop ProgressBar] -> Window -> IO ProgressBar hProgressBar smooth props w = do r <- do pbhandle <- Port.createHorzProgressBar (hwindow w) smooth --- 600,604 ---- -- | Create a horizontal progress bar. -- The boolean parameter specify whether the bar shows continuous or discrete values. ! hProgressBar :: Container w => Bool -> [Prop ProgressBar] -> w -> IO ProgressBar hProgressBar smooth props w = do r <- do pbhandle <- Port.createHorzProgressBar (hwindow w) smooth *************** *** 610,614 **** -- | Create a vertical progress bar. -- The boolean parameter specify whether the bar shows continuous or discrete values. ! vProgressBar :: Bool -> [Prop ProgressBar] -> Window -> IO ProgressBar vProgressBar smooth props w = do r <- do pbhandle <- Port.createVertProgressBar (hwindow w) smooth --- 611,615 ---- -- | Create a vertical progress bar. -- The boolean parameter specify whether the bar shows continuous or discrete values. ! vProgressBar :: Container w => Bool -> [Prop ProgressBar] -> w -> IO ProgressBar vProgressBar smooth props w = do r <- do pbhandle <- Port.createVertProgressBar (hwindow w) smooth *************** *** 636,637 **** --- 637,750 ---- instance Control ProgressBar where pack w = stdPack (pbparent w) (Port.getProgressBarRequestSize (pbhandle w)) (Port.moveResizeControl (pbhandle w)) + + + -------------------------------------------------------------------- + -- CompoundControl + -------------------------------------------------------------------- + -- | A compound control. + data CompoundControl = CompoundControl + { cchandle :: !WindowHandle + , ccparent :: !WindowHandle + , vdomain :: Var Size + , vautosize :: Var Bool + , vpen :: Var Pen + , vbufferMode :: Var BufferMode + , vpaint :: Var PaintFunction + , vlayout :: Var Layout + } + + -- | Create a window + compoundControl :: Container w => [Prop CompoundControl] -> w -> IO CompoundControl + compoundControl props w + = do c <- do cchandle <- Port.createCompoundControl (hwindow w) + vpaint <- newVar (\_ _ _ -> return ()) + vautosize <- newVar True + vlayout <- newVar empty + vdomain <- newVar (sz 0 0) + vpen <- newVar defaultPen + vbufferMode<- newVar UnBuffered + return (CompoundControl cchandle (hwindow w) vdomain vautosize vpen vbufferMode vpaint vlayout) + recolorCompound c + set c [on relayout =:: relayoutCompound] + -- just by setting a dummy paint function, we will at least intialize the canvas properly on a repaint + set c [on paint =: (\_ _ _ -> return ())] + set c props + return c + + relayoutCompound :: CompoundControl -> IO () + relayoutCompound c + = do frame <- Port.getControlFrame (cchandle c) + domain <- get c domain + lay <- getVar (vlayout c) + needed <- getLayoutSize lay + let d1 = maxSize domain needed + d2 = maxSize d1 (rectSize frame) + Port.setWindowDomainSize (cchandle c) d1 + layoutInRect (rectOfSize d2) lay + return () + + recolorCompound :: CompoundControl -> IO () + recolorCompound c + = do col <- get c color + bgcol <- get c bgcolor + hat <- get c hatch + Port.setWindowColor (cchandle c) col bgcol hat + repaint c + relayoutCompound c + + instance Scrollable CompoundControl where + scroll = newScrollEvent cchandle + domain = newAttr (\c -> getVar (vdomain c)) + (\c x -> setVar (vdomain c) x >> relayoutCompound c) + origin = newAttr (Port.getWindowScrollOrigin . cchandle) (Port.setWindowScrollOrigin . cchandle) + + instance Dimensions CompoundControl where + frame = newAttr (Port.getControlFrame . cchandle) (Port.moveResizeControl . cchandle) + + instance Drawn CompoundControl where + pen = newAttr (getVar . vpen) (\w pen -> setVar (vpen w) pen >> recolorCompound w) + + bufferMode = newAttr (getVar . vbufferMode) (setVar . vbufferMode) + + instance HasFont CompoundControl where + font = mapAttr penFont (\pen c -> pen{penFont=c}) pen + + instance Reactive CompoundControl where + mouse = newMouseEvent cchandle + keyboard = newKeyboardEvent cchandle + contextMenu = newContextMenuEvent cchandle + + instance Paint CompoundControl where + repaint c = do Port.invalidateWindow (cchandle c) + paint = newPaintEvent vpaint wndpaint cchandle + where + wndpaint c paintfun hcanvas updArea + = do pen <- get c pen + bmode <- get c bufferMode + withCanvas bmode pen hcanvas $ \can -> paintfun can updArea [] + paintIn c bmode f = do + pen <- get c pen + Port.drawInWindow (cchandle c) (\hcanvas -> withCanvas bmode pen hcanvas f) + + instance Able CompoundControl where + enabled = newAttr (Port.getControlEnabled . cchandle) (Port.setControlEnabled . cchandle) + + instance Container CompoundControl where + layout + = writeAttr "layout" (\w c -> do + let lay = pack c + autosize <- get w autosize + domain <- get w domain + needed <- getLayoutSize lay + let d = maxSize domain needed + Port.setWindowDomainSize (cchandle w) d + frame <- Port.getControlFrame (cchandle w) + layoutInRect (rectOfSize (maxSize d (rectSize frame))) lay + setVar (vlayout w) lay) + autosize = readAttr "autosize" (\c -> return False) + layoutSize = readAttr "layoutSize" (\c -> getVar (vlayout c) >>= getLayoutSize) + relayout = stdWindowEvent Port.getWindowReLayoutHandler Port.setWindowReLayoutHandler Port.setWindowReLayoutDefHandler cchandle + hwindow c = cchandle c + + instance Control CompoundControl where + pack w = stdPack (ccparent w) (Port.getCompoundControlRequestSize (cchandle w)) (Port.moveResizeControl (cchandle w)) Index: Events.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Events.hs,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Events.hs 17 Jul 2003 19:30:05 -0000 1.14 --- Events.hs 20 Aug 2003 21:37:26 -0000 1.15 *************** *** 73,78 **** , mouse, keyboard, contextMenu ! -- ** Form ! , Form, activate, deactivate, scroll, resize -- ** Dismissible --- 73,81 ---- , mouse, keyboard, contextMenu ! -- ** TopLevel ! , TopLevel, activate, deactivate, resize, resizeable ! ! -- ** Scrollable ! , Scrollable, scroll, domain, origin -- ** Dismissible *************** *** 85,89 **** -- ** Paint ! , Paint, paint, repaint , PaintFunction --- 88,92 ---- -- ** Paint ! , Paint, paint, repaint, paintIn , PaintFunction *************** *** 160,163 **** --- 163,167 ---- class Commanding w where command :: Event w (IO ()) + -- | The widgets which are members of 'DynamicUpdate' class has 'update' *************** *** 166,176 **** update :: Event w (IO ()) ! -- | A form is a visible window on the screen. ! class Form w where ! activate :: Event w (IO ()) ! deactivate:: Event w (IO ()) ! scroll :: Event w (Point -> IO ()) ! resize :: Event w (Size -> IO ()) -- | The Dismissible widgets can be dissmissed class Dismissible w where --- 170,199 ---- update :: Event w (IO ()) ! ! -- | A top level widget is a widget which doesn't have parents. ! class TopLevel w where ! activate :: Event w (IO ()) ! deactivate :: Event w (IO ()) ! resize :: Event w (Size -> IO ()) + -- | Sets\/Gets whether the user can resize a widget. + -- Widgets are user resizable by default. + resizeable :: Attr w Bool + + + class Scrollable w where + -- | The event is generated when the user change the current + -- position of the scollbars + scroll :: Event w (Point -> IO ()) + + -- | The size of view domain of the widget. If it is larger than + -- the current view size, scroll bars will appear automatically. + domain :: Attr w Size + + -- | The current position of the scrollbars. The position is given + -- relatively to the begining of the domain. + origin :: Attr w Point + + -- | The Dismissible widgets can be dissmissed class Dismissible w where *************** *** 181,184 **** --- 204,208 ---- dismiss :: Event w (IO ()) + -- | The Deadly widgets can be destroyed. class Deadly w where *************** *** 188,191 **** --- 212,216 ---- destroy :: Event w (IO ()) + -- | Reactive widgets react to mouse and keyboard events class Reactive w where *************** *** 194,197 **** --- 219,223 ---- contextMenu :: Event w (Point -> Modifiers -> IO ()) + -- | Widgets that can be repainted. class Paint w where *************** *** 201,204 **** --- 227,235 ---- -- | Explicitly force a 'paint' event. repaint :: w -> IO () + + -- | The paintIn executes the given function with canvas + -- associated with the given widget. + paintIn :: w -> BufferMode -> (Canvas -> IO a) -> IO a + -- | A paint function takes a canvas, the update bound rectangle Index: Layout.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Layout.hs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Layout.hs 2 Jul 2003 20:04:45 -0000 1.6 --- Layout.hs 20 Aug 2003 21:37:26 -0000 1.7 *************** *** 9,13 **** The layout module helps to position controls (i.e. buttons, listboxes, etc) on ! a widget. Allthough it is possible to position them by hand using the 'Dimensions' class, it is much easier to position them using layout combinators. Furthermore, the parent widget will automatically reposition them when for example the size of --- 9,13 ---- The layout module helps to position controls (i.e. buttons, listboxes, etc) on ! a container. Allthough it is possible to position them by hand using the 'Dimensions' class, it is much easier to position them using layout combinators. Furthermore, the parent widget will automatically reposition them when for example the size of *************** *** 88,91 **** --- 88,98 ---- , pack , Layout + -- * Containers + , Container + , layout + , autosize + , layoutSize + , relayout + , hwindow -- * Operators , (^^^^), (<<<<), (^^^), (<<<) *************** *** 121,124 **** --- 128,132 ---- import Graphics.UI.GIO.Types import Graphics.UI.GIO.Attributes + import Graphics.UI.GIO.Events infixl 7 <<<, <<<< *************** *** 163,170 **** --------------------------------------------------------------------} ! -- | Controls can be layed out on other widgets. See for example 'Graphics.UI.GIO.Window.layout'. class Control w where -- | Create a 'Layout' from a normal control. pack :: w -> Layout instance Control Layout where --- 171,206 ---- --------------------------------------------------------------------} ! -- | Controls can be layed out on containers. class Control w where -- | Create a 'Layout' from a normal control. pack :: w -> Layout + + + -- | The container is a widget which can layout other widget + class Container w where + -- | The layout of controls within the window. This + -- attribute is write-only. If a control is not assigned + -- to the layout, it will not show up + -- (unless explicitly positioned using its 'Dimensions'). + -- The window will automatically update the layout when + -- resized or when a control changes its appearance. + layout :: Control c => Attr w c + + -- | Controls whether the widget will automatically resize + -- to display all controls. + autosize :: Attr w Bool + + -- | The layoutSize of widget is the minimum size needed to + -- layout the controls assigned to it. This + -- attribute is read-only. + layoutSize :: Attr w Size + + -- | The 'relayout' event is called whenever the controls in the window need to + -- be repositioned. For example, when the window is resized or when a control changes + -- its appearance. + relayout :: Event w (IO ()) + + -- | Internal + hwindow :: w -> WindowHandle instance Control Layout where Index: Window.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Window.hs,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Window.hs 13 Jul 2003 10:22:56 -0000 1.21 --- Window.hs 20 Aug 2003 21:37:26 -0000 1.22 *************** *** 11,21 **** -} ----------------------------------------------------------------------------------------- ! module Graphics.UI.GIO.Window ! ( Window, window, domain, origin, resizeable, view, layout, autosize, layoutSize ! , dialog, runDialog ! , drawInWindow ! -- * Internal ! , hwindow ! ) where import qualified Graphics.UI.Port as Lib --- 11,15 ---- -} ----------------------------------------------------------------------------------------- ! module Graphics.UI.GIO.Window (Window, window, dialog, runDialog) where import qualified Graphics.UI.Port as Lib *************** *** 31,35 **** --------------------------------------------------------------------} -- | A main window widget. ! data Window = Window{ hwindow :: WindowHandle , vdomain :: Var Size , vresizeable :: Var Bool --- 25,29 ---- --------------------------------------------------------------------} -- | A main window widget. ! data Window = Window{ hwnd :: WindowHandle , vdomain :: Var Size , vresizeable :: Var Bool *************** *** 108,137 **** - -- | Controls whether the window will automatically resize to display all controls. - autosize :: Attr Window Bool - autosize - = varAttr vautosize - instance Titled Window where title = newAttr (\w -> Lib.getWindowTitle (hwindow w)) (\w x -> Lib.setWindowTitle (hwindow w) x) ! -- | The view domain of the window. If it is larger than the current view size, scroll bars ! -- will appear automatically. ! domain :: Attr Window Size ! domain ! = newAttr (\w -> getVar (vdomain w)) ! (\w x -> setVar (vdomain w) x >> relayoutWindow w) ! ! origin :: Attr Window Point ! origin = newAttr (Lib.getWindowScrollOrigin . hwindow) (Lib.setWindowScrollOrigin . hwindow) ! ! -- | Can the window be resized? ! resizeable :: Attr Window Bool ! resizeable ! = newAttr (\w -> getVar (vresizeable w)) ! (\w x -> do resize <- get w resizeable ! when (x /= resize) (do Lib.setWindowResizeable (hwindow w) x ! setVar (vresizeable w) x)) -- | The size of the current view area. --- 102,114 ---- instance Titled Window where title = newAttr (\w -> Lib.getWindowTitle (hwindow w)) (\w x -> Lib.setWindowTitle (hwindow w) x) ! instance Scrollable Window where ! scroll = newScrollEvent hwindow ! domain = newAttr (\w -> getVar (vdomain w)) ! (\w x -> setVar (vdomain w) x >> relayoutWindow w) ! origin = newAttr (Lib.getWindowScrollOrigin . hwindow) (Lib.setWindowScrollOrigin . hwindow) -- | The size of the current view area. *************** *** 166,175 **** contextMenu = newContextMenuEvent hwindow ! instance Form Window where activate = newActivateEvent hwindow deactivate= newDeactivateEvent hwindow - scroll = newScrollEvent hwindow resize = newResizeEvent hwindow ! instance Paint Window where repaint w = do Lib.invalidateWindow (hwindow w) --- 143,156 ---- contextMenu = newContextMenuEvent hwindow ! instance TopLevel Window where activate = newActivateEvent hwindow deactivate= newDeactivateEvent hwindow resize = newResizeEvent hwindow ! resizeable ! = newAttr (\w -> getVar (vresizeable w)) ! (\w x -> do resize <- get w resizeable ! when (x /= resize) (do Lib.setWindowResizeable (hwindow w) x ! setVar (vresizeable w) x)) ! instance Paint Window where repaint w = do Lib.invalidateWindow (hwindow w) *************** *** 180,204 **** bmode <- get w bufferMode withCanvas bmode pen hcanvas $ \can -> paintfun can updArea [] ! instance Able Window where enabled = newAttr (Lib.getWindowEnabled . hwindow) (Lib.setWindowEnabled . hwindow) ! ! -- layout ! -- | The 'relayout' event is called whenever the controls in the window need to ! -- be repositioned. For example, when the window is resized or when a control changes ! -- its appearance. ! relayout :: Event Window (IO ()) ! relayout ! = stdWindowEvent Lib.getWindowReLayoutHandler Lib.setWindowReLayoutHandler Lib.setWindowReLayoutDefHandler hwindow ! ! ! -- | The layout of controls within the window. This attribute is write-only. If a control ! -- is not assigned to the layout, it will not show up (unless explicitly positioned using ! -- its 'Dimensions'). The window will automatically update the layout when resized or ! -- when a control changes its appearance. See also "Graphics.UI.GIO.Layout". ! layout :: Control c => Attr Window c ! layout ! = writeAttr "layout" (\w c -> do let lay = pack c autosize <- get w autosize --- 161,174 ---- bmode <- get w bufferMode withCanvas bmode pen hcanvas $ \can -> paintfun can updArea [] ! paintIn w bmode f = do ! pen <- get w pen ! Lib.drawInWindow (hwindow w) (\hcanvas -> withCanvas bmode pen hcanvas f) ! instance Able Window where enabled = newAttr (Lib.getWindowEnabled . hwindow) (Lib.setWindowEnabled . hwindow) ! instance Container Window where ! layout ! = writeAttr "layout" (\w c -> do let lay = pack c autosize <- get w autosize *************** *** 211,225 **** layoutInRect (rectOfSize (maxSize d view)) lay setVar (vlayout w) lay) ! ! -- | The layoutSize of window is the minimum size needed to layout ! -- the controls assigned to it. ! layoutSize :: Attr Window Size ! layoutSize ! = readAttr "layoutSize" (\w -> getVar (vlayout w) >>= getLayoutSize) ! ! -- | 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) --- 181,186 ---- layoutInRect (rectOfSize (maxSize d view)) lay setVar (vlayout w) lay) ! autosize = varAttr vautosize ! layoutSize = readAttr "layoutSize" (\w -> getVar (vlayout w) >>= getLayoutSize) ! relayout = stdWindowEvent Lib.getWindowReLayoutHandler Lib.setWindowReLayoutHandler Lib.setWindowReLayoutDefHandler hwindow ! hwindow w = hwnd w |