From: Duncan C. <dun...@us...> - 2004-08-01 16:08:37
|
Update of /cvsroot/gtk2hs/gtk2hs/gtk/scrolling In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18039/gtk/scrolling Modified Files: ScrolledWindow.chs Log Message: Add missing functions. Update api.ignore files with more deprecated functions. Also fix a couple typo bugs and tidy up some documentation. Index: ScrolledWindow.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/scrolling/ScrolledWindow.chs,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- ScrolledWindow.chs 23 May 2004 16:14:09 -0000 1.7 +++ ScrolledWindow.chs 1 Aug 2004 16:08:14 -0000 1.8 @@ -38,11 +38,14 @@ scrolledWindowGetVAdjustment, PolicyType(..), scrolledWindowSetPolicy, + scrolledWindowGetPolicy, scrolledWindowAddWithViewport, CornerType(..), scrolledWindowSetPlacement, + scrolledWindowGetPlacement, ShadowType(..), scrolledWindowSetShadowType, + scrolledWindowGetShadowType, scrolledWindowSetHAdjustment, scrolledWindowSetVAdjustment, ) where @@ -69,22 +72,20 @@ fromMAdj :: Maybe Adjustment -> Adjustment fromMAdj = fromMaybe $ mkAdjustment nullForeignPtr --- | Retrieve the horizontal --- 'Adjustment' of the 'ScrolledWindow'. +-- | Retrieve the horizontal 'Adjustment' of the 'ScrolledWindow'. -- scrolledWindowGetHAdjustment :: ScrolledWindowClass w => w -> IO Adjustment scrolledWindowGetHAdjustment w = makeNewObject mkAdjustment $ {#call unsafe scrolled_window_get_hadjustment#} (toScrolledWindow w) --- | Retrieve the vertical --- 'Adjustment' of the 'ScrolledWindow'. +-- | Retrieve the vertical 'Adjustment' of the 'ScrolledWindow'. -- scrolledWindowGetVAdjustment :: ScrolledWindowClass w => w -> IO Adjustment scrolledWindowGetVAdjustment w = makeNewObject mkAdjustment $ {#call unsafe scrolled_window_get_vadjustment#} (toScrolledWindow w) --- | Specify if the scrollbars should vanish if --- the child size is sufficiently small. +-- | Specify if the scrollbars should vanish if the child size is sufficiently +-- small. -- scrolledWindowSetPolicy :: ScrolledWindowClass w => w -> PolicyType -> PolicyType -> IO () @@ -92,8 +93,21 @@ (toScrolledWindow w) ((fromIntegral.fromEnum) hPol) ((fromIntegral.fromEnum) vPol) --- | Add a child widget without native --- scrolling support to this 'ScrolledWindow'. +-- | Retrieves the current policy values for the horizontal and vertical +-- scrollbars. +-- +scrolledWindowGetPolicy :: ScrolledWindowClass w => w + -> IO (PolicyType, PolicyType) +scrolledWindowGetPolicy w = + alloca $ \hPolPtr -> alloca $ \vPolPtr -> do + {#call unsafe scrolled_window_get_policy#} (toScrolledWindow w) + hPolPtr vPolPtr + hPol <- liftM (toEnum.fromIntegral) $ peek hPolPtr + vPol <- liftM (toEnum.fromIntegral) $ peek vPolPtr + return (hPol, vPol) + +-- | Add a child widget without native scrolling support to this +-- 'ScrolledWindow'. -- scrolledWindowAddWithViewport :: (ScrolledWindowClass w, WidgetClass wid) => w -> wid -> IO () @@ -101,36 +115,44 @@ {#call scrolled_window_add_with_viewport#} (toScrolledWindow w) (toWidget wid) --- | Specify where the scrollbars should be --- placed. +-- | Specify where the scrollbars should be placed. -- scrolledWindowSetPlacement :: ScrolledWindowClass w => w -> CornerType -> IO () scrolledWindowSetPlacement w ct = {#call scrolled_window_set_placement#} (toScrolledWindow w) ((fromIntegral.fromEnum) ct) --- | Specify if and how an outer frame --- should be drawn around the child. +-- | Gets the placement of the scrollbars for the scrolled window. +-- +scrolledWindowGetPlacement :: ScrolledWindowClass w => w -> IO CornerType +scrolledWindowGetPlacement w = liftM (toEnum.fromIntegral) $ + {#call unsafe scrolled_window_get_placement#} (toScrolledWindow w) + +-- | Specify if and how an outer frame should be drawn around the child. -- scrolledWindowSetShadowType :: ScrolledWindowClass w => w -> ShadowType -> IO () scrolledWindowSetShadowType w st = {#call scrolled_window_set_shadow_type#} (toScrolledWindow w) ((fromIntegral.fromEnum) st) --- | Set the horizontal --- 'Adjustment' of the 'ScrolledWindow'. +-- | Gets the shadow type of the scrolled window. +-- +scrolledWindowGetShadowType :: ScrolledWindowClass w => w -> IO ShadowType +scrolledWindowGetShadowType w = liftM (toEnum.fromIntegral) $ + {#call unsafe scrolled_window_get_shadow_type#} (toScrolledWindow w) + +-- | Set the horizontal 'Adjustment' of the 'ScrolledWindow'. -- scrolledWindowSetHAdjustment :: ScrolledWindowClass w => w -> Adjustment -> IO () scrolledWindowSetHAdjustment w adj = {#call scrolled_window_set_hadjustment#} (toScrolledWindow w) adj --- | Set the vertical 'Adjustment' --- of the 'ScrolledWindow'. +-- | Set the vertical 'Adjustment' of the 'ScrolledWindow'. -- scrolledWindowSetVAdjustment :: ScrolledWindowClass w => w -> Adjustment -> IO () -scrolledWindowSetVAdjustment w adj = {#call scrolled_window_set_hadjustment#} +scrolledWindowSetVAdjustment w adj = {#call scrolled_window_set_vadjustment#} (toScrolledWindow w) adj |