-- 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/Timer.chs" #-}
{-# LANGUAGE CPP, ExistentialQuantification, TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses, FlexibleContexts, ScopedTypeVariables #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Graphics.UI.FLTK.LowLevel.Timer
    (
     -- * Constructor
     timerNew,
     timerCustom,
     -- * Hierarchy
     --
     -- $hierarchy

     valueTimerNew,
     hiddenTimerNew
     -- * 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.Widget
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 qualified Data.Text as T

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

{-# LINE 31 "src/Graphics/UI/FLTK/LowLevel/Timer.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 32 "src/Graphics/UI/FLTK/LowLevel/Timer.chs" #-}

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


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

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

timerNew :: Rectangle -> T.Text -> IO (Ref Timer)
timerNew rectangle l'=
    let (x_pos, y_pos, width, height) = fromRectangle rectangle
    in timerNewWithLabel' x_pos y_pos width height l' >>= toRef
valueTimerNewWithLabel' :: (Int) -> (Int) -> (Int) -> (Int) -> (T.Text) -> IO ((Ptr ()))
valueTimerNewWithLabel' 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 
  valueTimerNewWithLabel''_ a1' a2' a3' a4' a5' >>= \res ->
  let {res' = id res} in
  return (res')

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

valueTimerNew :: Rectangle -> T.Text -> IO (Ref ValueTimer)
valueTimerNew rectangle l'=
    let (x_pos, y_pos, width, height) = fromRectangle rectangle
    in
    valueTimerNewWithLabel' x_pos y_pos width height l' >>= toRef

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

{-# LINE 61 "src/Graphics/UI/FLTK/LowLevel/Timer.chs" #-}

hiddenTimerNew :: Rectangle -> T.Text -> IO (Ref HiddenTimer)
hiddenTimerNew rectangle l'=
    let (x_pos, y_pos, width, height) = fromRectangle rectangle
    in
    hiddenTimerNewWithLabel' x_pos y_pos width height l' >>= toRef

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

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

instance (impl ~ (IO ())) => Op (Destroy ()) Timer orig impl where
  runOp _ _ win = swapRef win $ \winPtr -> do
                                        timerDestroy' winPtr
                                        return nullPtr
direction' :: (Ptr ()) -> IO ((CChar))
direction' a1 =
  let {a1' = id a1} in 
  direction''_ a1' >>= \res ->
  let {res' = id res} in
  return (res')

{-# LINE 73 "src/Graphics/UI/FLTK/LowLevel/Timer.chs" #-}

instance (impl ~ ( IO (CountDirection))) => Op (GetDirection ()) Timer orig impl where
  runOp _ _ adjuster = withRef adjuster $ \adjusterPtr -> direction' adjusterPtr >>= return . ccharToCountDirection
setDirection' :: (Ptr ()) -> (CChar) -> IO ()
setDirection' a1 a2 =
  let {a1' = id a1} in 
  let {a2' = id a2} in 
  setDirection''_ a1' a2' >>
  return ()

{-# LINE 76 "src/Graphics/UI/FLTK/LowLevel/Timer.chs" #-}

instance (impl ~ (CountDirection ->  IO ())) => Op (SetDirection ()) Timer orig impl where
  runOp _ _ adjuster d = withRef adjuster $ \adjusterPtr -> setDirection' adjusterPtr (countDirectionToCChar d)
value' :: (Ptr ()) -> IO ((Double))
value' a1 =
  let {a1' = id a1} in 
  value''_ a1' >>= \res ->
  let {res' = realToFrac res} in
  return (res')

{-# LINE 79 "src/Graphics/UI/FLTK/LowLevel/Timer.chs" #-}

instance (impl ~ ( IO (Double))) => Op (GetValue ()) Timer orig impl where
  runOp _ _ adjuster = withRef adjuster $ \adjusterPtr -> value' adjusterPtr
setValue' :: (Ptr ()) -> (Double) -> 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/Timer.chs" #-}

instance (impl ~ (Double ->  IO ())) => Op (SetValue ()) Timer orig impl where
  runOp _ _ adjuster value = withRef adjuster $ \adjusterPtr -> setValue' adjusterPtr value
suspended' :: (Ptr ()) -> IO ((Bool))
suspended' a1 =
  let {a1' = id a1} in 
  suspended''_ a1' >>= \res ->
  let {res' = cToBool res} in
  return (res')

{-# LINE 85 "src/Graphics/UI/FLTK/LowLevel/Timer.chs" #-}

instance (impl ~ ( IO (Bool))) => Op (GetSuspended ()) Timer orig impl where
  runOp _ _ adjuster = withRef adjuster $ \adjusterPtr -> suspended' adjusterPtr
setSuspended' :: (Ptr ()) -> (Bool) -> IO ()
setSuspended' a1 a2 =
  let {a1' = id a1} in 
  let {a2' = cFromBool a2} in 
  setSuspended''_ a1' a2' >>
  return ()

{-# LINE 88 "src/Graphics/UI/FLTK/LowLevel/Timer.chs" #-}

instance (impl ~ (Bool ->  IO ())) => Op (SetSuspended ()) Timer orig impl where
  runOp _ _ adjuster s = withRef adjuster $ \adjusterPtr -> setSuspended' adjusterPtr s
draw'' :: (Ptr ()) -> IO ()
draw'' a1 =
  let {a1' = id a1} in 
  draw'''_ a1' >>
  return ()

{-# LINE 91 "src/Graphics/UI/FLTK/LowLevel/Timer.chs" #-}

instance (impl ~ (  IO ())) => Op (Draw ()) Timer orig impl where
  runOp _ _ timer = withRef timer $ \timerPtr -> draw'' timerPtr
drawSuper' :: (Ptr ()) -> IO ((()))
drawSuper' a1 =
  let {a1' = id a1} in 
  drawSuper''_ a1' >>= \res ->
  let {res' = supressWarningAboutRes res} in
  return (res')

{-# LINE 94 "src/Graphics/UI/FLTK/LowLevel/Timer.chs" #-}

instance (impl ~ ( IO ())) => Op (DrawSuper ()) Timer orig impl where
  runOp _ _ timer = withRef timer $ \timerPtr -> drawSuper' timerPtr
timerHandle' :: (Ptr ()) -> (CInt) -> IO ((Int))
timerHandle' a1 a2 =
  let {a1' = id a1} in 
  let {a2' = id a2} in 
  timerHandle''_ a1' a2' >>= \res ->
  let {res' = fromIntegral res} in
  return (res')

{-# LINE 97 "src/Graphics/UI/FLTK/LowLevel/Timer.chs" #-}

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

instance (impl ~ (Event ->  IO (Either UnknownEvent ()))) => Op (HandleSuper ()) Timer orig impl where
  runOp _ _ timer event = withRef timer $ \timerPtr -> handleSuper' timerPtr (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 103 "src/Graphics/UI/FLTK/LowLevel/Timer.chs" #-}

instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) Timer orig impl where
  runOp _ _ timer rectangle = withRef timer $ \timerPtr -> do
                                 let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle
                                 resize' timerPtr x_pos y_pos w_pos h_pos
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 108 "src/Graphics/UI/FLTK/LowLevel/Timer.chs" #-}

instance (impl ~ (Rectangle -> IO ())) => Op (ResizeSuper ()) Timer orig impl where
  runOp _ _ timer rectangle =
    let (x_pos, y_pos, width, height) = fromRectangle rectangle
    in withRef timer $ \timerPtr -> resizeSuper' timerPtr x_pos y_pos width height
hide' :: (Ptr ()) -> IO ()
hide' a1 =
  let {a1' = id a1} in 
  hide''_ a1' >>
  return ()

{-# LINE 113 "src/Graphics/UI/FLTK/LowLevel/Timer.chs" #-}

instance (impl ~ (  IO ())) => Op (Hide ()) Timer orig impl where
  runOp _ _ timer = withRef timer $ \timerPtr -> hide' timerPtr
hideSuper' :: (Ptr ()) -> IO ((()))
hideSuper' a1 =
  let {a1' = id a1} in 
  hideSuper''_ a1' >>= \res ->
  let {res' = supressWarningAboutRes res} in
  return (res')

{-# LINE 116 "src/Graphics/UI/FLTK/LowLevel/Timer.chs" #-}

instance (impl ~ ( IO ())) => Op (HideSuper ()) Timer orig impl where
  runOp _ _ timer = withRef timer $ \timerPtr -> hideSuper' timerPtr
show' :: (Ptr ()) -> IO ()
show' a1 =
  let {a1' = id a1} in 
  show''_ a1' >>
  return ()

{-# LINE 119 "src/Graphics/UI/FLTK/LowLevel/Timer.chs" #-}

instance (impl ~ (  IO ())) => Op (ShowWidget ()) Timer orig impl where
  runOp _ _ timer = withRef timer $ \timerPtr -> show' timerPtr
showSuper' :: (Ptr ()) -> IO ((()))
showSuper' a1 =
  let {a1' = id a1} in 
  showSuper''_ a1' >>= \res ->
  let {res' = supressWarningAboutRes res} in
  return (res')

{-# LINE 122 "src/Graphics/UI/FLTK/LowLevel/Timer.chs" #-}

instance (impl ~ ( IO ())) => Op (ShowWidgetSuper ()) Timer orig impl where
  runOp _ _ timer = withRef timer $ \timerPtr -> showSuper' timerPtr

-- $functions
-- @
--
-- destroy :: 'Ref' 'Timer' -> 'IO' ()
--
-- draw :: 'Ref' 'Timer' -> 'IO' ()
--
-- drawSuper :: 'Ref' 'Timer' -> 'IO' ()
--
-- getDirection :: 'Ref' 'Timer' -> 'IO' ('CountDirection')
--
-- getSuspended :: 'Ref' 'Timer' -> 'IO' ('Bool')
--
-- getValue :: 'Ref' 'Timer' -> 'IO' ('Double')
--
-- handle :: 'Ref' 'Timer' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ())
--
-- handleSuper :: 'Ref' 'Timer' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ())
--
-- hide :: 'Ref' 'Timer' -> 'IO' ()
--
-- hideSuper :: 'Ref' 'Timer' -> 'IO' ()
--
-- resize :: 'Ref' 'Timer' -> 'Rectangle' -> 'IO' ()
--
-- resizeSuper :: 'Ref' 'Timer' -> 'Rectangle' -> 'IO' ()
--
-- setDirection :: 'Ref' 'Timer' -> 'CountDirection' -> 'IO' ()
--
-- setSuspended :: 'Ref' 'Timer' -> 'Bool' -> 'IO' ()
--
-- setValue :: 'Ref' 'Timer' -> 'Double' -> 'IO' ()
--
-- showWidget :: 'Ref' 'Timer' -> 'IO' ()
--
-- showWidgetSuper :: 'Ref' 'Timer' -> 'IO' ()
-- @

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

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Timer.chs.h Fl_OverriddenTimer_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/Timer.chs.h Fl_OverriddenTimer_New"
  overriddenWidgetNew''_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr ()) -> (IO (C2HSImp.Ptr ())))))))

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

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

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

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Timer.chs.h Fl_Timer_Destroy"
  timerDestroy''_ :: ((C2HSImp.Ptr ()) -> (IO ()))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Timer.chs.h Fl_Timer_direction"
  direction''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CChar))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Timer.chs.h Fl_Timer_set_direction"
  setDirection''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CChar -> (IO ())))

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

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

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Timer.chs.h Fl_Timer_suspended"
  suspended''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CChar))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Timer.chs.h Fl_Timer_set_suspended"
  setSuspended''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CChar -> (IO ())))

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

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

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

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

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

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

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

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

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

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