From: Axel S. <as...@us...> - 2004-12-12 18:10:00
|
Update of /cvsroot/gtk2hs/gtk2hs/gtk/misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5882/d/misc Modified Files: Adjustment.chs Log Message: Add some more functions for better scrollbar support. Index: Adjustment.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/misc/Adjustment.chs,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Adjustment.chs 29 Jul 2004 12:15:55 -0000 1.5 +++ Adjustment.chs 12 Dec 2004 18:09:50 -0000 1.6 @@ -19,10 +19,11 @@ -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- --- | +-- | An adjustment is a bounded value controlled by the user. -- -- An Adjustment object contains a value with maximum bounds and a step size. --- It is used to represent the value of a scoll bar and similar widgets. +-- It is used to represent the value of a scoll bar and similar widgets. In +-- particular it is contained in the abstract 'Range' widget. -- module Adjustment( @@ -30,6 +31,16 @@ AdjustmentClass, castToAdjustment, adjustmentNew, + adjustmentSetLower, + adjustmentGetLower, + adjustmentSetPageIncrement, + adjustmentGetPageIncrement, + adjustmentSetPageSize, + adjustmentGetPageSize, + adjustmentSetStepIncrement, + adjustmentGetStepIncrement, + adjustmentSetUpper, + adjustmentGetUpper, adjustmentSetValue, adjustmentGetValue, adjustmentClampPage, @@ -42,9 +53,10 @@ import Monad (liftM) import FFI -import Object (makeNewObject) +import Object (makeNewObject, objectSetProperty, objectGetProperty) {#import Hierarchy#} {#import Signal#} +{#import GValue#} {# context lib="gtk" prefix="gtk" #} @@ -67,6 +79,58 @@ (realToFrac stepIncrement) (realToFrac pageIncrement) (realToFrac pageSize) +-- | Set the lower value. +adjustmentSetLower :: Adjustment -> Double -> IO () +adjustmentSetLower a val = objectSetProperty a "lower" (GVdouble val) + +-- | Retrieve the lower value. +adjustmentGetLower :: Adjustment -> IO Double +adjustmentGetLower a = do + (GVdouble res) <- objectGetProperty a "lower" + return res + +-- | Set the page increment value. +adjustmentSetPageIncrement :: Adjustment -> Double -> IO () +adjustmentSetPageIncrement a val = objectSetProperty a "page-increment" + (GVdouble val) + +-- | Retrieve the pageincrement value. +adjustmentGetPageIncrement :: Adjustment -> IO Double +adjustmentGetPageIncrement a = do + (GVdouble res) <- objectGetProperty a "page-increment" + return res + +-- | Set the page size value. +adjustmentSetPageSize :: Adjustment -> Double -> IO () +adjustmentSetPageSize a val = objectSetProperty a "page_size" (GVdouble val) + +-- | Retrieve the page size value. +adjustmentGetPageSize :: Adjustment -> IO Double +adjustmentGetPageSize a = do + (GVdouble res) <- objectGetProperty a "page_size" + return res + +-- | Set the step-increment value. +adjustmentSetStepIncrement :: Adjustment -> Double -> IO () +adjustmentSetStepIncrement a val = objectSetProperty a "step-increment" + (GVdouble val) + +-- | Retrieve the step-increment value. +adjustmentGetStepIncrement :: Adjustment -> IO Double +adjustmentGetStepIncrement a = do + (GVdouble res) <- objectGetProperty a "step-increment" + return res + +-- | Set the upper value. +adjustmentSetUpper :: Adjustment -> Double -> IO () +adjustmentSetUpper a val = objectSetProperty a "upper" (GVdouble val) + +-- | Retrieve the upper value. +adjustmentGetUpper :: Adjustment -> IO Double +adjustmentGetUpper a = do + (GVdouble res) <- objectGetProperty a "upper" + return res + -- | Set the current value of the Adjustment object. -- adjustmentSetValue :: Adjustment -> Double -> IO () @@ -79,6 +143,11 @@ adjustmentGetValue adj = liftM realToFrac $ {#call adjustment_get_value#} adj +-- | Retrieve the current value. +adjustmentGetValue :: Adjustment -> IO Double +adjustmentGetValue a = + liftM realToFrac $ {#call adjustment_get_value#} (toAdjustment a) + -- | Ensure that the alignment is within these -- bounds. -- |