-- 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/Tabs.chs" #-}
{-# LANGUAGE OverloadedStrings, CPP, TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses, FlexibleContexts, UndecidableInstances #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Graphics.UI.FLTK.LowLevel.Base.Tabs
    (
     tabsNew,
     tabsCustom,
     TabsHeightOffset(..),
     CustomTabFuncs(..)
  , drawTabsBase
  , handleTabsBase
  , resizeTabsBase
  , hideTabsBase
  , showWidgetTabsBase
     -- * Hierarchy
     --
     -- $hierarchy

     -- * Functions
     --
     -- $functions
    )
where
import qualified Foreign.C.Types as C2HSImp
import qualified Foreign.Ptr as C2HSImp
import qualified Foreign.Storable 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.Dispatch
import qualified Data.Text as T
import Graphics.UI.FLTK.LowLevel.Hierarchy

data TabsHeightOffset = TabsAtTop (Maybe Int) | TabsAtBottom (Maybe Int)
tabsHeightOffsetToInt :: TabsHeightOffset -> Int
tabsHeightOffsetToInt :: TabsHeightOffset -> Int
tabsHeightOffsetToInt h :: TabsHeightOffset
h =
  case TabsHeightOffset
h of
    TabsAtTop Nothing -> 0
    TabsAtTop (Just o :: Int
o) -> Int
o
    TabsAtBottom Nothing -> (-1)
    TabsAtBottom (Just o :: Int
o) -> (-Int
o)

intToTabsHeightOffset :: Int -> TabsHeightOffset
intToTabsHeightOffset :: Int -> TabsHeightOffset
intToTabsHeightOffset tabh :: Int
tabh =
  case Int
tabh of
    _ | Int
tabh Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== 0 -> Maybe Int -> TabsHeightOffset
TabsAtTop Maybe Int
forall a. Maybe a
Nothing
      | Int
tabh Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== (-1) -> Maybe Int -> TabsHeightOffset
TabsAtBottom Maybe Int
forall a. Maybe a
Nothing
      | Int
tabh Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> 0 -> Maybe Int -> TabsHeightOffset
TabsAtTop (Int -> Maybe Int
forall a. a -> Maybe a
Just (Int -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
tabh))
      | Bool
otherwise -> Maybe Int -> TabsHeightOffset
TabsAtBottom (Int -> Maybe Int
forall a. a -> Maybe a
Just (Int -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
tabh))

data CustomTabFuncs a =
  CustomTabFuncs
  {
    CustomTabFuncs a -> Ref a -> IO ()
tabDrawCustom :: Ref a -> IO ()
  , CustomTabFuncs a -> Ref a -> IO (Maybe AtIndex, Int, [(X, Width)])
tabPositionsCustom :: Ref a -> IO (Maybe AtIndex, Int, [(X,Width)])
  , CustomTabFuncs a -> Ref a -> IO Height
tabHeightCustom :: Ref a -> IO Height
  , CustomTabFuncs a
-> Ref a -> Position -> IO (Maybe (AtIndex, Ref WidgetBase))
tabWhichCustom :: Ref a -> Position -> IO (Maybe (AtIndex, Ref WidgetBase))
  , CustomTabFuncs a -> Ref a -> IO ()
tabRedrawTabs :: Ref a -> IO ()
  , CustomTabFuncs a -> Ref a -> TabsHeightOffset -> IO Rectangle
tabClientArea :: Ref a -> TabsHeightOffset -> IO Rectangle
  }

toTabClientAreaPrim :: (Ref a -> TabsHeightOffset -> IO Rectangle) -> IO (FunPtr TabClientAreaPrim)
toTabClientAreaPrim :: (Ref a -> TabsHeightOffset -> IO Rectangle)
-> IO (FunPtr TabClientAreaPrim)
toTabClientAreaPrim f :: Ref a -> TabsHeightOffset -> IO Rectangle
f =
  TabClientAreaPrim -> IO (FunPtr TabClientAreaPrim)
mkTabClientAreaPrim (\tabPtr :: Ptr ()
tabPtr xPtr :: Ptr CInt
xPtr yPtr :: Ptr CInt
yPtr wPtr :: Ptr CInt
wPtr hPtr :: Ptr CInt
hPtr tabh :: CInt
tabh -> do
                          ForeignPtr (Ptr ())
pp <- Ptr () -> String -> IO (ForeignPtr (Ptr ()))
forall a.
HasCallStack =>
Ptr a -> String -> IO (ForeignPtr (Ptr a))
wrapNonNull Ptr ()
tabPtr "Null pointer. toTabClientAreaPrim"
                          Rectangle
rect <- Ref a -> TabsHeightOffset -> IO Rectangle
f (Ref Any -> Ref a
forall a r. Ref a -> Ref r
castTo (ForeignPtr (Ptr ()) -> Ref Any
forall a. ForeignPtr (Ptr ()) -> Ref a
wrapInRef ForeignPtr (Ptr ())
pp)) (Int -> TabsHeightOffset
intToTabsHeightOffset (CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
tabh))
                          let (clientX :: Int
clientX, clientY :: Int
clientY, clientW :: Int
clientW, clientH :: Int
clientH) = Rectangle -> (Int, Int, Int, Int)
fromRectangle Rectangle
rect
                          Ptr CInt -> CInt -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr CInt
xPtr (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
clientX)
                          Ptr CInt -> CInt -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr CInt
yPtr (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
clientY)
                          Ptr CInt -> CInt -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr CInt
wPtr (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
clientW)
                          Ptr CInt -> CInt -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr CInt
hPtr (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
clientH))

virtualFuncs' :: IO ((Ptr ()))
virtualFuncs' :: IO (Ptr ())
virtualFuncs' =
  IO (Ptr ())
virtualFuncs''_ 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 75 "src/Graphics/UI/FLTK/LowLevel/Base/Tabs.chs" #-}


toTabWhichPrim ::
  (Ref a -> Position -> IO (Maybe (AtIndex, Ref WidgetBase))) ->
  IO (FunPtr TabWhichPrim)
toTabWhichPrim f =
  mkTabWhichPrim (\ptr event_x event_y -> do
                     pp <- wrapNonNull ptr "Null pointer. toTabWhichPrim"
                     res <- f (castTo (wrapInRef pp)) (Position (X (fromIntegral event_x)) (Y (fromIntegral event_y)))
                     maybe (return nullPtr) (\(_,ref) -> unsafeRefToPtr ref) res
                  )

customTabFunctionStruct ::
  (Parent a TabsBase) =>
  (Ref a -> IO ()) ->
  (Ref a -> IO (Maybe AtIndex, Int, [(X,Width)])) ->
  (Ref a -> IO Height) ->
  (Ref a -> Position -> IO (Maybe (AtIndex, Ref WidgetBase))) ->
  (Ref a -> IO ()) ->
  (Ref a -> TabsHeightOffset -> IO Rectangle) ->
  IO (Ptr())
customTabFunctionStruct :: (Ref a -> IO ())
-> (Ref a -> IO (Maybe AtIndex, Int, [(X, Width)]))
-> (Ref a -> IO Height)
-> (Ref a -> Position -> IO (Maybe (AtIndex, Ref WidgetBase)))
-> (Ref a -> IO ())
-> (Ref a -> TabsHeightOffset -> IO Rectangle)
-> IO (Ptr ())
customTabFunctionStruct tabDrawCustom' :: Ref a -> IO ()
tabDrawCustom' tabPositionsCustom' :: Ref a -> IO (Maybe AtIndex, Int, [(X, Width)])
tabPositionsCustom' tabHeightCustom' :: Ref a -> IO Height
tabHeightCustom' tabWhichCustom' :: Ref a -> Position -> IO (Maybe (AtIndex, Ref WidgetBase))
tabWhichCustom' tabRedrawTabs' :: Ref a -> IO ()
tabRedrawTabs' tabClientArea' :: Ref a -> TabsHeightOffset -> IO Rectangle
tabClientArea' =
    do
  Ptr ()
structPtr <- IO (Ptr ())
virtualFuncs'
  (Ref a -> IO ()) -> IO (FunPtr (Ptr () -> IO ()))
forall a. (Ref a -> IO ()) -> IO (FunPtr (Ptr () -> IO ()))
toCallbackPrim Ref a -> IO ()
tabDrawCustom' IO (FunPtr (Ptr () -> IO ()))
-> (FunPtr (Ptr () -> IO ()) -> IO ()) -> IO ()
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (\ptr :: Ptr ()
ptr val :: FunPtr (Ptr () -> IO ())
val -> do {Ptr () -> Int -> FunPtr (Ptr () -> IO ()) -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
C2HSImp.pokeByteOff Ptr ()
ptr 0 (FunPtr (Ptr () -> IO ())
val :: (C2HSImp.FunPtr ((C2HSImp.Ptr ()) -> (IO ()))))}) Ptr ()
structPtr
  (Ref a -> IO (Maybe AtIndex, Int, [(X, Width)]))
-> IO (FunPtr TabPositionsPrim)
forall a.
(Ref a -> IO (Maybe AtIndex, Int, [(X, Width)]))
-> IO (FunPtr TabPositionsPrim)
toTabPositionsPrim Ref a -> IO (Maybe AtIndex, Int, [(X, Width)])
tabPositionsCustom' IO (FunPtr TabPositionsPrim)
-> (FunPtr TabPositionsPrim -> IO ()) -> IO ()
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (\ptr :: Ptr ()
ptr val :: FunPtr TabPositionsPrim
val -> do {Ptr () -> Int -> FunPtr TabPositionsPrim -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
C2HSImp.pokeByteOff Ptr ()
ptr 8 (FunPtr TabPositionsPrim
val :: (C2HSImp.FunPtr ((C2HSImp.Ptr ()) -> ((C2HSImp.Ptr C2HSImp.CInt) -> ((C2HSImp.Ptr C2HSImp.CInt) -> (IO C2HSImp.CInt))))))}) Ptr ()
structPtr
  (Ref a -> IO Height) -> IO (FunPtr TabHeightPrim)
forall a. (Ref a -> IO Height) -> IO (FunPtr TabHeightPrim)
toTabHeightPrim Ref a -> IO Height
tabHeightCustom' IO (FunPtr TabHeightPrim)
-> (FunPtr TabHeightPrim -> IO ()) -> IO ()
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (\ptr :: Ptr ()
ptr val :: FunPtr TabHeightPrim
val -> do {Ptr () -> Int -> FunPtr TabHeightPrim -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
C2HSImp.pokeByteOff Ptr ()
ptr 16 (FunPtr TabHeightPrim
val :: (C2HSImp.FunPtr ((C2HSImp.Ptr ()) -> (IO C2HSImp.CInt))))}) Ptr ()
structPtr
  (Ref a -> Position -> IO (Maybe (AtIndex, Ref WidgetBase)))
-> IO (FunPtr TabWhichPrim)
forall a.
(Ref a -> Position -> IO (Maybe (AtIndex, Ref WidgetBase)))
-> IO (FunPtr TabWhichPrim)
toTabWhichPrim Ref a -> Position -> IO (Maybe (AtIndex, Ref WidgetBase))
tabWhichCustom' IO (FunPtr TabWhichPrim) -> (FunPtr TabWhichPrim -> IO ()) -> IO ()
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (\ptr :: Ptr ()
ptr val :: FunPtr TabWhichPrim
val -> do {Ptr () -> Int -> FunPtr TabWhichPrim -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
C2HSImp.pokeByteOff Ptr ()
ptr 24 (FunPtr TabWhichPrim
val :: (C2HSImp.FunPtr ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (IO (C2HSImp.Ptr ())))))))}) Ptr ()
structPtr
  (Ref a -> IO ()) -> IO (FunPtr (Ptr () -> IO ()))
