-- GENERATED by C->Haskell Compiler, version 0.28.6 Switcheroo, 25 November 2017 (Haskell)
-- Edit the ORIGNAL .chs file instead!


{-# LINE 1 "src/Graphics/UI/FLTK/LowLevel/Base/Progress.chs" #-}
{-# LANGUAGE CPP, ExistentialQuantification, TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses, FlexibleContexts, ScopedTypeVariables #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Graphics.UI.FLTK.LowLevel.Base.Progress
    (
     -- * Constructor
     progressNew,
     progressCustom
  , drawProgressBase
  , handleProgressBase
  , resizeProgressBase
  , hideProgressBase
  , showWidgetProgressBase
     -- * 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 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
import Graphics.UI.FLTK.LowLevel.Fl_Enumerations
import Graphics.UI.FLTK.LowLevel.Base.Widget

overriddenWidgetNewWithLabel' :: (Int) -> (Int) -> (Int) -> (Int) -> (CString) -> (Ptr ()) -> IO ((Ptr ()))
overriddenWidgetNewWithLabel' 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 
  (flip ($)) a5 $ \a5' -> 
  let {a6' = id a6} in 
  overriddenWidgetNewWithLabel''_ a1' a2' a3' a4' a5' a6' >>= \res ->
  let {res' = id res} in
  return (res')

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

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

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

progressCustom ::
       Rectangle                         -- ^ The bounds of this Progress
    -> Maybe T.Text                      -- ^ The Progress label
    -> Maybe (Ref Progress -> IO ())           -- ^ Optional custom drawing function
    -> Maybe (CustomWidgetFuncs Progress)      -- ^ Optional custom widget functions
    -> IO (Ref Progress)
progressCustom rectangle l' draw' funcs' =
  widgetMaker
    rectangle
    l'
    draw'
    funcs'
    overriddenWidgetNew'
    overriddenWidgetNewWithLabel'


progressNew' :: (Int) -> (Int) -> (Int) -> (Int) -> IO ((Ptr ()))
progressNew' :: Int -> Int -> Int -> Int -> IO (Ptr ())
progressNew' a1 :: Int
a1 a2 :: Int
a2 a3 :: Int
a3 a4 :: Int
a4 =
  let {a1' :: CInt
a1' = Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a1} in 
  let {a2' :: CInt
a2' = Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a2} in 
  let {a3' :: CInt
a3' = Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a3} in 
  let {a4' :: CInt
a4' = Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a4} in 
  CInt -> CInt -> CInt -> CInt -> IO (Ptr ())
progressNew''_ CInt
a1' CInt
a2' CInt
a3' CInt
a4' IO (Ptr ()) -> (Ptr () -> IO (Ptr ())) -> IO (Ptr ())
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \res :: Ptr ()
res ->
  let {res' :: Ptr ()
res' = Ptr () -> Ptr ()
forall a. a -> a
id Ptr ()
res} in
  Ptr () -> IO (Ptr ())
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr ()
res')

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

progressNewWithLabel' :: (Int) -> (Int) -> (Int) -> (Int) -> (CString) -> 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 
  (flip ($)) a5 $ \a5' -> 
  progressNewWithLabel''_ a1' a2' a3' a4' a5' >>= \res ->
  let {res' = id res} in
  return (res')

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

progressNew :: Rectangle -> Maybe T.Text -> IO (Ref Progress)
progressNew rectangle l'=
  widgetMaker
    rectangle
    l'
    Nothing
    Nothing
    overriddenWidgetNew'
    overriddenWidgetNewWithLabel'

progressDestroy' :: (Ptr ()) -> IO ((()))
progressDestroy' :: Ptr () -> IO ()
progressDestroy' a1 :: Ptr ()
a1 =
  let {a1' = id a1} in 
  progressDestroy''_ a1' >>= \res ->
  let {res' = () -> ()
forall a. a -> ()
supressWarningAboutRes ()
res} in
  () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return (()
res')

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

instance (impl ~ ( IO ())) => Op (Destroy ()) ProgressBase 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 70 "src/Graphics/UI/FLTK/LowLevel/Base/Progress.chs" #-}

instance (impl ~ (Float ->  IO ())) => Op (SetMaximum ()) ProgressBase 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')

minimum' :: Ptr () -> IO Float
{-# LINE 73 "src/Graphics/UI/FLTK/LowLevel/Base/Progress.chs" #-}

instance (impl ~ ( IO (Float))) => Op (GetMaximum ()) ProgressBase 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 76 "src/Graphics/UI/FLTK/LowLevel/Base/Progress.chs" #-}

instance (impl ~ (Float ->  IO ())) => Op (SetMinimum ()) ProgressBase 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 79 "src/Graphics/UI/FLTK/LowLevel/Base/Progress.chs" #-}

instance (impl ~ ( IO (Float))) => Op (GetMinimum ()) ProgressBase 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 82 "src/Graphics/UI/FLTK/LowLevel/Base/Progress.chs" #-}

instance (impl ~ (Float ->  IO ())) => Op (SetValue ()) ProgressBase 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 85 "src/Graphics/UI/FLTK/LowLevel/Base/Progress.chs" #-}

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

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

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

drawProgressBase ::  Ref ProgressBase -> IO ()
drawProgressBase progress = withRef progress $ \progressPtr -> drawSuper' progressPtr
handleSuper' :: (Ptr ()) -> (Int) -> IO ((Int))
handleSuper' a1 a2 =
  let {a1' = id a1} in 
  let {a2' = fromIntegral a2} in 
  handleSuper''_ a1' a2' >>= \res ->
  let {res' = fromIntegral res} in
  return (res')

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

handleProgressBase :: Ref ProgressBase -> Event ->  IO (Either UnknownEvent ())
handleProgressBase progress event = withRef progress $ \progressPtr -> handleSuper' progressPtr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent
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 95 "src/Graphics/UI/FLTK/LowLevel/Base/Progress.chs" #-}

resizeProgressBase :: Ref ProgressBase -> Rectangle -> IO ()
resizeProgressBase progress rectangle =
    let (x_pos, y_pos, width, height) = fromRectangle rectangle
    in withRef progress $ \progressPtr -> resizeSuper' progressPtr x_pos y_pos width height
hideSuper' :: (Ptr ()) -> IO ((()))
hideSuper' a1 =
  let {a1' = id a1} in 
  hideSuper''_ a1' >>= \res ->
  let {res' = supressWarningAboutRes res} in
  return (res')

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

hideProgressBase ::  Ref ProgressBase -> IO ()
hideProgressBase progress = withRef progress $ \progressPtr -> hideSuper' progressPtr
showSuper' :: (Ptr ()) -> IO ((()))
showSuper' a1 =
  let {a1' = id a1} in 
  showSuper''_ a1' >>= \res ->
  let {res' = supressWarningAboutRes res} in
  return (res')

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

showWidgetProgressBase ::  Ref ProgressBase -> IO ()
showWidgetProgressBase progress = withRef progress $ \progressPtr -> showSuper' progressPtr

draw'' :: (Ptr ()) -> IO ()
draw'' a1 =
  let {a1' = id a1} in 
  draw'''_ a1' >>
  return ()

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

instance (impl ~ (  IO ())) => Op (Draw ()) ProgressBase orig impl where
  runOp _ _ progress = withRef progress $ \progressPtr -> draw'' progressPtr
progressHandle' :: (Ptr ()) -> (CInt) -> IO ((Int))
progressHandle' a1 a2 =
  let {a1' = id a1} in 
  let {a2' = id a2} in 
  progressHandle''_ a1' a2' >>= \res ->
  let {res' = fromIntegral res} in
  return (res')

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

instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) ProgressBase orig impl where
  runOp _ _ progress event = withRef progress (\p -> progressHandle' p (fromIntegral . fromEnum $ event)) >>= return  . successOrUnknownEvent
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 113 "src/Graphics/UI/FLTK/LowLevel/Base/Progress.chs" #-}

instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) ProgressBase orig impl where
  runOp _ _ progress rectangle = withRef progress $ \progressPtr -> do
                                 let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle
                                 resize' progressPtr x_pos y_pos w_pos h_pos
hide' :: (Ptr ()) -> IO ()
hide' a1 =
  let {a1' = id a1} in 
  hide''_ a1' >>
  return ()

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

instance (impl ~ (  IO ())) => Op (Hide ()) ProgressBase orig impl where
  runOp _ _ progress = withRef progress $ \progressPtr -> hide' progressPtr
show' :: (Ptr ()) -> IO ()
show' a1 =
  let {a1' = id a1} in 
  show''_ a1' >>
  return ()

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

instance (impl ~ (  IO ())) => Op (ShowWidget ()) ProgressBase orig impl where
  runOp _ _ progress = withRef progress $ \progressPtr -> show' progressPtr


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

-- $functions
-- @
-- destroy :: 'Ref' 'ProgressBase' -> 'IO' ()
--
-- draw :: 'Ref' 'ProgressBase' -> 'IO' ()
--
-- getMaximum :: 'Ref' 'ProgressBase' -> 'IO' ('Float')
--
-- getMinimum :: 'Ref' 'ProgressBase' -> 'IO' ('Float')
--
-- getValue :: 'Ref' 'ProgressBase' -> 'IO' ('Float')
--
-- handle :: 'Ref' 'ProgressBase' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ())
--
-- hide :: 'Ref' 'ProgressBase' -> 'IO' ()
--
-- resize :: 'Ref' 'ProgressBase' -> 'Rectangle' -> 'IO' ()
--
-- setMaximum :: 'Ref' 'ProgressBase' -> 'Float' -> 'IO' ()
--
-- setMinimum :: 'Ref' 'ProgressBase' -> 'Float' -> 'IO' ()
--
-- setValue :: 'Ref' 'ProgressBase' -> 'Float' -> 'IO' ()
--
-- showWidget :: 'Ref' 'ProgressBase' -> 'IO' ()
-- @

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

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

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/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/Base/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/Base/Progress.chs.h Fl_Progress_Destroy"
  progressDestroy''_ :: ((C2HSImp.Ptr ()) -> (IO ()))

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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