-- 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/Scrolled.chs" #-}
{-# LANGUAGE CPP, ExistentialQuantification, TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses, FlexibleContexts, ScopedTypeVariables #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Graphics.UI.FLTK.LowLevel.Scrolled
    (
     -- * Constructor
     scrolledNew,
     -- * 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 Foreign.C.Types
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

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

{-# LINE 28 "src/Graphics/UI/FLTK/LowLevel/Scrolled.chs" #-}

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

{-# LINE 29 "src/Graphics/UI/FLTK/LowLevel/Scrolled.chs" #-}

scrolledNew :: Rectangle -> Maybe T.Text -> IO (Ref Scrolled)
scrolledNew rectangle l'=
    let (x_pos, y_pos, width, height) = fromRectangle rectangle
    in case l' of
        Nothing -> scrollNew' x_pos y_pos width height >>=
                             toRef
        Just l -> scrollNewWithLabel' x_pos y_pos width height l >>=
                               toRef
setScrollbarSize' :: (Ptr ()) -> (Int) -> IO ()
setScrollbarSize' a1 a2 =
  let {a1' = id a1} in 
  let {a2' = fromIntegral a2} in 
  setScrollbarSize''_ a1' a2' >>
  return ()

{-# LINE 38 "src/Graphics/UI/FLTK/LowLevel/Scrolled.chs" #-}

instance (impl ~ (Int ->  IO ())) => Op (SetScrollbarSize ()) Scrolled orig impl where
   runOp _ _ widget size = withRef widget $ \widgetPtr -> setScrollbarSize' widgetPtr size
getScrollbarSize' :: (Ptr ()) -> IO ((Int))
getScrollbarSize' a1 =
  let {a1' = id a1} in 
  getScrollbarSize''_ a1' >>= \res ->
  let {res' = fromIntegral res} in
  return (res')

{-# LINE 41 "src/Graphics/UI/FLTK/LowLevel/Scrolled.chs" #-}

instance (impl ~ ( IO (Int))) => Op (GetScrollbarSize ()) Scrolled orig impl where
   runOp _ _ widget = withRef widget $ \widgetPtr -> getScrollbarSize' widgetPtr
clear' :: (Ptr ()) -> IO ()
clear' a1 =
  let {a1' = id a1} in 
  clear''_ a1' >>
  return ()

{-# LINE 44 "src/Graphics/UI/FLTK/LowLevel/Scrolled.chs" #-}

instance (impl ~ ( IO ())) => Op (Clear ()) Scrolled orig impl where
   runOp _ _ widget = withRef widget $ \widgetPtr -> clear' widgetPtr
scrollTo' :: (Ptr ()) -> (Int) -> (Int) -> IO ()
scrollTo' a1 a2 a3 =
  let {a1' = id a1} in 
  let {a2' = fromIntegral a2} in 
  let {a3' = fromIntegral a3} in 
  scrollTo''_ a1' a2' a3' >>
  return ()

{-# LINE 47 "src/Graphics/UI/FLTK/LowLevel/Scrolled.chs" #-}

instance (impl ~ (Position ->  IO ())) => Op (ScrollTo ()) Scrolled orig impl where
   runOp _ _ widget (Position (X x_pos') (Y y_pos')) = withRef widget $ \widgetPtr -> scrollTo' widgetPtr x_pos' y_pos'
yposition' :: (Ptr ()) -> IO ((Int))
yposition' a1 =
  let {a1' = id a1} in 
  yposition''_ a1' >>= \res ->
  let {res' = fromIntegral res} in
  return (res')

{-# LINE 50 "src/Graphics/UI/FLTK/LowLevel/Scrolled.chs" #-}

instance (impl ~ ( IO (Int))) => Op (Yposition ()) Scrolled orig impl where
   runOp _ _ widget = withRef widget $ \widgetPtr -> yposition' widgetPtr
xposition' :: (Ptr ()) -> IO ((Int))
xposition' a1 =
  let {a1' = id a1} in 
  xposition''_ a1' >>= \res ->
  let {res' = fromIntegral res} in
  return (res')

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

instance (impl ~ ( IO (Int))) => Op (Xposition ()) Scrolled orig impl where
   runOp _ _ widget = withRef widget $ \widgetPtr -> xposition' widgetPtr
type' :: (Ptr ()) -> IO ((Word8))
type' a1 =
  let {a1' = id a1} in 
  type''_ a1' >>= \res ->
  let {res' = fromIntegral res} in
  return (res')

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

instance (impl ~ ( IO (ScrollbarMode))) => Op (GetType_ ()) Scrolled orig impl where
   runOp _ _ widget = withRef widget $ \widgetPtr -> type' widgetPtr >>= return . cToEnum
setType' :: (Ptr ()) -> (Word8) -> IO ()
setType' a1 a2 =
  let {a1' = id a1} in 
  let {a2' = fromIntegral a2} in 
  setType''_ a1' a2' >>
  return ()

{-# LINE 59 "src/Graphics/UI/FLTK/LowLevel/Scrolled.chs" #-}

instance (impl ~ (ScrollbarMode ->  IO ())) => Op (SetType ()) Scrolled orig impl where
   runOp _ _ widget t = withRef widget $ \widgetPtr -> setType' widgetPtr (cFromEnum t)
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' >>
  return ()

{-# LINE 62 "src/Graphics/UI/FLTK/LowLevel/Scrolled.chs" #-}

instance (impl ~ (Rectangle ->  IO ())) => Op (Resize ()) Scrolled orig impl where
   runOp _ _ widget rectangle = let (x_pos', y_pos', width', height') = fromRectangle rectangle in withRef widget $ \scrollPtr -> resize' scrollPtr x_pos' y_pos' width' height'
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 65 "src/Graphics/UI/FLTK/LowLevel/Scrolled.chs" #-}

instance (impl ~ (Event ->  IO(Either UnknownEvent ()))) => Op (Handle ()) Scrolled orig impl where
   runOp _ _ widget event = withRef widget $ \scrollPtr -> handle' scrollPtr (fromIntegral (fromEnum event)) >>= return  . successOrUnknownEvent

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


-- $functions
-- @
-- clear :: 'Ref' 'Scrolled' -> 'IO' ()
--
-- getScrollbarSize :: 'Ref' 'Scrolled' -> 'IO' 'Int'
--
-- getType :: 'Ref' 'Scrolled' -> 'IO' 'ScrollbarMode'
--
-- handle :: 'Ref' 'Scrolled' -> 'Int' -> 'IO' 'Int'
--
-- resize :: 'Ref' 'Scrolled' -> 'Rectangle' -> 'IO' ()
--
-- scrollTo :: 'Ref' 'Scrolled' -> 'Position' -> 'IO' ()
--
-- setScrollbarSize :: 'Ref' 'Scrolled' -> 'Int' -> 'IO' ()
--
-- setType :: 'Ref' 'Scrolled' -> 'ScrollbarMode' -> 'IO' ()
--
-- xposition :: 'Ref' 'Scrolled' -> 'IO' 'Int'
--
-- yposition :: 'Ref' 'Scrolled' -> 'IO' 'Int'
-- @

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

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

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

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

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Scrolled.chs.h Fl_Scroll_clear"
  clear''_ :: ((C2HSImp.Ptr ()) -> (IO ()))

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

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

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

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

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

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

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