forall a. (Ref a -> IO ()) -> IO (FunPtr (Ptr () -> IO ()))
toCallbackPrim Ref a -> IO ()
tabRedrawTabs' IO (FunPtr (Ptr () -> IO ()))
-> (FunPtr (Ptr () -> IO ()) -> IO ()) -> IO ()
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (\ptr :: Ptr ()
ptr val :: FunPtr (Ptr () -> IO ())
val -> do {Ptr () -> Int -> FunPtr (Ptr () -> IO ()) -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
C2HSImp.pokeByteOff Ptr ()
ptr 32 (FunPtr (Ptr () -> IO ())
val :: (C2HSImp.FunPtr ((C2HSImp.Ptr ()) -> (IO ()))))}) Ptr ()
structPtr
  (Ref a -> TabsHeightOffset -> IO Rectangle)
-> IO (FunPtr TabClientAreaPrim)
forall a.
(Ref a -> TabsHeightOffset -> IO Rectangle)
-> IO (FunPtr TabClientAreaPrim)
toTabClientAreaPrim Ref a -> TabsHeightOffset -> IO Rectangle
tabClientArea' IO (FunPtr TabClientAreaPrim)
-> (FunPtr TabClientAreaPrim -> IO ()) -> IO ()
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (\ptr :: Ptr ()
ptr val :: FunPtr TabClientAreaPrim
val -> do {Ptr () -> Int -> FunPtr TabClientAreaPrim -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
C2HSImp.pokeByteOff Ptr ()
ptr 40 (FunPtr TabClientAreaPrim
val :: (C2HSImp.FunPtr ((C2HSImp.Ptr ()) -> ((C2HSImp.Ptr C2HSImp.CInt) -> ((C2HSImp.Ptr C2HSImp.CInt) -> ((C2HSImp.Ptr C2HSImp.CInt) -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CInt -> (IO ())))))))))}) Ptr ()
structPtr
  Ptr () -> IO (Ptr ())
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr ()
structPtr

