-- 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/FileInput.chs" #-}
{-# LANGUAGE CPP, TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses, FlexibleContexts #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Graphics.UI.FLTK.LowLevel.Base.FileInput
    (
     fileInputNew,
     fileInputCustom
   , drawFileInputBase
   , handleFileInputBase
   , resizeFileInputBase
   , hideFileInputBase
   , showWidgetFileInputBase
     -- * 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''_ CInt
a1' CInt
a2' CInt
a3' CInt
a4' CString
a5' Ptr ()
a6' IO (Ptr ()) -> (Ptr () -> IO (Ptr ())) -> IO (Ptr ())
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \res ->
  let {res' = id :: forall a. a -> a
id Ptr ()
res} in
  Ptr () -> IO (Ptr ())
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr ()
res')

{-# LINE 33 "src/Graphics/UI/FLTK/LowLevel/Base/FileInput.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 34 "src/Graphics/UI/FLTK/LowLevel/Base/FileInput.chs" #-}

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


fileInputNew' :: (Int) -> (Int) -> (Int) -> (Int) -> IO ((Ptr ()))
fileInputNew' :: Int -> Int -> Int -> Int -> IO (Ptr ())
fileInputNew' 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 ())
fileInputNew''_ 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 51 "src/Graphics/UI/FLTK/LowLevel/Base/FileInput.chs" #-}

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

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

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

downBox' :: (Ptr ()) -> IO ((Boxtype))
downBox' :: Ptr () -> IO Boxtype
downBox' a1 :: Ptr ()
a1 =
  let {a1' = id a1} in 
  Ptr () -> IO CInt
downBox''_ Ptr ()
a1' IO CInt -> (CInt -> IO Boxtype) -> IO Boxtype
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \res :: CInt
res ->
  let {res' :: Boxtype
res' = CInt -> Boxtype
forall b a. (Integral b, Enum a) => b -> a
cToEnum CInt
res} in
  Boxtype -> IO Boxtype
forall (m :: * -> *) a. Monad m => a -> m a
return (Boxtype
res')

{-# LINE 63 "src/Graphics/UI/FLTK/LowLevel/Base/FileInput.chs" #-}

instance (impl ~ ( IO (Boxtype))) => Op (GetDownBox ()) FileInputBase orig impl where
  runOp _ _ fileInput = withRef fileInput $ \fileInputPtr -> downBox' fileInputPtr
setDownBox' :: (Ptr ()) -> (Boxtype) -> IO ()
setDownBox' a1 a2 =
  let {a1' = id a1} in 
  let {a2' = cFromEnum a2} in 
  setDownBox''_ a1' a2' >>
  return ()

{-# LINE 66 "src/Graphics/UI/FLTK/LowLevel/Base/FileInput.chs" #-}

instance (impl ~ (Boxtype ->  IO ())) => Op (SetDownBox ()) FileInputBase orig impl where
  runOp _ _ fileInput b = withRef fileInput $ \fileInputPtr -> setDownBox' fileInputPtr b
errorColor' :: (Ptr ()) -> IO ((Color))
errorColor' a1 =
  let {a1' = id a1} in 
  errorColor''_ a1' >>= \res ->
  let {res' = cToColor res} in
  return (res')

{-# LINE 69 "src/Graphics/UI/FLTK/LowLevel/Base/FileInput.chs" #-}

instance (impl ~ ( IO (Color))) => Op (GetErrorColor ()) FileInputBase orig impl where
  runOp _ _ fileInput = withRef fileInput $ \fileInputPtr -> errorColor' fileInputPtr
setErrorColor' :: (Ptr ()) -> (Color) -> IO ()
setErrorColor' a1 a2 =
  let {a1' = id a1} in 
  let {a2' = cFromColor a2} in 
  setErrorColor''_ a1' a2' >>
  return ()

{-# LINE 72 "src/Graphics/UI/FLTK/LowLevel/Base/FileInput.chs" #-}

instance (impl ~ (Color ->  IO ())) => Op (SetErrorColor ()) FileInputBase orig impl where
  runOp _ _ fileInput b = withRef fileInput $ \fileInputPtr -> setErrorColor' fileInputPtr b
setValue' :: (Ptr ()) -> (CString) -> IO ()
setValue' a1 a2 =
  let {a1' = id a1} in 
  (flip ($)) a2 $ \a2' -> 
  setValue''_ a1' a2' >>
  return ()

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

instance (impl ~ (T.Text -> IO ())) => Op (SetValue ()) FileInputBase orig impl where
  runOp _ _ fileInput s = withRef fileInput $ \fileInputPtr -> copyTextToCString s >>= setValue' fileInputPtr
getValue' :: (Ptr ()) -> IO ((CString))
getValue' a1 =
  let {a1' = id a1} in 
  getValue''_ a1' >>= \res ->
  return res >>= \res' ->
  return (res')

{-# LINE 78 "src/Graphics/UI/FLTK/LowLevel/Base/FileInput.chs" #-}

instance (impl ~ (IO T.Text)) => Op (GetValue ()) FileInputBase orig impl where
  runOp _ _ fileInput = withRef fileInput $ \fileInputPtr -> getValue' fileInputPtr >>= cStringToText

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

{-# LINE 82 "src/Graphics/UI/FLTK/LowLevel/Base/FileInput.chs" #-}

drawFileInputBase ::  Ref FileInputBase -> IO ()
drawFileInputBase fileInput = withRef fileInput $ \fileInputPtr -> drawSuper' fileInputPtr
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 85 "src/Graphics/UI/FLTK/LowLevel/Base/FileInput.chs" #-}

handleFileInputBase :: Ref FileInputBase -> Event ->  IO (Either UnknownEvent ())
handleFileInputBase fileInput event = withRef fileInput $ \fileInputPtr -> handleSuper' fileInputPtr (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 88 "src/Graphics/UI/FLTK/LowLevel/Base/FileInput.chs" #-}

resizeFileInputBase :: Ref FileInputBase -> Rectangle -> IO ()
resizeFileInputBase fileInput rectangle =
    let (x_pos, y_pos, width, height) = fromRectangle rectangle
    in withRef fileInput $ \fileInputPtr -> resizeSuper' fileInputPtr 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 93 "src/Graphics/UI/FLTK/LowLevel/Base/FileInput.chs" #-}

hideFileInputBase ::  Ref FileInputBase -> IO ()
hideFileInputBase fileInput = withRef fileInput $ \fileInputPtr -> hideSuper' fileInputPtr
showSuper' :: (Ptr ()) -> IO ((()))
showSuper' a1 =
  let {a1' = id a1} in 
  showSuper''_ a1' >>= \res ->
  let {res' = supressWarningAboutRes res} in
  return (res')

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

showWidgetFileInputBase ::  Ref FileInputBase -> IO ()
showWidgetFileInputBase fileInput = withRef fileInput $ \fileInputPtr -> showSuper' fileInputPtr

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

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

instance (impl ~ (  IO ())) => Op (Draw ()) FileInputBase orig impl where
  runOp _ _ fileInput = withRef fileInput $ \fileInputPtr -> draw'' fileInputPtr
fileInputHandle' :: (Ptr ()) -> (CInt) -> IO ((Int))
fileInputHandle' a1 a2 =
  let {a1' = id a1} in 
  let {a2' = id a2} in 
  fileInputHandle''_ a1' a2' >>= \res ->
  let {res' = fromIntegral res} in
  return (res')

{-# LINE 103 "src/Graphics/UI/FLTK/LowLevel/Base/FileInput.chs" #-}

instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) FileInputBase orig impl where
  runOp _ _ fileInput event = withRef fileInput (\p -> fileInputHandle' p (fromIntegral . fromEnum $ event)) >>= return  . successOrUnknownEvent
hide' :: (Ptr ()) -> IO ()
hide' a1 =
  let {a1' = id a1} in 
  hide''_ a1' >>
  return ()

{-# LINE 106 "src/Graphics/UI/FLTK/LowLevel/Base/FileInput.chs" #-}

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

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

instance (impl ~ (  IO ())) => Op (ShowWidget ()) FileInputBase orig impl where
  runOp _ _ fileInput = withRef fileInput $ \fileInputPtr -> show' fileInputPtr
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/FileInput.chs" #-}

instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) FileInputBase orig impl where
  runOp _ _ fileInput rectangle = withRef fileInput $ \fileInputPtr -> do
                                 let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle
                                 resize' fileInputPtr x_pos y_pos w_pos h_pos

-- $hierarchy
-- @
-- "Graphics.UI.FLTK.LowLevel.Base.Widget"
--  |
--  v
-- "Graphics.UI.FLTK.LowLevel.Base.Input"
--  |
--  v
-- "Graphics.UI.FLTK.LowLevel.Base.FileInput"
-- @

-- $functions
-- @
-- draw :: 'Ref' 'FileInputBase' -> 'IO' ()
--
-- getDownBox :: 'Ref' 'FileInputBase' -> 'IO' ('Boxtype')
--
-- getErrorColor :: 'Ref' 'FileInputBase' -> 'IO' ('Color')
--
-- getValue :: 'Ref' 'FileInputBase' -> 'IO' 'T.Text'
--
-- handle :: 'Ref' 'FileInputBase' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ())
--
-- hide :: 'Ref' 'FileInputBase' -> 'IO' ()
--
-- resize :: 'Ref' 'FileInputBase' -> 'Rectangle' -> 'IO' ()
--
-- setDownBox :: 'Ref' 'FileInputBase' -> 'Boxtype' -> 'IO' ()
--
-- setErrorColor :: 'Ref' 'FileInputBase' -> 'Color' -> 'IO' ()
--
-- setValue :: 'Ref' 'FileInputBase' -> 'T.Text' -> 'IO' ()
--
-- showWidget :: 'Ref' 'FileInputBase' -> 'IO' ()
-- @

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

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

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

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

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

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/FileInput.chs.h Fl_File_Input_errorcolor"
  errorColor''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CUInt))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/FileInput.chs.h Fl_File_Input_set_errorcolor"
  setErrorColor''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CUInt -> (IO ())))

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

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/FileInput.chs.h Fl_File_Input_value"
  getValue''_ :: ((C2HSImp.Ptr ()) -> (IO (C2HSImp.Ptr C2HSImp.CChar)))

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

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

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

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

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

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

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

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

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

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