-- 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/Scrollbar.chs" #-}
{-# LANGUAGE CPP, ExistentialQuantification, TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses, FlexibleContexts, ScopedTypeVariables #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Graphics.UI.FLTK.LowLevel.Base.Scrollbar
    (
     -- * Constructor
     scrollbarNew,
     scrollbarCustom
    , drawScrollbarBase
    , handleScrollbarBase
    , resizeScrollbarBase
    , hideScrollbarBase
    , showWidgetScrollbarBase
     -- * 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.Base.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 a3 :: Int
as T

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 :: forall a. a -> a
id Ptr ()
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/Scrollbar.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/Scrollbar.chs" #-}

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


scrollbarNew' :: (Int) -> (Int) -> (Int) -> (Int) -> IO ((Ptr ()))
scrollbarNew' :: Int -> Int -> Int -> Int -> IO (Ptr ())
scrollbarNew' 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 ())
scrollbarNew''_ 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/Scrollbar.chs" #-}

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

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

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

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

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

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

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

instance (impl ~ (Y -> Lines -> LineNumber -> Lines ->  IO (Int))) => Op (Scrollvalue ()) ScrollbarBase orig impl where
  runOp _ _ slider (Y pos) (Lines size) (LineNumber first) (Lines total) = withRef slider $ \sliderPtr -> scrollvalue' sliderPtr pos size first total

setLinesize' :: (Ptr ()) -> (Int) -> IO ()
setLinesize' a1 a2 =
  let {a1' = id a1} in 
  let {a2' = fromIntegral a2} in 
  setLinesize''_ a1' a2' >>
  return ()

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

instance (impl ~ (LineSize ->  IO ())) => Op (SetLinesize ()) ScrollbarBase orig impl where
  runOp _ _ slider (LineSize i) = withRef slider $ \sliderPtr -> setLinesize' sliderPtr i

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

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

instance (impl ~ ( IO LineSize)) => Op (GetLinesize ()) ScrollbarBase orig impl where
  runOp _ _ slider = withRef slider $ \sliderPtr -> linesize' sliderPtr >>= return . LineSize

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 83 "src/Graphics/UI/FLTK/LowLevel/Base/Scrollbar.chs" #-}

instance (impl ~ (ScrollbarType ->  IO ())) => Op (SetType ()) ScrollbarBase 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 86 "src/Graphics/UI/FLTK/LowLevel/Base/Scrollbar.chs" #-}

instance (impl ~ IO (ScrollbarType)) => Op (GetType_ ()) ScrollbarBase orig impl where
  runOp _ _ widget = withRef widget $ \widgetPtr -> type' widgetPtr >>= return . toEnum . fromInteger . toInteger


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

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

drawScrollbarBase ::  Ref ScrollbarBase -> IO ()
drawScrollbarBase scrolled = withRef scrolled $ \scrolledPtr -> drawSuper' scrolledPtr
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 94 "src/Graphics/UI/FLTK/LowLevel/Base/Scrollbar.chs" #-}

handleScrollbarBase :: Ref ScrollbarBase -> Event ->  IO (Either UnknownEvent ())
handleScrollbarBase scrolled event = withRef scrolled $ \scrolledPtr -> handleSuper' scrolledPtr (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 97 "src/Graphics/UI/FLTK/LowLevel/Base/Scrollbar.chs" #-}

resizeScrollbarBase :: Ref ScrollbarBase -> Rectangle -> IO ()
resizeScrollbarBase scrolled rectangle =
    let (x_pos, y_pos, width, height) = fromRectangle rectangle
    in withRef scrolled $ \scrolledPtr -> resizeSuper' scrolledPtr 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 102 "src/Graphics/UI/FLTK/LowLevel/Base/Scrollbar.chs" #-}

hideScrollbarBase ::  Ref ScrollbarBase -> IO ()
hideScrollbarBase scrolled = withRef scrolled $ \scrolledPtr -> hideSuper' scrolledPtr
showSuper' :: (Ptr ()) -> IO ((()))
showSuper' a1 =
  let {a1' = id a1} in 
  showSuper''_ a1' >>= \res ->
  let {res' = supressWarningAboutRes res} in
  return (res')

{-# LINE 105 "src/Graphics/UI/FLTK/LowLevel/Base/Scrollbar.chs" #-}

showWidgetScrollbarBase ::  Ref ScrollbarBase -> IO ()
showWidgetScrollbarBase scrolled = withRef scrolled $ \scrolledPtr -> showSuper' scrolledPtr

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

{-# LINE 109 "src/Graphics/UI/FLTK/LowLevel/Base/Scrollbar.chs" #-}

instance (impl ~ (  IO ())) => Op (Draw ()) ScrollbarBase orig impl where
  runOp _ _ scrollbar = withRef scrollbar $ \scrollbarPtr -> draw'' scrollbarPtr
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 112 "src/Graphics/UI/FLTK/LowLevel/Base/Scrollbar.chs" #-}

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

{-# LINE 117 "src/Graphics/UI/FLTK/LowLevel/Base/Scrollbar.chs" #-}

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

{-# LINE 120 "src/Graphics/UI/FLTK/LowLevel/Base/Scrollbar.chs" #-}

instance (impl ~ (  IO ())) => Op (ShowWidget ()) ScrollbarBase orig impl where
  runOp _ _ scrollbar = withRef scrollbar $ \scrollbarPtr -> show' scrollbarPtr


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

-- $functions
-- @
-- destroy :: 'Ref' 'ScrollbarBase' -> 'IO' ()
--
-- draw :: 'Ref' 'ScrollbarBase' -> 'IO' ()
--
-- getLinesize :: 'Ref' 'ScrollbarBase' -> 'IO' 'LineSize'
--
-- getType_ :: 'Ref' 'ScrollbarBase' -> 'IO' ('ScrollbarType')
--
-- hide :: 'Ref' 'ScrollbarBase' -> 'IO' ()
--
-- resize :: 'Ref' 'ScrollbarBase' -> 'Rectangle' -> 'IO' ()
--
-- scrollvalue :: 'Ref' 'ScrollbarBase' -> 'Y' -> 'Lines' -> 'LineNumber' -> 'Lines' -> 'IO' ('Int')
--
-- setLinesize :: 'Ref' 'ScrollbarBase' -> 'LineSize' -> 'IO' ()
--
-- setType :: 'Ref' 'ScrollbarBase' -> 'ScrollbarType' -> 'IO' ()
--
-- showWidget :: 'Ref' 'ScrollbarBase' -> 'IO' ()
-- @

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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