|
From: <kr_...@us...> - 2003-03-26 15:40:22
|
Update of /cvsroot/htoolkit/gio/src/Graphics/UI/GIO
In directory sc8-pr-cvs1:/tmp/cvs-serv16051/gio/src/Graphics/UI/GIO
Modified Files:
Controls.hs Window.hs
Log Message:
This commit implements instances for Able type class for all kinds of windows and controls.
Index: Controls.hs
===================================================================
RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Controls.hs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Controls.hs 25 Mar 2003 23:37:01 -0000 1.4
--- Controls.hs 26 Mar 2003 15:39:46 -0000 1.5
***************
*** 1,8 ****
-----------------------------------------------------------------------------------------
{-| Module : Controls
! Copyright : (c) Daan Leijen 2003
License : BSD-style
! Maintainer : da...@cs...
Stability : provisional
Portability : portable
--- 1,8 ----
-----------------------------------------------------------------------------------------
{-| Module : Controls
! Copyright : (c) Krasimir Angelov & Daan Leijen 2003
License : BSD-style
! Maintainer : ka2...@ya... da...@cs...
Stability : provisional
Portability : portable
***************
*** 31,37 ****
import Graphics.UI.GIO.Layout
! {--------------------------------------------------------------------
! Label
! --------------------------------------------------------------------}
-- | A simple text label.
data Label = Label { lhandle :: !WindowHandle
--- 31,37 ----
import Graphics.UI.GIO.Layout
! --------------------------------------------------------------------
! -- Label
! --------------------------------------------------------------------
-- | A simple text label.
data Label = Label { lhandle :: !WindowHandle
***************
*** 56,59 ****
--- 56,62 ----
frame = newAttr (\w -> Port.getControlFrame (lhandle w))
(\w r -> Port.moveResizeControl (lhandle w) r)
+
+ instance Able Label where
+ enabled = newAttr (Port.getControlEnabled . lhandle) (Port.setControlEnabled . lhandle)
instance Control Label where
***************
*** 61,67 ****
= stdPack (lparent w) (Port.getLabelRequestSize (lhandle w)) (Port.moveResizeControl (lhandle w))
! {--------------------------------------------------------------------
! Button
! --------------------------------------------------------------------}
-- | A standard push button.
data Button = Button { bhandle :: !WindowHandle
--- 64,70 ----
= stdPack (lparent w) (Port.getLabelRequestSize (lhandle w)) (Port.moveResizeControl (lhandle w))
! --------------------------------------------------------------------
! -- Button
! --------------------------------------------------------------------
-- | A standard push button.
data Button = Button { bhandle :: !WindowHandle
***************
*** 88,91 ****
--- 91,97 ----
(\b r -> Port.moveResizeControl (bhandle b) r)
+ instance Able Button where
+ enabled = newAttr (Port.getControlEnabled . bhandle) (Port.setControlEnabled . bhandle)
+
instance Control Button where
pack b
***************
*** 96,102 ****
= newControlCommandEvent bhandle
! {--------------------------------------------------------------------
! Entry
! --------------------------------------------------------------------}
-- | A standard text entry control.
data Entry = Entry { ehandle :: !WindowHandle
--- 102,108 ----
= newControlCommandEvent bhandle
! --------------------------------------------------------------------
! -- Entry
! --------------------------------------------------------------------
-- | A standard text entry control.
data Entry = Entry { ehandle :: !WindowHandle
***************
*** 123,126 ****
--- 129,135 ----
(\w r -> Port.moveResizeControl (ehandle w) r)
+ instance Able Entry where
+ enabled = newAttr (Port.getControlEnabled . ehandle) (Port.setControlEnabled . ehandle)
+
instance Control Entry where
pack w
***************
*** 174,183 ****
popupCommand w) -- pretend an event
-
-
instance Dimensions Popup where
frame = newAttr (\p -> Port.getControlFrame (phandle p))
(\p r -> Port.moveResizeControl (phandle p) r)
instance Control Popup where
pack p = stdPack (pparent p) (Port.getPopUpRequestSize (phandle p)) (Port.moveResizeControl (phandle p))
--- 183,193 ----
popupCommand w) -- pretend an event
instance Dimensions Popup where
frame = newAttr (\p -> Port.getControlFrame (phandle p))
(\p r -> Port.moveResizeControl (phandle p) r)
+ instance Able Popup where
+ enabled = newAttr (Port.getControlEnabled . phandle) (Port.setControlEnabled . phandle)
+
instance Control Popup where
pack p = stdPack (pparent p) (Port.getPopUpRequestSize (phandle p)) (Port.moveResizeControl (phandle p))
***************
*** 327,330 ****
--- 337,343 ----
instance Commanding Check where
command = newControlCommandEvent chandle
+
+ instance Able Check where
+ enabled = newAttr (Port.getControlEnabled . chandle) (Port.setControlEnabled . chandle)
instance Control Check where
***************
*** 361,364 ****
--- 374,380 ----
instance Commanding Radio where
command = newControlCommandEvent rhandle
+
+ instance Able Radio where
+ enabled = newAttr (Port.getControlEnabled . rhandle) (Port.setControlEnabled . rhandle)
instance Control Radio where
Index: Window.hs
===================================================================
RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Window.hs,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Window.hs 26 Mar 2003 08:54:55 -0000 1.7
--- Window.hs 26 Mar 2003 15:39:46 -0000 1.8
***************
*** 195,198 ****
--- 195,201 ----
hat <- get w hatch
withCanvas hcanvas col bgcol hat $ \can -> paintfun can updArea []
+
+ instance Able Window where
+ enabled = newAttr (Lib.getWindowEnabled . hwindow) (Lib.setWindowEnabled . hwindow)
|