From: Axel S. <as...@us...> - 2004-12-12 18:09:59
|
Update of /cvsroot/gtk2hs/gtk2hs/gtk/abstract In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5882/d/abstract Modified Files: Range.chs Widget.chs Log Message: Add some more functions for better scrollbar support. Index: Range.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/abstract/Range.chs,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- Range.chs 1 Aug 2004 16:08:14 -0000 1.6 +++ Range.chs 12 Dec 2004 18:09:39 -0000 1.7 @@ -23,18 +23,24 @@ -- -- An abstract base class to handle widgets that represent some value range. -- - +-- * For signals regarding a change in the range or increments, refer to +-- 'Adjustment' which is contained in the 'Range' object. +-- module Range( Range, RangeClass, castToRange, rangeGetAdjustment, + rangeSetAdjustment, UpdateType(..), - rangeSetUpdatePolicy, rangeGetUpdatePolicy, - rangeSetAdjustment, + rangeSetUpdatePolicy, rangeGetInverted, rangeSetInverted, + rangeGetValue, + rangeSetValue, + rangeSetIncrements, + rangeSetRange, ScrollType(..), rangeSetIncrements, rangeSetRange, @@ -62,11 +68,10 @@ rangeGetAdjustment r = makeNewObject mkAdjustment $ {#call unsafe range_get_adjustment#} (toRange r) --- | Set how the internal 'Adjustment' object is updated. +-- | Insert a new 'Adjustment' object. -- -rangeSetUpdatePolicy :: RangeClass r => r -> UpdateType -> IO () -rangeSetUpdatePolicy r up = {#call range_set_update_policy#} - (toRange r) ((fromIntegral.fromEnum) up) +rangeSetAdjustment :: RangeClass r => r -> Adjustment -> IO () +rangeSetAdjustment r adj = {#call range_set_adjustment#} (toRange r) adj -- | Get the update policy for the range widget. -- @@ -74,10 +79,14 @@ rangeGetUpdatePolicy r = liftM (toEnum.fromIntegral) $ {#call unsafe range_get_update_policy#} (toRange r) --- | Insert a new 'Adjustment' object. +-- | Set how the internal 'Adjustment' object is updated. -- -rangeSetAdjustment :: RangeClass r => r -> Adjustment -> IO () -rangeSetAdjustment r adj = {#call range_set_adjustment#} (toRange r) adj +-- * The value of 'UpdateType' determines how frequently value-changed +-- signals are emitted on the internal 'Adjustment' object. +-- +rangeSetUpdatePolicy :: RangeClass r => r -> UpdateType -> IO () +rangeSetUpdatePolicy r up = {#call range_set_update_policy#} + (toRange r) ((fromIntegral.fromEnum) up) -- | Get the inverted flag (determines if the range is reversed). -- @@ -90,7 +99,24 @@ rangeSetInverted :: RangeClass r => r -> Bool -> IO () rangeSetInverted r inv = {#call range_set_inverted#} (toRange r) (fromBool inv) --- | Sets the step and page sizes for the range. The step size is used when the +-- | Gets the current value of the range. +-- +rangeGetValue :: RangeClass r => r -> IO Double +rangeGetValue r = liftM realToFrac $ + {#call unsafe range_get_value#} (toRange r) + +-- | Sets the current value of the range. The range emits the \"value_changed\" +-- signal if the value changes. +-- +-- * If the value is outside the minimum or maximum range values, it will be +-- clamped to fit inside them. +-- +rangeSetValue :: RangeClass r => r -> Double -> IO () +rangeSetValue r value = + {#call range_set_value#} (toRange r) (realToFrac value) + +-- | Sets the step and page sizes for the range. +-- The step size is used when the -- user clicks the "Scrollbar" arrows or moves "Scale" via arrow keys. The -- page size is used for example when moving via Page Up or Page Down keys. -- @@ -111,22 +137,6 @@ rangeSetRange r min max = {#call range_set_range#} (toRange r) (realToFrac min) (realToFrac max) --- | Sets the current value of the range. The range emits the \"value_changed\" --- signal if the value changes. --- --- * If the value is outside the minimum or maximum range values, it will be --- clamped to fit inside them. --- -rangeSetValue :: RangeClass r => r -> Double -> IO () -rangeSetValue r value = - {#call range_set_value#} (toRange r) (realToFrac value) - --- | Gets the current value of the range. --- -rangeGetValue :: RangeClass r => r -> IO Double -rangeGetValue r = liftM realToFrac $ - {#call unsafe range_get_value#} (toRange r) - -- signals -- | The slide has moved. The arguments give Index: Widget.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/abstract/Widget.chs,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- Widget.chs 23 May 2004 15:46:02 -0000 1.14 +++ Widget.chs 12 Dec 2004 18:09:49 -0000 1.15 @@ -128,6 +128,8 @@ afterProximityIn, onProximityOut, afterProximityOut, + onRealize, + afterRealize, onScroll, afterScroll, onShow, @@ -592,6 +594,13 @@ onProximityOut = event "proximity_out_event" [ProximityOutMask] False afterProximityOut = event "proximity_out_event" [ProximityOutMask] True +-- | This widget's drawing area is about to be +-- destroyed. +-- +onRealize, afterRealize :: WidgetClass w => w -> IO () -> IO (ConnectId w) +onRealize = connect_NONE__NONE "realize" False +afterRealize = connect_NONE__NONE "realize" True + -- | The mouse wheel has turned. -- -- * The 'Event' is always 'Scroll'. |