|
From: <kr_...@us...> - 2003-10-07 21:41:10
|
Update of /cvsroot/htoolkit/gio/src/Graphics/UI/GIO
In directory sc8-pr-cvs1:/tmp/cvs-serv16778/src/Graphics/UI/GIO
Modified Files:
Window.hs
Log Message:
Make possible to hide/show a window at any time. The newly created window is always hidden.
Index: Window.hs
===================================================================
RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Window.hs,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** Window.hs 31 Aug 2003 11:48:26 -0000 1.27
--- Window.hs 7 Oct 2003 21:39:31 -0000 1.28
***************
*** 11,15 ****
-}
-----------------------------------------------------------------------------------------
! module Graphics.UI.GIO.Window (Window, window, dialog, view, runDialog) where
import qualified Graphics.UI.Port as Lib
--- 11,15 ----
-}
-----------------------------------------------------------------------------------------
! module Graphics.UI.GIO.Window (Window, window, dialog, view, visible, runDialog, showWindow, hideWindow) where
import qualified Graphics.UI.Port as Lib
***************
*** 40,52 ****
= do w <- Lib.createWindow >>= form windowPen
set w props
- Lib.showWindow (hwindow w)
return w
-- | Create a modeless dialog box. If you want to make the dialog modal use 'runDialog' function.
! dialog :: [Prop Window]
! -> Maybe Window -- ^ The owner window of the dialog being created.
-- If this parameter is Nothing or is a @Just handle@ of a window instead of dialog
! -- then the dialog owner is the process window. A dialog is always above its owner
! -- in the z-order and the system automatically destroys a dialog when its owner is
-- destroyed. The dialog is automatically hidded when its owner is minimized.
-> IO Window
--- 40,51 ----
= do w <- Lib.createWindow >>= form windowPen
set w props
return w
-- | Create a modeless dialog box. If you want to make the dialog modal use 'runDialog' function.
! dialog :: [Prop Window]
! -> Maybe Window -- ^ The owner window of the dialog being created.
-- If this parameter is Nothing or is a @Just handle@ of a window instead of dialog
! -- then the dialog owner is the process window. A dialog is always above its owner
! -- in the z-order and the system automatically destroys a dialog when its owner is
-- destroyed. The dialog is automatically hidded when its owner is minimized.
-> IO Window
***************
*** 55,59 ****
w <- Lib.createDialog hparent >>= form dialogPen
set w props
- Lib.showWindow (hwindow w)
return w
--- 54,57 ----
***************
*** 62,65 ****
--- 60,71 ----
runDialog w = Lib.runDialog (hwindow w)
+ -- | Activates the window and displays it in its current size and position.
+ showWindow :: Window -> IO ()
+ showWindow w = Lib.setWindowVisible (hwindow w) True
+
+ -- | Hides the window and activates another window.
+ hideWindow :: Window -> IO ()
+ hideWindow w = Lib.setWindowVisible (hwindow w) False
+
form :: Pen -> WindowHandle -> IO Window
form pen hwindow
***************
*** 69,75 ****
vdomain <- newVar (sz 0 0)
vresizeable<- newVar True
! vpen <- newVar pen
vbufferMode<- newVar UnBuffered
! return (Window hwindow vdomain vresizeable vautosize
vpen vbufferMode vpaint vlayout
)
--- 75,81 ----
vdomain <- newVar (sz 0 0)
vresizeable<- newVar True
! vpen <- newVar pen
vbufferMode<- newVar UnBuffered
! return (Window hwindow vdomain vresizeable vautosize
vpen vbufferMode vpaint vlayout
)
***************
*** 77,81 ****
set w [on relayout =: relayoutWindow w]
-- just by setting a dummy paint function, we will at least intialize the canvas properly on a repaint
! set w [on paint =: (\_ _ _ -> return ())]
return w
--- 83,87 ----
set w [on relayout =: relayoutWindow w]
-- just by setting a dummy paint function, we will at least intialize the canvas properly on a repaint
! set w [on paint =: (\_ _ _ -> return ())]
return w
***************
*** 114,117 ****
--- 120,127 ----
view = newStdAttr hwindow Lib.getWindowViewSize Lib.setWindowViewSize
+ -- | The attribute controls whether the window is visible
+ visible :: Attr Window Bool
+ visible = newStdAttr hwindow Lib.getWindowVisible Lib.setWindowVisible
+
instance Dismissible Window where
dismissWidget w = Lib.dismissWindow (hwindow w)
***************
*** 119,123 ****
instance Deadly Window where
! destroyWidget w = Lib.destroyWindow (hwindow w)
destroy = newStdEvent hwindow Lib.getWindowDestroyHandler Lib.setWindowDestroyHandler Lib.setWindowDestroyDefHandler
--- 129,133 ----
instance Deadly Window where
! destroyWidget w = Lib.destroyWindow (hwindow w)
destroy = newStdEvent hwindow Lib.getWindowDestroyHandler Lib.setWindowDestroyHandler Lib.setWindowDestroyDefHandler
|