overriddenWidgetNewWithLabel' :: (Int) -> (Int) -> (Int) -> (Int) -> (CString) -> (Ptr ()) -> (Ptr ()) -> IO ((Ptr ()))
overriddenWidgetNewWithLabel' :: Int
-> Int -> Int -> Int -> CString -> Ptr () -> Ptr () -> IO (Ptr ())
overriddenWidgetNewWithLabel' a1 :: Int
a1 a2 :: Int
a2 a3 :: Int
a3 a4 :: Int
a4 a5 :: CString
a5 a6 :: Ptr ()
a6 a7 :: Ptr ()
a7 =
  let {a1' = fromIntegral a1} in 
  let {a2' = fromIntegral a2} in 
  let {a3' = fromIntegral a3} in 
  let {a4' = fromIntegral a4} in 
  (flip ($)) a5 $ \a5' :: CString
a5' -> 
  let {a6' :: Ptr ()
a6' = Ptr () -> Ptr ()
forall a. a -> a
id Ptr ()
a6} in 
  let {a7' :: Ptr ()
a7' = Ptr () -> Ptr ()
forall a. a -> a
id Ptr ()
a7} in 
  CInt
-> CInt
-> CInt
-> CInt
-> CString
-> Ptr ()
-> Ptr ()
-> IO (Ptr ())
overriddenWidgetNewWithLabel''_ CInt
a1' CInt
a2' CInt
a3' CInt
a4' CString
a5' Ptr ()
a6' Ptr ()
a7' 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 107 "src/Graphics/UI/FLTK/LowLevel/Base/Tabs.chs" #-}

tabsCustom ::
     Rectangle                      -- ^ The bounds of this Tabs
  -> Maybe T.Text                   -- ^ The Tabs label
  -> Maybe (CustomTabFuncs Tabs)    -- ^ Optional custom tab drawing functions
  -> Maybe (CustomWidgetFuncs Tabs) -- ^ Optional custom widget functions
  -> IO (Ref Tabs)
tabsCustom rectangle l' tabFuncs' widgetFuncs' =
  let (x_pos, y_pos, width, height) = fromRectangle rectangle
  in do
   tabFuncsPtr <- maybe virtualFuncs'
                   (\tfs -> customTabFunctionStruct
                              (tabDrawCustom tfs)
                              (tabPositionsCustom tfs)
                              (tabHeightCustom tfs)
                              (tabWhichCustom tfs)
                              (tabRedrawTabs tfs)
                              (tabClientArea tfs))
                   tabFuncs'
   widgetFuncsPtr <- customWidgetFunctionStruct (fmap tabDrawCustom tabFuncs') (maybe defaultCustomWidgetFuncs id widgetFuncs')
   label' <- maybe (return nullPtr) copyTextToCString l'
   overriddenWidgetNewWithLabel' x_pos y_pos width height label' tabFuncsPtr widgetFuncsPtr >>= toRef

tabsNew' :: (Int) -> (Int) -> (Int) -> (Int) -> IO ((Ptr ()))
tabsNew' :: Int -> Int -> Int -> Int -> IO (Ptr ())
tabsNew' 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 ())
tabsNew''_ 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
  return (res')

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

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

{-# LINE 131 "src/Graphics/UI/FLTK/LowLevel/Base/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 -> do
           ref <- copyTextToCString l >>= \l' -> tabsNewWithLabel' x_pos y_pos width height l' >>= toRef
           setFlag ref WidgetFlagCopiedLabel
           setFlag ref WidgetFlagCopiedTooltip
           return ref


value' :: (Ptr ()) -> IO ((Ptr ()))
value' :: Ptr () -> IO (Ptr ())
value' a1 :: Ptr ()
a1 =
  let {a1' = id a1} in 
  Ptr () -> IO (Ptr ())
value''_ Ptr ()
a1' 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 144 "src/Graphics/UI/FLTK/LowLevel/Base/Tabs.chs" #-}

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

setValue' :: (Ptr ()) -> (Ptr ()) -> IO ((Int))
setValue' :: Ptr () -> Ptr () -> IO Int
setValue' a1 :: Ptr ()
a1 a2 :: Ptr ()
a2 =
  let {a1' = id a1} in 
  let {a2' :: Ptr ()
a2' = Ptr () -> Ptr ()
forall a. a -> a
id Ptr ()
a2} in 
  Ptr () -> TabHeightPrim
setValue''_ Ptr ()
a1' Ptr ()
a2' IO CInt -> (CInt -> IO Int) -> IO Int
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \res :: CInt
res ->
  let {res' :: Int
res' = CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
res} in
  Int -> IO Int
forall (m :: * -> *) a. Monad m => a -> m a
return (Int
res')

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

instance (Parent a WidgetBase, impl ~ (Maybe ( Ref a ) ->  IO (Either NoChange ()))) => Op (SetValue ()) TabsBase 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' = 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 152 "src/Graphics/UI/FLTK/LowLevel/Base/Tabs.chs" #-}

instance (impl ~ (IO (Maybe (Ref WidgetBase)))) => Op (GetPush ()) TabsBase 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 156 "src/Graphics/UI/FLTK/LowLevel/Base/Tabs.chs" #-}

instance (Parent a WidgetBase, impl ~ (Maybe ( Ref a ) ->  IO (Either NoChange ()))) => Op (SetPush ()) TabsBase 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 160 "src/Graphics/UI/FLTK/LowLevel/Base/Tabs.chs" #-}

instance (impl ~ (Position -> IO (Maybe (Ref WidgetBase)))) => Op (Which ()) TabsBase 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 164 "src/Graphics/UI/FLTK/LowLevel/Base/Tabs.chs" #-}

instance (impl ~ (TabsHeightOffset -> IO Rectangle)) => Op (ClientArea ()) TabsBase orig impl where
   runOp _ _ tabs tabh =
     withRef tabs $ \tabsPtr ->
       clientAreaWithTabh' tabsPtr (tabsHeightOffsetToInt tabh) >>= return . toRectangle

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

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

instance (impl ~ (IO AtIndex)) => Op (TabPositions ()) TabsBase orig impl where
  runOp _ _ tabs = withRef tabs $ \tabsPtr -> tabPositions' tabsPtr >>= return . AtIndex
tabHeight' :: (Ptr ()) -> IO ((Int))
tabHeight' a1 =
  let {a1' = id a1} in 
  tabHeight''_ a1' >>= \res ->
  let {res' = fromIntegral res} in
  return (res')

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

instance (impl ~ (IO Height)) => Op (TabHeight ()) TabsBase orig impl where
  runOp _ _ tabs = withRef tabs $ \tabsPtr -> tabHeight' tabsPtr >>= return . Height
getTabAlign' :: (Ptr ()) -> IO ((AlignType))
getTabAlign' a1 =
  let {a1' = id a1} in 
  getTabAlign''_ a1' >>= \res ->
  let {res' = cToEnum res} in
  return (res')

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

instance (impl ~ (IO (AlignType))) => Op (GetTabAlign ()) TabsBase orig impl where
   runOp _ _ tabs = withRef tabs $ \tabsPtr -> getTabAlign' tabsPtr
setTabAlign' :: (Ptr ()) -> (AlignType) -> IO ()
setTabAlign' a1 a2 =
  let {a1' = id a1} in 
  let {a2' = cFromEnum a2} in 
  setTabAlign''_ a1' a2' >>
  return ()

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

instance (impl ~ (AlignType ->  IO ())) => Op (SetTabAlign ()) TabsBase orig impl where
   runOp _ _ tabs a = withRef tabs $ \tabsPtr -> setTabAlign' tabsPtr a

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

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

drawTabsBase ::  Ref TabsBase -> IO ()
drawTabsBase tabs = withRef tabs $ \tabsPtr -> drawSuper' tabsPtr
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 186 "src/Graphics/UI/FLTK/LowLevel/Base/Tabs.chs" #-}

handleTabsBase :: Ref TabsBase -> Event ->  IO (Either UnknownEvent ())
handleTabsBase tabs event = withRef tabs $ \tabsPtr -> handleSuper' tabsPtr (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 189 "src/Graphics/UI/FLTK/LowLevel/Base/Tabs.chs" #-}

resizeTabsBase :: Ref TabsBase -> Rectangle -> IO ()
resizeTabsBase tabs rectangle =
    let (x_pos, y_pos, width, height) = fromRectangle rectangle
    in withRef tabs $ \tabsPtr -> resizeSuper' tabsPtr 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 194 "src/Graphics/UI/FLTK/LowLevel/Base/Tabs.chs" #-}

hideTabsBase ::  Ref TabsBase -> IO ()
hideTabsBase tabs = withRef tabs $ \tabsPtr -> hideSuper' tabsPtr
showSuper' :: (Ptr ()) -> IO ((()))
showSuper' a1 =
  let {a1' = id a1} in 
  showSuper''_ a1' >>= \res ->
  let {res' = supressWarningAboutRes res} in
  return (res')

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

showWidgetTabsBase ::  Ref TabsBase -> IO ()
showWidgetTabsBase tabs = withRef tabs $ \tabsPtr -> showSuper' tabsPtr

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

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

instance (impl ~ (  IO ())) => Op (Draw ()) TabsBase orig impl where
  runOp _ _ tabs = withRef tabs $ \tabsPtr -> draw'' 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 204 "src/Graphics/UI/FLTK/LowLevel/Base/Tabs.chs" #-}

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

instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) TabsBase 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
hide' :: (Ptr ()) -> IO ()
hide' a1 =
  let {a1' = id a1} in 
  hide''_ a1' >>
  return ()

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

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

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

instance (impl ~ (  IO ())) => Op (ShowWidget ()) TabsBase orig impl where
  runOp _ _ tabs = withRef tabs $ \tabsPtr -> show' tabsPtr

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

-- $functions
-- @
-- clientArea :: 'Ref' 'TabsBase' -> 'TabsHeightOffset' -> 'IO' 'Rectangle'
--
-- draw :: 'Ref' 'TabsBase' -> 'IO' ()
--
-- getPush :: 'Ref' 'TabsBase' -> 'IO' ('Maybe' ('Ref' 'WidgetBase'))
--
-- getTabAlign :: 'Ref' 'TabsBase' -> 'IO' ('AlignType')
--
-- getValue :: 'Ref' 'TabsBase' -> 'IO' ('Maybe' ('Ref' 'WidgetBase'))
--
-- handle :: 'Ref' 'TabsBase' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ())
--
-- hide :: 'Ref' 'TabsBase' -> 'IO' ()
--
-- resize :: 'Ref' 'TabsBase' -> 'Rectangle' -> 'IO' ()
--
-- setPush:: ('Parent' a 'WidgetBase') => 'Ref' 'TabsBase' -> 'Maybe' ( 'Ref' a ) -> 'IO' ('Either' 'NoChange' ())
--
-- setTabAlign :: 'Ref' 'TabsBase' -> 'AlignType' -> 'IO' ()
--
-- setValue:: ('Parent' a 'WidgetBase') => 'Ref' 'TabsBase' -> 'Maybe' ( 'Ref' a ) -> 'IO' ('Either' 'NoChange' ())
--
-- showWidget :: 'Ref' 'TabsBase' -> 'IO' ()
--
-- tabHeight :: 'Ref' 'TabsBase' -> 'IO' 'Height'
--
-- tabPositions :: 'Ref' 'TabsBase' -> 'IO' 'AtIndex'
--
-- which :: 'Ref' 'TabsBase' -> 'Position' -> 'IO' ('Maybe' ('Ref' 'WidgetBase'))
-- @

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Tabs.chs.h Fl_Tab_default_virtual_funcs"
  virtualFuncs''_ :: (IO (C2HSImp.Ptr ()))

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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