From: <kr_...@us...> - 2003-02-10 22:42:42
|
Update of /cvsroot/htoolkit/port/src In directory sc8-pr-cvs1:/tmp/cvs-serv30164a/src Modified Files: Port.hs Log Message: MDI/SDI interface for Windows Index: Port.hs =================================================================== RCS file: /cvsroot/htoolkit/port/src/Port.hs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Port.hs 31 Jan 2003 01:01:42 -0000 1.6 --- Port.hs 10 Feb 2003 22:42:08 -0000 1.7 *************** *** 27,30 **** --- 27,33 ---- , module Graphics.UI.Port.Font , module Graphics.UI.Port.Bitmap + + -- ** Timers + , module Graphics.UI.Port.Timer -- ** Fundamental *************** *** 33,37 **** -- * The main event loop ! , start ) where --- 36,40 ---- -- * The main event loop ! , start, quit ) where *************** *** 45,49 **** import Graphics.UI.Port.FileDialog import Graphics.UI.Port.Window ! import Graphics.UI.Port.Menu import Graphics.UI.Port.Types hiding --- 48,54 ---- import Graphics.UI.Port.FileDialog import Graphics.UI.Port.Window ! import Graphics.UI.Port.Menu ! ! import Graphics.UI.Port.Timer import Graphics.UI.Port.Types hiding *************** *** 65,68 **** ) -- | Start the event loop. Runs until 'quit' is called. ! foreign import ccall "osStart" start :: IO (); --- 70,97 ---- ) + import Foreign.C + import System.Mem( performGC ) + import Control.Monad(when) + -- | Start the event loop. Runs until 'quit' is called. ! start :: String -> DocumentInterface -> IO a -> IO a ! start appName di io = do ! withCString appName (\s -> osInit s (toCDocumentInterface di)) ! registerDismissProcess quit ! r <- io ! osStart ! return r ! foreign import ccall "osInit" osInit :: CString -> CInt -> IO () ! foreign import ccall "osStart" osStart :: IO () ! ! -- | 'quit' exits the main event loop, closes any windows and menus, destroys all timers ! -- and unregisters any event handlers. This function is automatically called when all ! -- windows are closed. ! quit :: IO () ! quit = do ! r <- dismissAllWindows ! when r $ do ! destroyAllTimers ! osQuit ! performGC -- to release any foreign objects ! foreign import ccall osQuit :: IO () \ No newline at end of file |