-- 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/Adjuster.chs" #-}
{-# LANGUAGE CPP, ExistentialQuantification, TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses, FlexibleContexts, ScopedTypeVariables #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Graphics.UI.FLTK.LowLevel.Base.Adjuster
    (
     -- * Constructor
     adjusterNew,
     adjusterCustom
   , drawAdjusterBase
   , handleAdjusterBase
   , resizeAdjusterBase
   , hideAdjusterBase
   , showWidgetAdjusterBase
     -- * 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 34 "src/Graphics/UI/FLTK/LowLevel/Base/Adjuster.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 35 "src/Graphics/UI/FLTK/LowLevel/Base/Adjuster.chs" #-}

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


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

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

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

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

adjusterNew :: Rectangle -> Maybe T.Text -> IO (Ref Adjuster)
adjusterNew rectangle l'=
    let (x_pos, y_pos, width, height) = fromRectangle rectangle
    in do
      r <- case l' of
            Nothing -> adjusterNew' x_pos y_pos width height >>= toRef
            Just l -> copyTextToCString l >>= \l' -> adjusterNewWithLabel' x_pos y_pos width height l' >>= toRef
      setFlag r WidgetFlagCopiedLabel
      setFlag r WidgetFlagCopiedTooltip
      return r

adjusterDestroy' :: (Ptr ()) -> IO ((()))
adjusterDestroy' :: Ptr () -> IO ()
adjusterDestroy' a1 :: Ptr ()
a1 =
  let {a1' = id a1} in 
  adjusterDestroy''_ 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/Adjuster.chs" #-}

instance (impl ~ (IO ())) => Op (Destroy ()) AdjusterBase orig impl where
  runOp _ _ adjuster = swapRef adjuster $ \adjusterPtr -> do
    adjusterDestroy' adjusterPtr
    return nullPtr

soft' :: (Ptr ()) -> IO ((Bool))
soft' a1 =
  let {a1' = id a1} in 
  soft''_ a1' >>= \res ->
  let {res' = cToBool res} in
  return (res')

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

instance (impl ~ ( IO (Bool))) => Op (GetSoft ()) AdjusterBase orig impl where
  runOp _ _ adjuster = withRef adjuster $ \adjusterPtr -> soft' adjusterPtr

setSoft' :: (Ptr ()) -> (Bool) -> IO ()
setSoft' a1 a2 =
  let {a1' = id a1} in 
  let {a2' = cFromBool a2} in 
  setSoft''_ a1' a2' >>
  return ()

{-# LINE 75 "src/Graphics/UI/FLTK/LowLevel/Base/Adjuster.chs" #-}

instance (impl ~ (Bool->  IO ())) => Op (SetSoft ()) AdjusterBase orig impl where
  runOp _ _ adjuster soft = withRef adjuster $ \adjusterPtr -> setSoft' adjusterPtr soft

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

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

drawAdjusterBase ::  Ref AdjusterBase -> IO ()
drawAdjusterBase adjuster = withRef adjuster $ \adjusterPtr -> drawSuper' adjusterPtr
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 82 "src/Graphics/UI/FLTK/LowLevel/Base/Adjuster.chs" #-}

handleAdjusterBase :: Ref AdjusterBase -> Event ->  IO (Either UnknownEvent ())
handleAdjusterBase adjuster event = withRef adjuster $ \adjusterPtr -> handleSuper' adjusterPtr (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 85 "src/Graphics/UI/FLTK/LowLevel/Base/Adjuster.chs" #-}

resizeAdjusterBase :: Ref AdjusterBase -> Rectangle -> IO ()
resizeAdjusterBase adjuster rectangle =
    let (x_pos, y_pos, width, height) = fromRectangle rectangle
    in withRef adjuster $ \adjusterPtr -> resizeSuper' adjusterPtr 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 90 "src/Graphics/UI/FLTK/LowLevel/Base/Adjuster.chs" #-}

hideAdjusterBase ::  Ref AdjusterBase -> IO ()
hideAdjusterBase adjuster = withRef adjuster $ \adjusterPtr -> hideSuper' adjusterPtr
showSuper' :: (Ptr ()) -> IO ((()))
showSuper' a1 =
  let {a1' = id a1} in 
  showSuper''_ a1' >>= \res ->
  let {res' = supressWarningAboutRes res} in
  return (res')

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

showWidgetAdjusterBase ::  Ref AdjusterBase -> IO ()
showWidgetAdjusterBase adjuster = withRef adjuster $ \adjusterPtr -> showSuper' adjusterPtr

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

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

instance (impl ~ ( IO ())) => Op (Draw ()) AdjusterBase orig impl where
  runOp _ _ adjuster = withRef adjuster $ \adjusterPtr -> draw' adjusterPtr
handle' :: (Ptr ()) -> (Int) -> IO ((Int))
handle' a1 a2 =
  let {a1' = id a1} in 
  let {a2' = fromIntegral a2} in 
  handle''_ a1' a2' >>= \res ->
  let {res' = fromIntegral res} in
  return (res')

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

instance (impl ~ (Event ->  IO (Either UnknownEvent ()))) => Op (Handle ()) AdjusterBase orig impl where
  runOp _ _ adjuster event = withRef adjuster $ \adjusterPtr -> handle' adjusterPtr (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/Base/Adjuster.chs" #-}

instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) AdjusterBase orig impl where
  runOp _ _ adjuster rectangle =
    let (x_pos, y_pos, width, height) = fromRectangle rectangle
    in withRef adjuster $ \adjusterPtr -> resizeSuper' adjusterPtr x_pos y_pos width height
hide' :: (Ptr ()) -> IO ((()))
hide' a1 =
  let {a1' = id a1} in 
  hide''_ a1' >>= \res ->
  let {res' = supressWarningAboutRes res} in
  return (res')

{-# LINE 108 "src/Graphics/UI/FLTK/LowLevel/Base/Adjuster.chs" #-}

instance (impl ~ ( IO ())) => Op (Hide ()) AdjusterBase orig impl where
  runOp _ _ adjuster = withRef adjuster $ \adjusterPtr -> hide' adjusterPtr
show' :: (Ptr ()) -> IO ((()))
show' a1 =
  let {a1' = id a1} in 
  show''_ a1' >>= \res ->
  let {res' = supressWarningAboutRes res} in
  return (res')

{-# LINE 111 "src/Graphics/UI/FLTK/LowLevel/Base/Adjuster.chs" #-}

instance (impl ~ ( IO ())) => Op (ShowWidget ()) AdjusterBase orig impl where
  runOp _ _ adjuster = withRef adjuster $ \adjusterPtr -> show' adjusterPtr

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

-- $functions
-- @
-- destroy :: 'Ref' 'AdjusterBase' -> 'IO' ()
--
-- draw :: 'Ref' 'AdjusterBase' -> 'IO' ()
--
-- getSoft :: 'Ref' 'AdjusterBase' -> 'IO' ('Bool')
--
-- handle :: 'Ref' 'AdjusterBase' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ())
--
-- hide :: 'Ref' 'AdjusterBase' -> 'IO' ()
--
-- resize :: 'Ref' 'AdjusterBase' -> 'Rectangle' -> 'IO' ()
--
-- setSoft :: 'Ref' 'AdjusterBase' -> 'Bool'>- 'IO' ()
--
-- showWidget :: 'Ref' 'AdjusterBase' -> 'IO' ()
-- @

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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