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

     -- * Dial functions
     --
     -- $Dialfunctions
    )
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_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
import Graphics.UI.FLTK.LowLevel.Widget

data DialType = NormalDialType
              | LineDialType
              | FillDialType
  deriving (Show,Eq)
instance Enum DialType where
  succ NormalDialType = LineDialType
  succ LineDialType = FillDialType
  succ FillDialType = error "DialType.succ: FillDialType has no successor"

  pred LineDialType = NormalDialType
  pred FillDialType = LineDialType
  pred NormalDialType = error "DialType.pred: NormalDialType has no predecessor"

  enumFromTo from to = go from
    where
      end = fromEnum to
      go v = case compare (fromEnum v) end of
                 LT -> v : go (succ v)
                 EQ -> [v]
                 GT -> []

  enumFrom from = enumFromTo from FillDialType

  fromEnum NormalDialType = 0
  fromEnum LineDialType = 1
  fromEnum FillDialType = 2

  toEnum 0 = NormalDialType
  toEnum 1 = LineDialType
  toEnum 2 = FillDialType
  toEnum unmatched = error ("DialType.toEnum: Cannot match " ++ show unmatched)

{-# LINE 37 "src/Graphics/UI/FLTK/LowLevel/Dial.chs" #-}


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 39 "src/Graphics/UI/FLTK/LowLevel/Dial.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 40 "src/Graphics/UI/FLTK/LowLevel/Dial.chs" #-}

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

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

{-# LINE 56 "src/Graphics/UI/FLTK/LowLevel/Dial.chs" #-}

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

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

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

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

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

instance (impl ~ (IO ())) => Op (Destroy ()) Dial orig impl where
  runOp _ _ win = swapRef win $ \winPtr -> do
    dialDestroy' winPtr
    return nullPtr

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

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

instance (impl ~ ( Angle -> IO ())) => Op (SetAngle1 ()) Dial orig impl where
  runOp _ _ dial (Angle a) = withRef dial $ \dialPtr -> setAngle1' dialPtr a
setAngle2' :: (Ptr ()) -> (CShort) -> IO ()
setAngle2' a1 a2 =
  let {a1' = id a1} in
  let {a2' = id a2} in
  setAngle2''_ a1' a2' >>
  return ()

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

instance (impl ~ ( Angle -> IO ())) => Op (SetAngle2 ()) Dial orig impl where
  runOp _ _ dial (Angle a) = withRef dial $ \dialPtr -> setAngle2' dialPtr a
angle1' :: (Ptr ()) -> IO ((CShort))
angle1' a1 =
  let {a1' = id a1} in
  angle1''_ a1' >>= \res ->
  let {res' = id res} in
  return (res')

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

instance (impl ~ ( IO (Angle))) => Op (GetAngle1 ()) Dial orig impl where
  runOp _ _ dial = withRef dial $ \dialPtr -> angle1' dialPtr >>= return . Angle
angle2' :: (Ptr ()) -> IO ((CShort))
angle2' a1 =
  let {a1' = id a1} in
  angle2''_ a1' >>= \res ->
  let {res' = id res} in
  return (res')

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

instance (impl ~ ( IO (Angle))) => Op (GetAngle2 ()) Dial orig impl where
  runOp _ _ dial = withRef dial $ \dialPtr -> angle2' dialPtr >>= return . Angle
instance (impl ~ ( Angle -> Angle -> IO ())) => Op (SetAngles ()) Dial orig impl where
  runOp _ _ dial a1' a2' = do
    setAngle1 dial a1'
    setAngle2 dial a2'
setType' :: (Ptr ()) -> (Word8) -> IO ((()))
setType' a1 a2 =
  let {a1' = id a1} in
  let {a2' = fromIntegral a2} in
  setType''_ a1' a2' >>= \res ->
  let {res' = supressWarningAboutRes res} in
  return (res')

{-# LINE 90 "src/Graphics/UI/FLTK/LowLevel/Dial.chs" #-}

instance (impl ~ (DialType ->  IO ())) => Op (SetType ()) Dial orig impl where
  runOp _ _ widget t = withRef widget $ \widgetPtr -> setType' widgetPtr (fromInteger $ toInteger $ fromEnum t)
type' :: (Ptr ()) -> IO ((Word8))
type' a1 =
  let {a1' = id a1} in
  type''_ a1' >>= \res ->
  let {res' = fromIntegral res} in
  return (res')

{-# LINE 93 "src/Graphics/UI/FLTK/LowLevel/Dial.chs" #-}

instance (impl ~ IO (DialType)) => Op (GetType_ ()) Dial orig impl where
  runOp _ _ widget = withRef widget $ \widgetPtr -> type' widgetPtr >>= return . toEnum . fromInteger . toInteger
draw'' :: (Ptr ()) -> IO ()
draw'' a1 =
  let {a1' = id a1} in
  draw'''_ a1' >>
  return ()

{-# LINE 96 "src/Graphics/UI/FLTK/LowLevel/Dial.chs" #-}

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

{-# LINE 99 "src/Graphics/UI/FLTK/LowLevel/Dial.chs" #-}

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

{-# LINE 102 "src/Graphics/UI/FLTK/LowLevel/Dial.chs" #-}

instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Dial orig impl where
  runOp _ _ dial event = withRef dial (\p -> dialHandle' 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 105 "src/Graphics/UI/FLTK/LowLevel/Dial.chs" #-}

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

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

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

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

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

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

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

{-# LINE 124 "src/Graphics/UI/FLTK/LowLevel/Dial.chs" #-}

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

{-# LINE 127 "src/Graphics/UI/FLTK/LowLevel/Dial.chs" #-}

instance (impl ~ ( IO ())) => Op (ShowWidgetSuper ()) Dial orig impl where
  runOp _ _ dial = withRef dial $ \dialPtr -> showSuper' dialPtr

-- $Dialfunctions
--
-- @
-- destroy :: 'Ref' 'Dial' -> 'IO' ()
--
-- draw :: 'Ref' 'Dial' -> 'IO' ()
--
-- drawSuper :: 'Ref' 'Dial' -> 'IO' ()
--
-- getAngle1 :: 'Ref' 'Dial' -> 'IO' ('Angle')
--
-- getAngle2 :: 'Ref' 'Dial' -> 'IO' ('Angle')
--
-- getType_ :: 'Ref' 'Dial' -> 'IO' ('DialType')
--
-- handle :: 'Ref' 'Dial' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ())
--
-- handleSuper :: 'Ref' 'Dial' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ())
--
-- hide :: 'Ref' 'Dial' -> 'IO' ()
--
-- hideSuper :: 'Ref' 'Dial' -> 'IO' ()
--
-- resize :: 'Ref' 'Dial' -> 'Rectangle' -> 'IO' ()
--
-- resizeSuper :: 'Ref' 'Dial' -> 'Rectangle' -> 'IO' ()
--
-- setAngle1 :: 'Ref' 'Dial' -> 'Angle' -> 'IO' ()
--
-- setAngle2 :: 'Ref' 'Dial' -> 'Angle' -> 'IO' ()
--
-- setAngles :: 'Ref' 'Dial' -> 'Angle' -> 'Angle' -> 'IO' ()
--
-- setType :: 'Ref' 'Dial' -> 'DialType' -> 'IO' ()
--
-- showWidget :: 'Ref' 'Dial' -> 'IO' ()
--
-- showWidgetSuper :: 'Ref' 'Dial' -> 'IO' ()
-- @

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

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

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

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

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Dial.chs.h Fl_Dial_Destroy"
  dialDestroy''_ :: ((C2HSImp.Ptr ()) -> (IO ()))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Dial.chs.h Fl_Dial_set_angle1"
  setAngle1''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CShort -> (IO ())))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Dial.chs.h Fl_Dial_set_angle2"
  setAngle2''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CShort -> (IO ())))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Dial.chs.h Fl_Dial_angle1"
  angle1''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CShort))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Dial.chs.h Fl_Dial_angle2"
  angle2''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CShort))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Dial.chs.h Fl_Widget_set_type"
  setType''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CUChar -> (IO ())))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Dial.chs.h Fl_Widget_type"
  type''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CUChar))

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

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

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

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

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

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

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

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

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

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