module Graphics.UI.Gtk.Abstract.Range (
Range,
RangeClass,
castToRange, gTypeRange,
toRange,
rangeGetAdjustment,
rangeSetAdjustment,
rangeGetInverted,
rangeSetInverted,
rangeGetValue,
rangeSetValue,
rangeSetIncrements,
rangeSetRange,
ScrollType(..),
SensitivityType(..),
rangeSetLowerStepperSensitivity,
rangeGetLowerStepperSensitivity,
rangeSetUpperStepperSensitivity,
rangeGetUpperStepperSensitivity,
rangeGetMinSliderSize,
rangeGetRangeRect,
rangeGetSliderRange,
rangeGetSliderSizeFixed,
rangeSetMinSliderSize,
rangeSetSliderSizeFixed,
rangeAdjustment,
rangeInverted,
rangeLowerStepperSensitivity,
rangeUpperStepperSensitivity,
rangeValue,
rangeSliderSizeFixed,
rangeMinSliderSize,
adjustBounds,
valueChanged,
changeValue,
) where
import Control.Monad (liftM)
import System.Glib.FFI
import System.Glib.Attributes
import System.Glib.Properties
import Graphics.UI.Gtk.Abstract.Object (makeNewObject)
import Graphics.UI.Gtk.Types
import Graphics.UI.Gtk.Signals
import Graphics.UI.Gtk.General.Enums (ScrollType(..))
import Graphics.UI.Gtk.General.Structs (Rectangle(..))
rangeGetAdjustment :: RangeClass self => self
-> IO Adjustment
rangeGetAdjustment self =
makeNewObject mkAdjustment $
(\(Range arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_range_get_adjustment argPtr1)
(toRange self)
rangeSetAdjustment :: RangeClass self => self
-> Adjustment
-> IO ()
rangeSetAdjustment self adjustment =
(\(Range arg1) (Adjustment arg2) -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->gtk_range_set_adjustment argPtr1 argPtr2)
(toRange self)
adjustment
rangeGetInverted :: RangeClass self => self
-> IO Bool
rangeGetInverted self =
liftM toBool $
(\(Range arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_range_get_inverted argPtr1)
(toRange self)
rangeSetInverted :: RangeClass self => self
-> Bool
-> IO ()
rangeSetInverted self setting =
(\(Range arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_range_set_inverted argPtr1 arg2)
(toRange self)
(fromBool setting)
rangeGetValue :: RangeClass self => self
-> IO Double
rangeGetValue self =
liftM realToFrac $
(\(Range arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_range_get_value argPtr1)
(toRange self)
rangeSetValue :: RangeClass self => self
-> Double
-> IO ()
rangeSetValue self value =
(\(Range arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_range_set_value argPtr1 arg2)
(toRange self)
(realToFrac value)
rangeSetIncrements :: RangeClass self => self
-> Double
-> Double
-> IO ()
rangeSetIncrements self step page =
(\(Range arg1) arg2 arg3 -> withForeignPtr arg1 $ \argPtr1 ->gtk_range_set_increments argPtr1 arg2 arg3)
(toRange self)
(realToFrac step)
(realToFrac page)
rangeSetRange :: RangeClass self => self
-> Double
-> Double
-> IO ()
rangeSetRange self min max =
(\(Range arg1) arg2 arg3 -> withForeignPtr arg1 $ \argPtr1 ->gtk_range_set_range argPtr1 arg2 arg3)
(toRange self)
(realToFrac min)
(realToFrac max)
data SensitivityType = SensitivityAuto
| SensitivityOn
| SensitivityOff
deriving (Enum,Bounded,Eq,Show)
rangeSetLowerStepperSensitivity :: RangeClass self => self
-> SensitivityType
-> IO ()
rangeSetLowerStepperSensitivity self sensitivity =
(\(Range arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_range_set_lower_stepper_sensitivity argPtr1 arg2)
(toRange self)
((fromIntegral . fromEnum) sensitivity)
rangeGetLowerStepperSensitivity :: RangeClass self => self
-> IO SensitivityType
rangeGetLowerStepperSensitivity self =
liftM (toEnum . fromIntegral) $
(\(Range arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_range_get_lower_stepper_sensitivity argPtr1)
(toRange self)
rangeSetUpperStepperSensitivity :: RangeClass self => self
-> SensitivityType
-> IO ()
rangeSetUpperStepperSensitivity self sensitivity =
(\(Range arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_range_set_upper_stepper_sensitivity argPtr1 arg2)
(toRange self)
((fromIntegral . fromEnum) sensitivity)
rangeGetUpperStepperSensitivity :: RangeClass self => self
-> IO SensitivityType
rangeGetUpperStepperSensitivity self =
liftM (toEnum . fromIntegral) $
(\(Range arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_range_get_upper_stepper_sensitivity argPtr1)
(toRange self)
rangeGetMinSliderSize :: RangeClass self => self
-> IO Int
rangeGetMinSliderSize range =
liftM fromIntegral $
(\(Range arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_range_get_min_slider_size argPtr1)
(toRange range)
rangeGetRangeRect :: RangeClass self => self
-> IO Rectangle
rangeGetRangeRect self =
alloca $ \rPtr -> do
(\(Range arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_range_get_range_rect argPtr1 arg2)
(toRange self)
(castPtr rPtr)
peek rPtr
rangeGetSliderRange :: RangeClass self => self
-> IO (Maybe (Int, Int))
rangeGetSliderRange range =
alloca $ \ startPtr ->
alloca $ \ endPtr -> do
(\(Range arg1) arg2 arg3 -> withForeignPtr arg1 $ \argPtr1 ->gtk_range_get_slider_range argPtr1 arg2 arg3)
(toRange range)
startPtr
endPtr
if (startPtr /= nullPtr && endPtr /= nullPtr)
then do
start <- peek startPtr
end <- peek endPtr
return (Just (fromIntegral start, fromIntegral end))
else return Nothing
rangeGetSliderSizeFixed :: RangeClass self => self
-> IO Bool
rangeGetSliderSizeFixed self =
liftM toBool $
(\(Range arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_range_get_slider_size_fixed argPtr1)
(toRange self)
rangeSetMinSliderSize :: RangeClass self => self
-> Bool
-> IO ()
rangeSetMinSliderSize self minSize =
(\(Range arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_range_set_min_slider_size argPtr1 arg2)
(toRange self)
(fromBool minSize)
rangeSetSliderSizeFixed :: RangeClass self => self
-> Bool
-> IO ()
rangeSetSliderSizeFixed self sizeFixed =
(\(Range arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_range_set_slider_size_fixed argPtr1 arg2)
(toRange self)
(fromBool sizeFixed)
rangeAdjustment :: RangeClass self => Attr self Adjustment
rangeAdjustment = newAttr
rangeGetAdjustment
rangeSetAdjustment
rangeInverted :: RangeClass self => Attr self Bool
rangeInverted = newAttr
rangeGetInverted
rangeSetInverted
rangeLowerStepperSensitivity :: RangeClass self => Attr self SensitivityType
rangeLowerStepperSensitivity = newAttrFromEnumProperty "lower-stepper-sensitivity"
gtk_sensitivity_type_get_type
rangeUpperStepperSensitivity :: RangeClass self => Attr self SensitivityType
rangeUpperStepperSensitivity = newAttrFromEnumProperty "upper-stepper-sensitivity"
gtk_sensitivity_type_get_type
rangeValue :: RangeClass self => Attr self Double
rangeValue = newAttr
rangeGetValue
rangeSetValue
rangeSliderSizeFixed :: RangeClass self => Attr self Bool
rangeSliderSizeFixed = newAttr
rangeGetSliderSizeFixed
rangeSetSliderSizeFixed
rangeMinSliderSize :: RangeClass self => ReadWriteAttr self Int Bool
rangeMinSliderSize = newAttr
rangeGetMinSliderSize
rangeSetMinSliderSize
valueChanged :: RangeClass self => Signal self (IO ())
valueChanged = Signal (connect_NONE__NONE "value-changed")
adjustBounds :: RangeClass self => Signal self (Double -> IO ())
adjustBounds = Signal (connect_DOUBLE__NONE "adjust-bounds")
changeValue :: RangeClass self => Signal self (ScrollType -> Double -> IO Bool)
changeValue = Signal (connect_ENUM_DOUBLE__BOOL "change-value")
foreign import ccall unsafe "gtk_range_get_adjustment"
gtk_range_get_adjustment :: ((Ptr Range) -> (IO (Ptr Adjustment)))
foreign import ccall safe "gtk_range_set_adjustment"
gtk_range_set_adjustment :: ((Ptr Range) -> ((Ptr Adjustment) -> (IO ())))
foreign import ccall unsafe "gtk_range_get_inverted"
gtk_range_get_inverted :: ((Ptr Range) -> (IO CInt))
foreign import ccall safe "gtk_range_set_inverted"
gtk_range_set_inverted :: ((Ptr Range) -> (CInt -> (IO ())))
foreign import ccall unsafe "gtk_range_get_value"
gtk_range_get_value :: ((Ptr Range) -> (IO CDouble))
foreign import ccall safe "gtk_range_set_value"
gtk_range_set_value :: ((Ptr Range) -> (CDouble -> (IO ())))
foreign import ccall safe "gtk_range_set_increments"
gtk_range_set_increments :: ((Ptr Range) -> (CDouble -> (CDouble -> (IO ()))))
foreign import ccall safe "gtk_range_set_range"
gtk_range_set_range :: ((Ptr Range) -> (CDouble -> (CDouble -> (IO ()))))
foreign import ccall safe "gtk_range_set_lower_stepper_sensitivity"
gtk_range_set_lower_stepper_sensitivity :: ((Ptr Range) -> (CInt -> (IO ())))
foreign import ccall safe "gtk_range_get_lower_stepper_sensitivity"
gtk_range_get_lower_stepper_sensitivity :: ((Ptr Range) -> (IO CInt))
foreign import ccall safe "gtk_range_set_upper_stepper_sensitivity"
gtk_range_set_upper_stepper_sensitivity :: ((Ptr Range) -> (CInt -> (IO ())))
foreign import ccall safe "gtk_range_get_upper_stepper_sensitivity"
gtk_range_get_upper_stepper_sensitivity :: ((Ptr Range) -> (IO CInt))
foreign import ccall safe "gtk_range_get_min_slider_size"
gtk_range_get_min_slider_size :: ((Ptr Range) -> (IO CInt))
foreign import ccall safe "gtk_range_get_range_rect"
gtk_range_get_range_rect :: ((Ptr Range) -> ((Ptr ()) -> (IO ())))
foreign import ccall safe "gtk_range_get_slider_range"
gtk_range_get_slider_range :: ((Ptr Range) -> ((Ptr CInt) -> ((Ptr CInt) -> (IO ()))))
foreign import ccall safe "gtk_range_get_slider_size_fixed"
gtk_range_get_slider_size_fixed :: ((Ptr Range) -> (IO CInt))
foreign import ccall safe "gtk_range_set_min_slider_size"
gtk_range_set_min_slider_size :: ((Ptr Range) -> (CInt -> (IO ())))
foreign import ccall safe "gtk_range_set_slider_size_fixed"
gtk_range_set_slider_size_fixed :: ((Ptr Range) -> (CInt -> (IO ())))
foreign import ccall unsafe "gtk_sensitivity_type_get_type"
gtk_sensitivity_type_get_type :: CULong