-- GENERATED by C->Haskell Compiler, version 0.18.2 The shapeless maps, 31 Oct 2014 (Haskell)
-- Edit the ORIGNAL .chs file instead!


{-# LINE 1 "src/Graphics/UI/FLTK/LowLevel/Valuator.chs" #-}
{-# LANGUAGE CPP, TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses, FlexibleContexts #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Graphics.UI.FLTK.LowLevel.Valuator
    (
     -- * Constructor
     valuatorNew,
     -- * Hierarchy
     --
     -- $hierarchy

     -- * Functions
     --
     -- $functions
    )
where



import C2HS hiding (cFromEnum, cFromBool, cToBool,cToEnum)
import Foreign.C.Types
import Graphics.UI.FLTK.LowLevel.Fl_Enumerations
import Graphics.UI.FLTK.LowLevel.Fl_Types
import Graphics.UI.FLTK.LowLevel.Utils
import Graphics.UI.FLTK.LowLevel.Hierarchy
import Graphics.UI.FLTK.LowLevel.Dispatch
import Graphics.UI.FLTK.LowLevel.Widget
import Data.Ratio

valuatorNew' :: (Int) -> (Int) -> (Int) -> (Int) -> IO ((Ptr ()))
valuatorNew' a1 a2 a3 a4 =
  let {a1' = fromIntegral a1} in 
  let {a2' = fromIntegral a2} in 
  let {a3' = fromIntegral a3} in 
  let {a4' = fromIntegral a4} in 
  valuatorNew''_ a1' a2' a3' a4' >>= \res ->
  let {res' = id res} in
  return (res')

{-# LINE 29 "src/Graphics/UI/FLTK/LowLevel/Valuator.chs" #-}

valuatorNewWithLabel' :: (Int) -> (Int) -> (Int) -> (Int) -> (String) -> IO ((Ptr ()))
valuatorNewWithLabel' a1 a2 a3 a4 a5 =
  let {a1' = fromIntegral a1} in 
  let {a2' = fromIntegral a2} in 
  let {a3' = fromIntegral a3} in 
  let {a4' = fromIntegral a4} in 
  withCString a5 $ \a5' -> 
  valuatorNewWithLabel''_ a1' a2' a3' a4' a5' >>= \res ->
  let {res' = id res} in
  return (res')

{-# LINE 30 "src/Graphics/UI/FLTK/LowLevel/Valuator.chs" #-}

overriddenValuatorNewWithLabel' :: (Int) -> (Int) -> (Int) -> (Int) -> (String) -> (Ptr ()) -> IO ((Ptr ()))
overriddenValuatorNewWithLabel' a1 a2 a3 a4 a5 a6 =
  let {a1' = fromIntegral a1} in 
  let {a2' = fromIntegral a2} in 
  let {a3' = fromIntegral a3} in 
  let {a4' = fromIntegral a4} in 
  withCString a5 $ \a5' -> 
  let {a6' = id a6} in 
  overriddenValuatorNewWithLabel''_ a1' a2' a3' a4' a5' a6' >>= \res ->
  let {res' = id res} in
  return (res')

{-# LINE 31 "src/Graphics/UI/FLTK/LowLevel/Valuator.chs" #-}

overriddenValuatorNew' :: (Int) -> (Int) -> (Int) -> (Int) -> (Ptr ()) -> IO ((Ptr ()))
overriddenValuatorNew' a1 a2 a3 a4 a5 =
  let {a1' = fromIntegral a1} in 
  let {a2' = fromIntegral a2} in 
  let {a3' = fromIntegral a3} in 
  let {a4' = fromIntegral a4} in 
  let {a5' = id a5} in 
  overriddenValuatorNew''_ a1' a2' a3' a4' a5' >>= \res ->
  let {res' = id res} in
  return (res')

{-# LINE 32 "src/Graphics/UI/FLTK/LowLevel/Valuator.chs" #-}

valuatorNew :: Rectangle -> Maybe String -> Maybe (CustomWidgetFuncs Valuator) -> IO (Ref Valuator)
valuatorNew rectangle l' funcs' =
  widgetMaker
    rectangle
    l'
    funcs'
    valuatorNew'
    valuatorNewWithLabel'
    overriddenValuatorNew'
    overriddenValuatorNewWithLabel'

valuatorDestroy' :: (Ptr ()) -> IO ((()))
valuatorDestroy' a1 =
  let {a1' = id a1} in 
  valuatorDestroy''_ a1' >>= \res ->
  let {res' = supressWarningAboutRes res} in
  return (res')

{-# LINE 44 "src/Graphics/UI/FLTK/LowLevel/Valuator.chs" #-}

instance (impl ~ (IO ())) => Op (Destroy ()) Valuator orig impl where
  runOp _ _ win = swapRef win $ \winPtr -> do
                                        valuatorDestroy' winPtr
                                        return nullPtr
valuatorHandle' :: (Ptr ()) -> (CInt) -> IO ((Int))
valuatorHandle' a1 a2 =
  let {a1' = id a1} in 
  let {a2' = id a2} in 
  valuatorHandle''_ a1' a2' >>= \res ->
  let {res' = fromIntegral res} in
  return (res')

{-# LINE 49 "src/Graphics/UI/FLTK/LowLevel/Valuator.chs" #-}

instance (impl ~ (Event -> IO Int)) => Op (Handle ()) Valuator orig impl where
  runOp _ _ valuator event = withRef valuator (\p -> valuatorHandle' p (fromIntegral . fromEnum $ event))
resizeSuper' :: (Ptr ()) -> (Int) -> (Int) -> (Int) -> (Int) -> IO ((()))
resizeSuper' a1 a2 a3 a4 a5 =
  let {a1' = id a1} in 
  let {a2' = fromIntegral a2} in 
  let {a3' = fromIntegral a3} in 
  let {a4' = fromIntegral a4} in 
  let {a5' = fromIntegral a5} in 
  resizeSuper''_ a1' a2' a3' a4' a5' >>= \res ->
  let {res' = supressWarningAboutRes res} in
  return (res')

{-# LINE 52 "src/Graphics/UI/FLTK/LowLevel/Valuator.chs" #-}

instance (impl ~ (Rectangle ->  IO ())) => Op (ResizeSuper ()) Valuator orig impl where
  runOp _ _ valuator rectangle = withRef valuator $ \valuatorPtr -> do
                                 let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle
                                 resizeSuper' valuatorPtr x_pos y_pos w_pos h_pos
resize' :: (Ptr ()) -> (Int) -> (Int) -> (Int) -> (Int) -> IO ((()))
resize' a1 a2 a3 a4 a5 =
  let {a1' = id a1} in 
  let {a2' = fromIntegral a2} in 
  let {a3' = fromIntegral a3} in 
  let {a4' = fromIntegral a4} in 
  let {a5' = fromIntegral a5} in 
  resize''_ a1' a2' a3' a4' a5' >>= \res ->
  let {res' = supressWarningAboutRes res} in
  return (res')

{-# LINE 57 "src/Graphics/UI/FLTK/LowLevel/Valuator.chs" #-}

instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) Valuator orig impl where
  runOp _ _ valuator rectangle = withRef valuator $ \valuatorPtr -> do
                                 let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle
                                 resize' valuatorPtr x_pos y_pos w_pos h_pos
bounds' :: (Ptr ()) -> (Double) -> (Double) -> IO ((()))
bounds' a1 a2 a3 =
  let {a1' = id a1} in 
  let {a2' = realToFrac a2} in 
  let {a3' = realToFrac a3} in 
  bounds''_ a1' a2' a3' >>= \res ->
  let {res' = supressWarningAboutRes res} in
  return (res')

{-# LINE 62 "src/Graphics/UI/FLTK/LowLevel/Valuator.chs" #-}

instance (impl ~ (Double -> Double ->  IO ())) => Op (Bounds ()) Valuator orig impl where
  runOp _ _ valuator a b = withRef valuator $ \valuatorPtr -> bounds' valuatorPtr a b
minimum' :: (Ptr ()) -> IO ((Double))
minimum' a1 =
  let {a1' = id a1} in 
  minimum''_ a1' >>= \res ->
  let {res' = realToFrac res} in
  return (res')

{-# LINE 65 "src/Graphics/UI/FLTK/LowLevel/Valuator.chs" #-}

instance (impl ~ ( IO (Double))) => Op (GetMinimum ()) Valuator orig impl where
  runOp _ _ valuator = withRef valuator $ \valuatorPtr -> minimum' valuatorPtr
setMinimum' :: (Ptr ()) -> (Double) -> IO ((()))
setMinimum' a1 a2 =
  let {a1' = id a1} in 
  let {a2' = realToFrac a2} in 
  setMinimum''_ a1' a2' >>= \res ->
  let {res' = supressWarningAboutRes res} in
  return (res')

{-# LINE 68 "src/Graphics/UI/FLTK/LowLevel/Valuator.chs" #-}

instance (impl ~ (Double ->  IO ())) => Op (SetMinimum ()) Valuator orig impl where
  runOp _ _ valuator a = withRef valuator $ \valuatorPtr -> setMinimum' valuatorPtr a
maximum' :: (Ptr ()) -> IO ((Double))
maximum' a1 =
  let {a1' = id a1} in 
  maximum''_ a1' >>= \res ->
  let {res' = realToFrac res} in
  return (res')

{-# LINE 71 "src/Graphics/UI/FLTK/LowLevel/Valuator.chs" #-}

instance (impl ~ ( IO (Double))) => Op (GetMaximum ()) Valuator orig impl where
  runOp _ _ valuator = withRef valuator $ \valuatorPtr -> maximum' valuatorPtr
setMaximum' :: (Ptr ()) -> (Double) -> IO ((()))
setMaximum' a1 a2 =
  let {a1' = id a1} in 
  let {a2' = realToFrac a2} in 
  setMaximum''_ a1' a2' >>= \res ->
  let {res' = supressWarningAboutRes res} in
  return (res')

{-# LINE 74 "src/Graphics/UI/FLTK/LowLevel/Valuator.chs" #-}

instance (impl ~ (Double ->  IO ())) => Op (SetMaximum ()) Valuator orig impl where
  runOp _ _ valuator a = withRef valuator $ \valuatorPtr -> setMaximum' valuatorPtr a
range' :: (Ptr ()) -> (Double) -> (Double) -> IO ((()))
range' a1 a2 a3 =
  let {a1' = id a1} in 
  let {a2' = realToFrac a2} in 
  let {a3' = realToFrac a3} in 
  range''_ a1' a2' a3' >>= \res ->
  let {res' = supressWarningAboutRes res} in
  return (res')

{-# LINE 77 "src/Graphics/UI/FLTK/LowLevel/Valuator.chs" #-}

instance (impl ~ (Double -> Double ->  IO ())) => Op (Range ()) Valuator orig impl where
  runOp _ _ valuator a b = withRef valuator $ \valuatorPtr -> range' valuatorPtr a b
setStepWithAB' :: (Ptr ()) -> (Double) -> (Int) -> IO ((()))
setStepWithAB' a1 a2 a3 =
  let {a1' = id a1} in 
  let {a2' = realToFrac a2} in 
  let {a3' = fromIntegral a3} in 
  setStepWithAB''_ a1' a2' a3' >>= \res ->
  let {res' = supressWarningAboutRes res} in
  return (res')

{-# LINE 80 "src/Graphics/UI/FLTK/LowLevel/Valuator.chs" #-}

instance (impl ~ (Rational -> IO ())) => Op (SetStep ()) Valuator orig impl where
  runOp _ _ valuator r = withRef valuator $ \valuatorPtr -> setStepWithAB' valuatorPtr (fromIntegral (denominator r)) (fromIntegral (numerator r))
step' :: (Ptr ()) -> IO ((Double))
step' a1 =
  let {a1' = id a1} in 
  step''_ a1' >>= \res ->
  let {res' = realToFrac res} in
  return (res')

{-# LINE 83 "src/Graphics/UI/FLTK/LowLevel/Valuator.chs" #-}

instance (impl ~ ( IO (Rational))) => Op (GetStep ()) Valuator orig impl where
  runOp _ _ valuator = withRef valuator $ \valuatorPtr -> step' valuatorPtr >>= \r -> return $ approxRational r 0
precision' :: (Ptr ()) -> (Int) -> IO ((()))
precision' a1 a2 =
  let {a1' = id a1} in 
  let {a2' = fromIntegral a2} in 
  precision''_ a1' a2' >>= \res ->
  let {res' = supressWarningAboutRes res} in
  return (res')

{-# LINE 86 "src/Graphics/UI/FLTK/LowLevel/Valuator.chs" #-}

instance (impl ~ (Int ->  IO ())) => Op (Precision ()) Valuator orig impl where
  runOp _ _ valuator p' = withRef valuator $ \valuatorPtr -> precision' valuatorPtr p'
value' :: (Ptr ()) -> IO ((Double))
value' a1 =
  let {a1' = id a1} in 
  value''_ a1' >>= \res ->
  let {res' = realToFrac res} in
  return (res')

{-# LINE 89 "src/Graphics/UI/FLTK/LowLevel/Valuator.chs" #-}

instance (impl ~ ( IO (Double))) => Op (GetValue ()) Valuator orig impl where
  runOp _ _ valuator = withRef valuator $ \valuatorPtr -> value' valuatorPtr
setValue' :: (Ptr ()) -> (Double) -> IO ((Int))
setValue' a1 a2 =
  let {a1' = id a1} in 
  let {a2' = realToFrac a2} in 
  setValue''_ a1' a2' >>= \res ->
  let {res' = fromIntegral res} in
  return (res')

{-# LINE 92 "src/Graphics/UI/FLTK/LowLevel/Valuator.chs" #-}

instance (impl ~ (Double ->  IO (Int))) => Op (SetValue ()) Valuator orig impl where
  runOp _ _ valuator v = withRef valuator $ \valuatorPtr -> setValue' valuatorPtr v
format' :: (Ptr ()) -> (String) -> IO ((Int))
format' a1 a2 =
  let {a1' = id a1} in 
  withCString a2 $ \a2' -> 
  format''_ a1' a2' >>= \res ->
  let {res' = fromIntegral res} in
  return (res')

{-# LINE 95 "src/Graphics/UI/FLTK/LowLevel/Valuator.chs" #-}

instance (impl ~ (String ->  IO (Int))) => Op (Format ()) Valuator orig impl where
  runOp _ _ valuator f = withRef valuator $ \valuatorPtr -> format' valuatorPtr f
round' :: (Ptr ()) -> (Double) -> IO ((Double))
round' a1 a2 =
  let {a1' = id a1} in 
  let {a2' = realToFrac a2} in 
  round''_ a1' a2' >>= \res ->
  let {res' = realToFrac res} in
  return (res')

{-# LINE 98 "src/Graphics/UI/FLTK/LowLevel/Valuator.chs" #-}

instance (impl ~ (Double ->  IO (Double))) => Op (Round ()) Valuator orig impl where
  runOp _ _ valuator v = withRef valuator $ \valuatorPtr -> round' valuatorPtr v
clamp' :: (Ptr ()) -> (Double) -> IO ((Double))
clamp' a1 a2 =
  let {a1' = id a1} in 
  let {a2' = realToFrac a2} in 
  clamp''_ a1' a2' >>= \res ->
  let {res' = realToFrac res} in
  return (res')

{-# LINE 101 "src/Graphics/UI/FLTK/LowLevel/Valuator.chs" #-}

instance (impl ~ (Double ->  IO (Double))) => Op (Clamp ()) Valuator orig impl where
  runOp _ _ valuator v = withRef valuator $ \valuatorPtr -> clamp' valuatorPtr v
increment' :: (Ptr ()) -> (Double) -> (Int) -> IO ((Double))
increment' a1 a2 a3 =
  let {a1' = id a1} in 
  let {a2' = realToFrac a2} in 
  let {a3' = fromIntegral a3} in 
  increment''_ a1' a2' a3' >>= \res ->
  let {res' = realToFrac res} in
  return (res')

{-# LINE 104 "src/Graphics/UI/FLTK/LowLevel/Valuator.chs" #-}

instance (impl ~ (Double -> Int ->  IO (Double))) => Op (Increment ()) Valuator orig impl where
  runOp _ _ valuator v n = withRef valuator $ \valuatorPtr -> increment' valuatorPtr v n

-- $functions
-- @
--
-- bounds :: 'Ref' 'Valuator' -> 'Double' -> 'Double' -> 'IO' ()
--
-- clamp :: 'Ref' 'Valuator' -> 'Double' -> 'IO' 'Double'
--
-- destroy :: 'Ref' 'Valuator' -> 'IO' ()
--
-- format :: 'Ref' 'Valuator' -> 'String' -> 'IO' 'Int'
--
-- getMaximum :: 'Ref' 'Valuator' -> 'IO' 'Double'
--
-- getMinimum :: 'Ref' 'Valuator' -> 'IO' 'Double'
--
-- getStep :: 'Ref' 'Valuator' -> 'IO' 'Rational'
--
-- getValue :: 'Ref' 'Valuator' -> 'IO' 'Double'
--
-- handle :: 'Ref' 'Valuator' -> 'Event' -> 'IO' 'Int'
--
-- increment :: 'Ref' 'Valuator' -> 'Double' -> 'Int' -> 'IO' 'Double'
--
-- precision :: 'Ref' 'Valuator' -> 'Int' -> 'IO' ()
--
-- range :: 'Ref' 'Valuator' -> 'Double' -> 'Double' -> 'IO' ()
--
-- resize :: 'Ref' 'Valuator' -> 'Rectangle' -> 'IO' ()
--
-- resizeSuper :: 'Ref' 'Valuator' -> 'Rectangle' -> 'IO' ()
--
-- round :: 'Ref' 'Valuator' -> 'Double' -> 'IO' 'Double'
--
-- setMaximum :: 'Ref' 'Valuator' -> 'Double' -> 'IO' ()
--
-- setMinimum :: 'Ref' 'Valuator' -> 'Double' -> 'IO' ()
--
-- setStep :: 'Ref' 'Valuator' -> 'Rational' -> 'IO' ()
--
-- setValue :: 'Ref' 'Valuator' -> 'Double' -> 'IO' 'Int'
-- @

-- $hierarchy
-- @
-- "Graphics.UI.FLTK.LowLevel.Widget"
--  |
--  v
-- "Graphics.UI.FLTK.LowLevel.Valuator"
-- @
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Valuator.chs.h Fl_Valuator_New"
  valuatorNew''_ :: (CInt -> (CInt -> (CInt -> (CInt -> (IO (Ptr ()))))))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Valuator.chs.h Fl_Valuator_New_WithLabel"
  valuatorNewWithLabel''_ :: (CInt -> (CInt -> (CInt -> (CInt -> ((Ptr CChar) -> (IO (Ptr ())))))))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Valuator.chs.h Fl_OverriddenValuator_New_WithLabel"
  overriddenValuatorNewWithLabel''_ :: (CInt -> (CInt -> (CInt -> (CInt -> ((Ptr CChar) -> ((Ptr ()) -> (IO (Ptr ()))))))))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Valuator.chs.h Fl_OverriddenValuator_New"
  overriddenValuatorNew''_ :: (CInt -> (CInt -> (CInt -> (CInt -> ((Ptr ()) -> (IO (Ptr ())))))))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Valuator.chs.h Fl_Valuator_Destroy"
  valuatorDestroy''_ :: ((Ptr ()) -> (IO ()))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Valuator.chs.h Fl_Valuator_handle"
  valuatorHandle''_ :: ((Ptr ()) -> (CInt -> (IO CInt)))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Valuator.chs.h Fl_Valuator_resize_super"
  resizeSuper''_ :: ((Ptr ()) -> (CInt -> (CInt -> (CInt -> (CInt -> (IO ()))))))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Valuator.chs.h Fl_Valuator_resize"
  resize''_ :: ((Ptr ()) -> (CInt -> (CInt -> (CInt -> (CInt -> (IO ()))))))

foreign import ccall unsafe "Graphics/UI/FLTK/LowLevel/Valuator.chs.h Fl_Valuator_bounds"
  bounds''_ :: ((Ptr ()) -> (CDouble -> (CDouble -> (IO ()))))

foreign import ccall unsafe "Graphics/UI/FLTK/LowLevel/Valuator.chs.h Fl_Valuator_minimum"
  minimum''_ :: ((Ptr ()) -> (IO CDouble))

foreign import ccall unsafe "Graphics/UI/FLTK/LowLevel/Valuator.chs.h Fl_Valuator_set_minimum"
  setMinimum''_ :: ((Ptr ()) -> (CDouble -> (IO ())))

foreign import ccall unsafe "Graphics/UI/FLTK/LowLevel/Valuator.chs.h Fl_Valuator_maximum"
  maximum''_ :: ((Ptr ()) -> (IO CDouble))

foreign import ccall unsafe "Graphics/UI/FLTK/LowLevel/Valuator.chs.h Fl_Valuator_set_maximum"
  setMaximum''_ :: ((Ptr ()) -> (CDouble -> (IO ())))

foreign import ccall unsafe "Graphics/UI/FLTK/LowLevel/Valuator.chs.h Fl_Valuator_range"
  range''_ :: ((Ptr ()) -> (CDouble -> (CDouble -> (IO ()))))

foreign import ccall unsafe "Graphics/UI/FLTK/LowLevel/Valuator.chs.h Fl_Valuator_set_step_with_a_b"
  setStepWithAB''_ :: ((Ptr ()) -> (CDouble -> (CInt -> (IO ()))))

foreign import ccall unsafe "Graphics/UI/FLTK/LowLevel/Valuator.chs.h Fl_Valuator_step"
  step''_ :: ((Ptr ()) -> (IO CDouble))

foreign import ccall unsafe "Graphics/UI/FLTK/LowLevel/Valuator.chs.h Fl_Valuator_precision"
  precision''_ :: ((Ptr ()) -> (CInt -> (IO ())))

foreign import ccall unsafe "Graphics/UI/FLTK/LowLevel/Valuator.chs.h Fl_Valuator_value"
  value''_ :: ((Ptr ()) -> (IO CDouble))

foreign import ccall unsafe "Graphics/UI/FLTK/LowLevel/Valuator.chs.h Fl_Valuator_set_value"
  setValue''_ :: ((Ptr ()) -> (CDouble -> (IO CInt)))

foreign import ccall unsafe "Graphics/UI/FLTK/LowLevel/Valuator.chs.h Fl_Valuator_format"
  format''_ :: ((Ptr ()) -> ((Ptr CChar) -> (IO CInt)))

foreign import ccall unsafe "Graphics/UI/FLTK/LowLevel/Valuator.chs.h Fl_Valuator_round"
  round''_ :: ((Ptr ()) -> (CDouble -> (IO CDouble)))

foreign import ccall unsafe "Graphics/UI/FLTK/LowLevel/Valuator.chs.h Fl_Valuator_clamp"
  clamp''_ :: ((Ptr ()) -> (CDouble -> (IO CDouble)))

foreign import ccall unsafe "Graphics/UI/FLTK/LowLevel/Valuator.chs.h Fl_Valuator_increment"
  increment''_ :: ((Ptr ()) -> (CDouble -> (CInt -> (IO CDouble))))