-- 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/Pack.chs" #-}
{-# LANGUAGE CPP, TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses, FlexibleContexts #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Graphics.UI.FLTK.LowLevel.Pack
  (
    PackType(..),
    packNew,
    packCustom
    -- * 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_Enumerations
import Graphics.UI.FLTK.LowLevel.Widget
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
overriddenWidgetNewWithLabel' :: (Int) -> (Int) -> (Int) -> (Int) -> (T.Text) -> (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 
  let {a5' = unsafeToCString a5} in 
  let {a6' = id a6} in 
  overriddenWidgetNewWithLabel''_ a1' a2' a3' a4' a5' a6' >>= \res ->
  let {res' = id res} in
  return (res')

{-# LINE 28 "src/Graphics/UI/FLTK/LowLevel/Pack.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 29 "src/Graphics/UI/FLTK/LowLevel/Pack.chs" #-}

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

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

{-# LINE 45 "src/Graphics/UI/FLTK/LowLevel/Pack.chs" #-}

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

{-# LINE 46 "src/Graphics/UI/FLTK/LowLevel/Pack.chs" #-}

packNew :: Rectangle -> Maybe T.Text -> IO (Ref Pack)
packNew rectangle l' =
    let (x_pos, y_pos, width, height) = fromRectangle rectangle
    in case l' of
        Nothing -> packNew' x_pos y_pos width height >>=
                             toRef
        Just l -> packNewWithLabel' x_pos y_pos width height l >>=
                             toRef

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

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

instance (impl ~ (IO (Int))) => Op (GetSpacing ()) Pack orig impl where
   runOp _ _ p = withRef p $ \pPtr -> getSpacing' pPtr
setSpacing' :: (Ptr ()) -> (Int) -> IO ()
setSpacing' a1 a2 =
  let {a1' = id a1} in 
  let {a2' = fromIntegral a2} in 
  setSpacing''_ a1' a2' >>
  return ()

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

instance (impl ~ (Int ->  IO ())) => Op (SetSpacing ()) Pack orig impl where
   runOp _ _ p pixels = withRef p $ \pPtr -> setSpacing' pPtr pixels
horizontal' :: (Ptr ()) -> IO ((Word8))
horizontal' a1 =
  let {a1' = id a1} in 
  horizontal''_ a1' >>= \res ->
  let {res' = fromIntegral res} in
  return (res')

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

instance (impl ~ ( IO Bool)) => Op (IsHorizontal ()) Pack orig impl where
   runOp _ _ p = withRef p $ \pPtr -> do
     orientation <- horizontal' pPtr >>= return . cToEnum
     case orientation of
       PackHorizontal -> return True
       _  -> return False
type' :: (Ptr ()) -> IO ((Word8))
type' a1 =
  let {a1' = id a1} in 
  type''_ a1' >>= \res ->
  let {res' = fromIntegral res} in
  return (res')

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

instance (impl ~ ( IO (PackType))) => Op (GetType_ ()) Pack 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 72 "src/Graphics/UI/FLTK/LowLevel/Pack.chs" #-}

instance (impl ~ (PackType ->  IO ())) => Op (SetType ()) Pack orig impl where
   runOp _ _ widget t = withRef widget $ \widgetPtr -> setType' widgetPtr (cFromEnum t)
draw'' :: (Ptr ()) -> IO ()
draw'' a1 =
  let {a1' = id a1} in 
  draw'''_ a1' >>
  return ()

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

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

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

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

{-# LINE 81 "src/Graphics/UI/FLTK/LowLevel/Pack.chs" #-}

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

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

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

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

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

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

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

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

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

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

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

instance (impl ~ ( IO ())) => Op (ShowWidgetSuper ()) Pack orig impl where
  runOp _ _ pack = withRef pack $ \packPtr -> showSuper' packPtr
-- $hierarchy
-- @
-- "Graphics.UI.FLTK.LowLevel.Widget"
--  |
--  v
-- "Graphics.UI.FLTK.LowLevel.Group"
--  |
--  v
-- "Graphics.UI.FLTK.LowLevel.Pack"
-- @

-- $functions
-- @
-- draw :: 'Ref' 'Pack' -> 'IO' ()
--
-- drawSuper :: 'Ref' 'Pack' -> 'IO' ()
--
-- getSpacing :: 'Ref' 'Pack' -> 'IO' ('Int')
--
-- getType_ :: 'Ref' 'Pack' -> 'IO' ('PackType')
--
-- handle :: 'Ref' 'Pack' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ())
--
-- handleSuper :: 'Ref' 'Pack' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ())
--
-- hide :: 'Ref' 'Pack' -> 'IO' ()
--
-- hideSuper :: 'Ref' 'Pack' -> 'IO' ()
--
-- isHorizontal :: 'Ref' 'Pack' -> 'IO' 'Bool'
--
-- resize :: 'Ref' 'Pack' -> 'Rectangle' -> 'IO' ()
--
-- resizeSuper :: 'Ref' 'Pack' -> 'Rectangle' -> 'IO' ()
--
-- setSpacing :: 'Ref' 'Pack' -> 'Int' -> 'IO' ()
--
-- setType :: 'Ref' 'Pack' -> 'PackType' -> 'IO' ()
--
-- showWidget :: 'Ref' 'Pack' -> 'IO' ()
--
-- showWidgetSuper :: 'Ref' 'Pack' -> 'IO' ()
-- @

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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