From: <kr_...@us...> - 2003-07-02 20:04:48
|
Update of /cvsroot/htoolkit/gio/src/Graphics/UI/GIO In directory sc8-pr-cvs1:/tmp/cvs-serv23825/src/Graphics/UI/GIO Modified Files: Window.hs Layout.hs Log Message: better support for control layout. In the new scheme the controls are placed into the domain rectangle instead of view rectangle Index: Window.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Window.hs,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Window.hs 8 Jun 2003 19:42:13 -0000 1.19 --- Window.hs 2 Jul 2003 20:04:45 -0000 1.20 *************** *** 1,8 **** ----------------------------------------------------------------------------------------- {-| Module : Window ! Copyright : (c) Daan Leijen 2003 License : BSD-style ! Maintainer : da...@cs... Stability : provisional Portability : portable --- 1,8 ---- ----------------------------------------------------------------------------------------- {-| Module : Window ! Copyright : (c) Krasimir Angelov 2003 License : BSD-style ! Maintainer : ka2...@ya... Stability : provisional Portability : portable *************** *** 12,16 **** ----------------------------------------------------------------------------------------- module Graphics.UI.GIO.Window ! ( Window, window, domain, resizeable, view, layout, autosize , dialog, runDialog , drawInWindow --- 12,16 ---- ----------------------------------------------------------------------------------------- module Graphics.UI.GIO.Window ! ( Window, window, domain, resizeable, view, layout, autosize, layoutSize , dialog, runDialog , drawInWindow *************** *** 89,100 **** relayoutWindow :: Window -> IO () relayoutWindow w ! = do lay <- getVar (vlayout w) ! adjust <- get w autosize ! when adjust ( ! do needed <- getLayoutSize lay ! avail <- get w view ! isresize <- get w resizeable ! when (not (sizeEncloses avail needed)) (set w [view =: needed])) ! layoutInWindow (hwindow w) lay return () --- 89,100 ---- relayoutWindow :: Window -> IO () relayoutWindow w ! = do view <- get w view ! domain <- get w domain ! lay <- getVar (vlayout w) ! needed <- getLayoutSize lay ! let d1 = maxSize domain needed ! d2 = maxSize d1 view ! Lib.setWindowDomainSize (hwindow w) d1 ! layoutInRect (rectOfSize d2) lay return () *************** *** 122,126 **** domain = newAttr (\w -> getVar (vdomain w)) ! (\w x -> do Lib.setWindowDomainSize (hwindow w) x; setVar (vdomain w) x) -- | Can the window be resized? --- 122,126 ---- domain = newAttr (\w -> getVar (vdomain w)) ! (\w x -> setVar (vdomain w) x >> relayoutWindow w) -- | Can the window be resized? *************** *** 135,141 **** view :: Attr Window Size view ! = newAttr (\w -> Lib.getWindowViewSize (hwindow w)) ! (\w sz-> Lib.setWindowViewSize (hwindow w) sz) ! instance Dismissible Window where dismissWidget w = Lib.dismissWindow (hwindow w) --- 135,141 ---- view :: Attr Window Size view ! = newAttr (Lib.getWindowViewSize . hwindow) ! (Lib.setWindowViewSize . hwindow) ! instance Dismissible Window where dismissWidget w = Lib.dismissWindow (hwindow w) *************** *** 197,202 **** 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. --- 197,218 ---- layout :: Control c => Attr Window c 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 ! Lib.setWindowDomainSize (hwindow w) d ! when autosize (set w [view =: d]) ! view <- get w view ! 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. Index: Layout.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Layout.hs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Layout.hs 8 Jun 2003 19:42:13 -0000 1.5 --- Layout.hs 2 Jul 2003 20:04:45 -0000 1.6 *************** *** 1,8 **** ----------------------------------------------------------------------------------------- {-| Module : Layout ! Copyright : (c) Daan Leijen 2003 License : BSD-style ! Maintainer : da...@cs... Stability : provisional Portability : portable --- 1,8 ---- ----------------------------------------------------------------------------------------- {-| Module : Layout ! Copyright : (c) Krasimir Angelov 2003 License : BSD-style ! Maintainer : ka2...@ya... Stability : provisional Portability : portable *************** *** 114,118 **** , stdPackChangingLayout , getLayoutSize - , layoutInWindow , layoutInRect ) where --- 114,117 ---- *************** *** 267,272 **** -- | Render the control normally, and than move relative to its rendered position. ! moveBy :: Control c => Vector -> c -> Layout ! moveBy v c = move (\p sz -> pointMove v p) (pack c) -- | Render the control normally, and than change its position according to its --- 266,271 ---- -- | Render the control normally, and than move relative to its rendered position. ! moveBy :: Control c => Size -> c -> Layout ! moveBy s c = move (\p sz -> pointMove s p) (pack c) -- | Render the control normally, and than change its position according to its *************** *** 365,374 **** sz = rectSize $ foldr rectUnion (rectOfSize (Size 0 0)) rs return sz - - -- | Positions a (layout) control in a certain window (and return the used area) - layoutInWindow :: Control c => WindowHandle -> c -> IO Size - layoutInWindow parent c - = do sz <- Port.getWindowViewSize parent - layoutInRect (rectAt (pt 0 0) sz) c -- | Positions a controls in a certain rectangle --- 364,367 ---- |