-- GENERATED by C->Haskell Compiler, version 0.28.1 Switcheroo, 1 April 2016 (Haskell)
-- Edit the ORIGNAL .chs file instead!


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

     -- * Functions
     --
     -- $functions
    )
where
import qualified Foreign.C.Types as C2HSImp
import qualified Foreign.Ptr as C2HSImp





import C2HS hiding (cFromEnum, cFromBool, cToBool,cToEnum)
import Foreign.C.Types
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 qualified Data.Text as T

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

{-# LINE 27 "src/Graphics/UI/FLTK/LowLevel/Progress.chs" #-}

progressNewWithLabel' :: (Int) -> (Int) -> (Int) -> (Int) -> (T.Text) -> IO ((Ptr ()))
progressNewWithLabel' 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' = unsafeToCString a5} in 
  progressNewWithLabel''_ a1' a2' a3' a4' a5' >>= \res ->
  let {res' = id res} in
  return (res')

{-# LINE 28 "src/Graphics/UI/FLTK/LowLevel/Progress.chs" #-}

progressNew :: Rectangle -> Maybe T.Text -> IO (Ref Progress)
progressNew rectangle l'=
    let (x_pos, y_pos, width, height) = fromRectangle rectangle
    in case l' of
        Nothing -> progressNew' x_pos y_pos width height >>=
                             toRef
        Just l -> progressNewWithLabel' x_pos y_pos width height l >>=
                               toRef

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

{-# LINE 38 "src/Graphics/UI/FLTK/LowLevel/Progress.chs" #-}

instance (impl ~ ( IO ())) => Op (Destroy ()) Progress orig impl where
  runOp _ _ win = swapRef win $ \winPtr -> do
    progressDestroy' winPtr
    return nullPtr
setMaximum' :: (Ptr ()) -> (Float) -> IO ()
setMaximum' a1 a2 =
  let {a1' = id a1} in 
  let {a2' = realToFrac a2} in 
  setMaximum''_ a1' a2' >>
  return ()

{-# LINE 43 "src/Graphics/UI/FLTK/LowLevel/Progress.chs" #-}

instance (impl ~ (Float ->  IO ())) => Op (SetMaximum ()) Progress orig impl where
  runOp _ _ progress v = withRef progress $ \progressPtr -> setMaximum' progressPtr v
maximum' :: (Ptr ()) -> IO ((Float))
maximum' a1 =
  let {a1' = id a1} in 
  maximum''_ a1' >>= \res ->
  let {res' = realToFrac res} in
  return (res')

{-# LINE 46 "src/Graphics/UI/FLTK/LowLevel/Progress.chs" #-}

instance (impl ~ ( IO (Float))) => Op (GetMaximum ()) Progress orig impl where
  runOp _ _ progress = withRef progress $ \progressPtr -> maximum' progressPtr
setMinimum' :: (Ptr ()) -> (Float) -> IO ()
setMinimum' a1 a2 =
  let {a1' = id a1} in 
  let {a2' = realToFrac a2} in 
  setMinimum''_ a1' a2' >>
  return ()

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

instance (impl ~ (Float ->  IO ())) => Op (SetMinimum ()) Progress orig impl where
  runOp _ _ progress v = withRef progress $ \progressPtr -> setMinimum' progressPtr v
minimum' :: (Ptr ()) -> IO ((Float))
minimum' a1 =
  let {a1' = id a1} in 
  minimum''_ a1' >>= \res ->
  let {res' = realToFrac res} in
  return (res')

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

instance (impl ~ ( IO (Float))) => Op (GetMinimum ()) Progress orig impl where
  runOp _ _ progress = withRef progress $ \progressPtr -> minimum' progressPtr
setValue' :: (Ptr ()) -> (Float) -> IO ()
setValue' a1 a2 =
  let {a1' = id a1} in 
  let {a2' = realToFrac a2} in 
  setValue''_ a1' a2' >>
  return ()

{-# LINE 55 "src/Graphics/UI/FLTK/LowLevel/Progress.chs" #-}

instance (impl ~ (Float ->  IO ())) => Op (SetValue ()) Progress orig impl where
  runOp _ _ progress v = withRef progress $ \progressPtr -> setValue' progressPtr v
value' :: (Ptr ()) -> IO ((Float))
value' a1 =
  let {a1' = id a1} in 
  value''_ a1' >>= \res ->
  let {res' = realToFrac res} in
  return (res')

{-# LINE 58 "src/Graphics/UI/FLTK/LowLevel/Progress.chs" #-}

instance (impl ~ ( IO (Float))) => Op (GetValue ()) Progress orig impl where
  runOp _ _ progress = withRef progress $ \progressPtr -> value' progressPtr

-- $functions
-- @
--
-- destroy :: 'Ref' 'Progress' -> 'IO' ()
--
-- getMaximum :: 'Ref' 'Progress' -> 'IO' 'Float'
--
-- getMinimum :: 'Ref' 'Progress' -> 'IO' 'Float'
--
-- getValue :: 'Ref' 'Progress' -> 'IO' 'Float'
--
-- setMaximum :: 'Ref' 'Progress' -> 'Float' -> 'IO' ()
--
-- setMinimum :: 'Ref' 'Progress' -> 'Float' -> 'IO' ()
--
-- setValue :: 'Ref' 'Progress' -> 'Float' -> 'IO' ()
-- @

-- $hierarchy
-- @
-- "Graphics.UI.FLTK.LowLevel.Widget"
--  |
--  v
-- "Graphics.UI.FLTK.LowLevel.Progress"
-- @

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Progress.chs.h Fl_Progress_New"
  progressNew''_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (IO (C2HSImp.Ptr ()))))))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Progress.chs.h Fl_Progress_New_WithLabel"
  progressNewWithLabel''_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr C2HSImp.CChar) -> (IO (C2HSImp.Ptr ())))))))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Progress.chs.h Fl_Progress_Destroy"
  progressDestroy''_ :: ((C2HSImp.Ptr ()) -> (IO ()))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Progress.chs.h Fl_Progress_set_maximum"
  setMaximum''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CFloat -> (IO ())))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Progress.chs.h Fl_Progress_maximum"
  maximum''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CFloat))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Progress.chs.h Fl_Progress_set_minimum"
  setMinimum''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CFloat -> (IO ())))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Progress.chs.h Fl_Progress_minimum"
  minimum''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CFloat))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Progress.chs.h Fl_Progress_set_value"
  setValue''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CFloat -> (IO ())))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Progress.chs.h Fl_Progress_value"
  value''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CFloat))