-- 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/Tabs.chs" #-}
{-# LANGUAGE CPP, TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses, FlexibleContexts, UndecidableInstances #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Graphics.UI.FLTK.LowLevel.Tabs
    (
     tabsNew,
     tabsCustom,
     TabsHeightOffset(..)
     -- * 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.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.Dispatch
import qualified Data.Text as T
import Graphics.UI.FLTK.LowLevel.Hierarchy

data TabsHeightOffset = TabsAtTop (Maybe Int) | TabsAtBottom (Maybe Int)

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 32 "src/Graphics/UI/FLTK/LowLevel/Tabs.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 33 "src/Graphics/UI/FLTK/LowLevel/Tabs.chs" #-}

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


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

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

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

{-# LINE 51 "src/Graphics/UI/FLTK/LowLevel/Tabs.chs" #-}

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

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

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

instance (impl ~ (IO (Maybe (Ref Widget)))) => Op (GetValue ()) Tabs orig impl where
   runOp _ _ tabs = withRef tabs $ \tabsPtr -> value' tabsPtr >>= toMaybeRef

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

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

instance (Parent a Widget, impl ~ (Maybe ( Ref a ) ->  IO (Either NoChange ()))) => Op (SetValue ()) Tabs orig impl where
   runOp _ _ tabs w = withRef tabs $ \tabsPtr -> withMaybeRef w $ \wPtr -> setValue' tabsPtr wPtr >>= return . successOrNoChange

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

{-# LINE 67 "src/Graphics/UI/FLTK/LowLevel/Tabs.chs" #-}

instance (impl ~ (IO (Maybe (Ref Widget)))) => Op (GetPush ()) Tabs orig impl where
   runOp _ _ tabs = withRef tabs $ \tabsPtr -> push' tabsPtr >>= toMaybeRef

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

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

instance (Parent a Widget, impl ~ (Maybe ( Ref a ) ->  IO (Either NoChange ()))) => Op (SetPush ()) Tabs orig impl where
   runOp _ _ tabs w = withRef tabs $ \tabsPtr -> withMaybeRef w $ \wPtr -> setPush' tabsPtr wPtr >>= return . successOrNoChange

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

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

instance (impl ~ (Position -> IO (Maybe (Ref Widget)))) => Op (Which ()) Tabs orig impl where
   runOp _ _ tabs (Position (X event_x) (Y event_y)) = withRef tabs $ \tabsPtr -> which' tabsPtr event_x event_y >>= toMaybeRef

clientAreaWithTabh' :: (Ptr ()) -> (Int) -> IO ((Int), (Int), (Int), (Int))
clientAreaWithTabh' a1 a6 =
  let {a1' = id a1} in 
  alloca $ \a2' -> 
  alloca $ \a3' -> 
  alloca $ \a4' -> 
  alloca $ \a5' -> 
  let {a6' = fromIntegral a6} in 
  clientAreaWithTabh''_ a1' a2' a3' a4' a5' a6' >>
  peekIntConv  a2'>>= \a2'' -> 
  peekIntConv  a3'>>= \a3'' -> 
  peekIntConv  a4'>>= \a4'' -> 
  peekIntConv  a5'>>= \a5'' -> 
  return (a2'', a3'', a4'', a5'')

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

instance (impl ~ (TabsHeightOffset -> IO Rectangle)) => Op (ClientArea ()) Tabs orig impl where
   runOp _ _ tabs tabh =
     withRef tabs $ \tabsPtr ->
     case tabh of
       TabsAtTop Nothing -> clientAreaWithTabh' tabsPtr 0 >>= return . toRectangle
       TabsAtTop (Just o) -> clientAreaWithTabh' tabsPtr o >>= return . toRectangle
       TabsAtBottom Nothing -> clientAreaWithTabh' tabsPtr (-1) >>= return . toRectangle
       TabsAtBottom (Just o) -> clientAreaWithTabh' tabsPtr (0 - o) >>= return . toRectangle

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

{-# LINE 89 "src/Graphics/UI/FLTK/LowLevel/Tabs.chs" #-}

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

{-# LINE 92 "src/Graphics/UI/FLTK/LowLevel/Tabs.chs" #-}

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

{-# LINE 95 "src/Graphics/UI/FLTK/LowLevel/Tabs.chs" #-}

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

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

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

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

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

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

{-# LINE 114 "src/Graphics/UI/FLTK/LowLevel/Tabs.chs" #-}

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

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

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

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

instance (impl ~ ( IO ())) => Op (ShowWidgetSuper ()) Tabs orig impl where
  runOp _ _ tabs = withRef tabs $ \tabsPtr -> showSuper' tabsPtr

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

-- $functions
-- @
-- clientArea :: 'Ref' 'Tabs' -> 'TabsHeightOffset' -> 'IO' 'Rectangle'
--
-- getPush :: 'Ref' 'Tabs' -> 'IO' ('Maybe' ('Ref' 'Widget'))
--
-- getValue :: 'Ref' 'Tabs' -> 'IO' ('Maybe' ('Ref' 'Widget'))
--
-- handle :: 'Ref' 'Tabs' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ()))
--
-- setPush:: ('Parent' a 'Widget') => 'Ref' 'Tabs' -> 'Maybe' ( 'Ref' a ) -> 'IO' ('Either' 'NoChange' ())
--
-- setValue:: ('Parent' a 'Widget') => 'Ref' 'Tabs' -> 'Maybe' ( 'Ref' a ) -> 'IO' ('Either' 'NoChange' ())
--
-- which :: 'Ref' 'Tabs' -> 'Position' -> 'IO' ('Maybe' ('Ref' 'Widget'))
-- @

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

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

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

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Tabs.chs.h Fl_Tabs_value"
  value''_ :: ((C2HSImp.Ptr ()) -> (IO (C2HSImp.Ptr ())))

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

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Tabs.chs.h Fl_Tabs_push"
  push''_ :: ((C2HSImp.Ptr ()) -> (IO (C2HSImp.Ptr ())))

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

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

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

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

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

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

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

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

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

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

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

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

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